Jump to content

Winterfox

Members
  • Posts

    236
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Winterfox

  1. You should check out the script documentation. There you can see that bindatcmd takes the minimum group level that is allowed to run the atcommand as the third parameter. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>}; This command will bind a NPC event label to an atcommand. Upon execution of the atcommand, the user will invoke the NPC event label. Each atcommand is only allowed one binding. If you rebind, it will override the original binding. Note: The default level for atcommand is 0 while the default level for charcommand is 100.
  2. I tested this on an unmodified current rAthena and can't reproduce the bug. Do you have a more detailed explanation of the steps to reproduce it?
  3. You can use a function like this: prontera,152,178,0 script FINISH_TELEPORT_1 -1,0,0,{ OnTouch: callfunc("prize_teleport"); } prontera,149,178,0 script FINISH_TELEPORT_2 -1,0,0,{ OnTouch: callfunc("prize_teleport"); } function script prize_teleport { if(!#maze_prize_received) { getitembound(501, 1, Bound_Account); #maze_prize_received = 1; } else { dispbottom("You already got the prize!"); } warp("prontera", 150, 150); return; } Or you can simply duplicate the NPC and move the copy to where you need it. prontera,152,178,0 script FINISH_TELEPORT -1,0,0,{ OnTouch: // Check if the prize was already received. if(!#maze_prize_received) { // If the price wasn't received. Handout the item and set the account variable to 1 to signal that the prize was received. getitembound(501, 1, Bound_Account); #maze_prize_received = 1; } else { // Otherwise show a message to the player. dispbottom("You already got the prize!"); } // Warp the player. warp("prontera", 150, 150); } prontera,149,178,0 duplicate(FINISH_TELEPORT) FINISH_TELEPORT#01 -1,0,0
  4. I never used map_drop myself, but I assume that it works for all mobs that are on the specified map regardless of if they have a label or something.
  5. I see. Well there are different kinds of variables you can use which are bound to different things, for example to a NPC, a character or an account. In your case, you can simply use an account bound variable, that you can set to 1, when an account got a prize that you can later use to check if a prize was already obtained. For example, you could extend the script above like this: prontera,152,178,5 script FINISH_TELEPORT INVISIBLE,0,0,{ OnTouch: // Check if the prize was already received. if(!#maze_prize_received) { // If the price wasn't received. Handout the item and set the account variable to 1 to signal that the prize was received. getitembound(501, 1, Bound_Account); #maze_prize_received = 1; } else { // Otherwise show a message to the player. dispbottom("You already got the prize!"); } // Warp the player. warp("prontera", 150, 150); }
  6. Sorry, I don't understand your question. Could you please explain, in a bit more detail, what you want to achieve?
  7. For your script: The OnNPCKillEvent only gets executed when the killed mob doesn't have an attached label. For your YAML: You can't use tabs for indentation in YAML files, you also forgot to place a space between - and Index and between each parameter and its value. Here is an example of the YAML: Header: Type: MAP_DROP_DB Version: 2 Body: - Map: lhz_dun_n Globaldrops: - Index: 0 Item: Bio_Reseearch_Docu Rate: 2 - Index: 1 Item: Bio_Test_Fragment Rate: 2
  8. It doesn't seem that it is possible to do via scripting currently. There need to be source modifications done to make it possible.
  9. You can achieve that by creating an invisible NPC with a trigger zone. Here is a small example: // The view id is INVISIBLE to make the NPC not clickable and as the name suggests inivisible. // 0,0 is the x and y span centered around the NPC coordinates. prontera,152,178,5 script FINISH_TELEPORT INVISIBLE,0,0,{ OnTouch: // < This label gets executed when someone enters the trigger zone at the NPC coordinates. getitembound(501, 1, Bound_Account); // Creates a account bound item. warp("prontera", 150, 150); // Warps the player to the configured coordinates. }
  10. *freeloop({<toggle>}) Toggling this to enabled (1) allows the script instance to bypass the infinite loop protection, allowing your script to loop as much as it may need. Disabling (0) will warn you if an infinite loop is detected. The command will return the state of freeloop for the attached script, even if no argument is provided. Example: freeloop(1); // enable script to loop freely // be careful with what you do here for ( .@i = 0; .@i < .@bigloop; .@i++ ) { dothis; // will sleep the script for 1ms when detect an infinity loop to // let rAthena do what it needs to do (socket, timer, process, etc.) } freeloop(0); // disable freeloop for ( .@i = 0; .@i < .@bigloop; .@i++ ) { dothis; // throw an infinity loop error }
  11. Seems to be a problem specific to your emulator. I can't reproduce this error on the current rAthena.
  12. - script Freeitem FAKE_NPC,{ OnInit: .min_lvl = 70; .required_map$ = "izlude"; .item_id = 501; .amount = 1; .item_name = getitemname(.item_id); end; OnClock0000: addrid(0); getmapxy(.@current_map$, .@x, .@y); if(BaseLevel < .min_lvl || .@current_map$ != .required_map$) end; getitem(.item_id, .amount); message(strcharinfo(0), "ท่านได้ของรางวัลเป็น " + .@item_name$ + "."); }
  13. - script ::TALL_GRASS_MAIN FAKE_NPC,{ mes "=== Select Tools ==="; switch(select("- Stone Blade:- Bone Blade:- Cancel")) { clear; case 1: if (!rentalcountitem(40024)) { mes "Stone Blade is needed."; close; } if(!countitem(40044) && !countitem(40067)) end; if(countitem(40067)) { if(rand(1, 100) <= .drop_chances[0]) getitem(.@stone_items[rand(getarraysize(.@stone_items))], 1); } getitem(40006, 1); getitem(40008, 1); end; case 2: if (!rentalcountitem(40058)) { mes "Stone Blade is needed."; close; } if(!countitem(40044) && !countitem(40067)) end; if(countitem(40067)) { if(rand(1, 100) <= .drop_chances[1]) getitem(.@bone_items[rand(getarraysize(.@bone_items))], 1); } getitem(40008, 1); getitem(40006, 1); end; case 3: mes "Gathering Cancel"; close; } OnInit: setarray(.stone_items[0], 40068, 40069, 40070, 40071, 40072); setarray(.bone_items[0], 40068, 40069, 40070, 40071, 40072); setarray(.drop_chances, 5, 10); } // Duplicates //============================================================ neko_isle,75,122,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new11 666 new_1-3,111,73,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new12 666 new_1-3,115,71,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new13 666 new_1-3,119,71,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new14 666 new_1-3,123,71,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new15 666 new_1-3,127,71,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new16 666 new_1-3,131,72,6 duplicate(TALL_GRASS_MAIN) Tall Grass#new17 666
  14. //===== eAthena Script ======================================= //= Breeder //===== By: ================================================== //= Ace //===== Current Version: ===================================== //= 1.2 //===== Compatible With: ===================================== //= rAthena SVN 15400 and up. //= Client that supports new mounts. //===== Description: ========================================= //= Known as "Universal Rental NPC" //= Let's a player rent a pecopeco, falcon, cart, warg //= or ride a dragon, gryphon, and mado. //===== Changelog: =========================================== //= 1.1 Added Peco peco option, forgot to. //= Changed KN_RIDING to RK_DRAGONTRAINING //= for renting dragons. //= 1.2 Added restrictions for renting falcons and wargs. //= Added Warg Mastery skill requirement. //===== Additional Comments: ================================= //= No bugs found so far. //= Please report bugs to me([email protected]) //============================================================ - script gbreeder 726,{ mes "^FF0000Universal Rental NPC^000000"; mes "Greetings " + strcharinfo(0) + "!"; mes "I provide you with the service to "; mes "rent a cart or animal companion."; mes "The price for this service is " + .service_fee + "z."; mes "How may I help you today?"; next; if(select("Rental Services:Cancel") == 2) { mes "^FF0000Universal Rental NPC^000000"; mes "Alright, come again!"; close; } if(.service_fee > Zeny) { mes "^FF0000Universal Rental NPC^000000"; mes "Sadly you don't have enoug money."; mes "Please come back when you have it."; close; } mes "^FF0000Universal Rental NPC^000000"; mes "Please select from the items below:"; switch(select("PecoPeco:Cart:Falcon")) { case 1: // Pecopeco if(checkriding() || getskilllv("KN_RIDING")) { mes "Sorry, please make sure that you have the required job and skill, also not riding one."; close; } setriding(); mes "There you go, enjoy your Peco Peco!"; close; case 2: // Cart if(checkcart() || getskilllv("MC_PUSHCART")) { mes "Sorry, please make sure that you have the required job and skill, also not having a cart."; close; } setcart(); mes "There you go, enjoy your cart!"; close; case 3: // Falcon if(BaseClass != Job_Archer || checkfalcon() && getskilllv("HT_FALCON")) { mes "Sorry, please make sure that you have the required job and skill, also not having a falcon."; close; } if((Class == Job_Ranger || Class == Job_Ranger_T) && checkriding()) { mes "Sorry, You can't rent a falcon while having a warg with you."; close; } setfalcon(); mes "There you go, have fun with your falcon!"; close; } OnTimer0050: showscript("Universal Rental", getnpcid(0)); initnpctimer(); end; OnInit: .service_fee = 500; initnpctimer(); end; } //===== Duplicates: ========================================== //payon,140,222,5 duplicate(gbreeder) Universal Rental NPC#1 726 payon,151,167,5 duplicate(gbreeder) Universal Rental NPC#1 726 //============================================================ eclage,116,37,5 duplicate(gbreeder) Universal Rental NPC#100 726 bg_lobby,60,42,4 duplicate(gbreeder) Universal Rental NPC#1123 726
  15. I didn't test it, but I would do write the kind of script you want to do like this: prontera,146,161,5 script CheckRank 118,{ mes .npc_name; mes "Hello, this is a MvP Ranker"; mes "Would you like to know the MvP Ranking?"; next; if(select("Top 20:Leave") == 2) { mes.npcranker; mes "Bye"; close; } mes.npc_name; for(.@i = 0; .@i < 20; .@i++) mes "The Top " + (.@i + 1) + " MVP: " + $top_mvp_names$[.@i] + " Killed: " + $top_mvp_kills$[.@i] + "."; close; OnInit: .npc_name = "[MvP Ranker]"; } - script MVP_RANKER FAKE_NPC,{ OnNPCKillEvent: if(killedrid != 1002) end; mvp_rank_points++; dispbottom("You have obtained 1 Rank Point. You now have " + mvp_rank_points + "."); callfunc("updateMVPRank", strcharinfo(0), mvp_rank_points); } function script updateMVPRank { .@curr_name$ = getarg(0); .@curr_kills = getarg(1); for(.@i = 0; .@i < 20; .@i++) { if($top_mvp_kills$[.@i] < .@curr_kills && $top_mvp_names$[.@i] != .@curr_name$) { .@new_name = .@curr_name; .@new_kills = .@curr_kills; .@curr_name = $top_mvp_names$[.@i]; .@curr_kills = $top_mvp_kills$[.@i]; $top_mvp_names$[.@i] = .@new_name; $top_mvp_kills$[.@i] = .@new_kills; continue; } if($top_mvp_kills$[.@i] < .@curr_kills) { $top_mvp_kills$[.@i] = .@curr_kills; break; } } }
  16. .@nombre == strcharinfo(0) You compare a numeric variable with a string.
  17. It would be helpful if you would explain exactly what is not working and how you expect it to.
  18. You should look in the script documentation to solve such problems yourself first. You can find it here: https://github.com/rathena/rathena/blob/master/doc/script_commands.txt There you can find the following: *equip <item id>{,<char_id>}; *autoequip <item id>,<option>; These commands are to equip a equipment on the attached character. The equip function will equip the item ID given when the player has this item in his/her inventory, while the autoequip function will equip the given item ID when this is looted. The option parameter of the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off. Examples: //This will equip a 1104 (falchion) on the character if this is in the inventory. equip 1104; //The invoked character will now automatically equip a falchion when it's looted. autoequip 1104,1; //The invoked character will no longer automatically equip a falchion. autoequip 1104,0;
  19. According to the error messages, the problem doesn't seem to be related to your function. It rather seems like it is a problem how it is called. You also could use item groups instead of writing your own script: https://github.com/rathena/rathena/blob/master/doc/item_group.txt
  20. You can achieve that by using the achievement system: https://github.com/rathena/rathena/blob/master/doc/achievements.md
  21. If you want to log vending for every npc shop, not for a specific one, this is a case for the source modification section. I see, well that is also a case for the source mod section.
  22. I tested the script and could not reproduce the error.
  23. - script Workbench FAKE_NPC,{ .@wrkb_id = atoi(strnpcinfo(2)); if($wrkb_crafting_state[.@wrkb_id] == 1) { mes "Please wait until the crafting process is finished. "; close; } if($wrkb_crafting_state[.@wrkb_id] == 2) { mes "Here are your crafted items."; for(.@i = 0; .@i < getarraysize(getd("$wrkb_" + .@wrkb_id + "_products")); .@i += 2) getitem(getd("$wrkb_" + .@wrkb_id + "_products[" + .@i + "]"), getd("$wrkb_" + .@wrkb_id + "_products[" + (.@i + 1) + "]")); delwaitingroom; $wrkb_crafting_state[.@wrkb_id] = 0; close; } mes "=============================="; mes "^ff0000 Any item crafted by using the public Workbench can be stolen by other players !! ^000000"; mes "=============================="; next; mes "What do you want to craft?"; next; switch(select("Stone Dagger:Stone Axe:Ropes:Stone Chunk:Cancel")) { case 1: if(countitem(40005) < 4) { mes "^ff0000 Stone Dagger ^000000"; mes "Requires:-"; mes "- [4] Rocks"; close; } delitem(40005, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40009, 1); goto OnCraftingStart; case 2: if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) { mes "^ff0000 Stone Axe ^000000"; mes "Requires:-"; mes "- [1] Rock Chunk"; mes "- [2] Ropes"; mes "- [1] Branch"; close; } delitem(40018, 1); delitem(40014, 2); delitem(40003, 1); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40017, 1); goto OnCraftingStart; case 3: if(countitem(40008) < 4) { mes "^ff0000 Ropes ^000000"; mes "Require:-"; mes "- [4] Stalk"; close; } delitem(40008, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40014, 1); goto OnCraftingStart; case 4: if(countitem(40005) < 4) { mes "^ff0000 Rock Chunk ^000000"; mes "Requires:-"; mes "- [4] Rock"; close; } delitem(40005, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40018, 1); goto OnCraftingStart; case 5: mes "Crafting canceled."; close; } end; OnCraftingStart: $wrkb_crafting_state[.@wrkb_id] = 1; waitingroom("CRAFTING...", 0); initnpctimer; end; OnTimer60000: $wrkb_crafting_state[atoi(strnpcinfo(2))] = 2; delwaitingroom; waitingroom("COMPLETED!", 0); end; OnInit: .@wrkb_id = atoi(strnpcinfo(2)); if(.@wrkb_id < 1) end; if($wrkb_crafting_state[.@wrkb_id] == 1) goto OnCraftingStart; } //Duplicate //===================================================== new_1-3,98,58,6 duplicate(Workbench) Workbench#1 665 new_1-3,98,50,6 duplicate(Workbench) Workbench#2 665 new_1-3,98,43,6 duplicate(Workbench) Workbench#3 665 //new_1-3,113,45,6 duplicate(Workbench) Workbench#4 665 //new_1-3,114,39,6 duplicate(Workbench) Workbench#5 665 //new_1-3,110,36,6 duplicate(Workbench) Workbench#6 665 //new_1-3,114,33,6 duplicate(Workbench) Workbench#7 665
  24. - script Workbench FAKE_NPC,{ .@wrkb_id = atoi(strnpcinfo(2)); if($wrkb_crafting_state[.@wrkb_id] == 1) { mes "Please wait until the crafting process is finished. "; close; } if($wrkb_crafting_state[.@wrkb_id] == 2) { mes "Here are your crafted items."; for(.@i = 0; .@i < getarraysize(getd("$wrkb_" + .@wrkb_id + "_products")); .@i += 2) getitem(getd("$wrkb_" + .@wrkb_id + "_products[" + .@i + "]"), getd("$wrkb_" + .@wrkb_id + "_products[" + (.@i + 1) + "]")); delwaitingroom; $wrkb_crafting_state[.@wrkb_id] = 0; close; } mes "=============================="; mes "^ff0000 Any item crafted by using the public Workbench can be stolen by other players !! ^000000"; mes "=============================="; next; mes "What do you want to craft?"; next; switch(select("Stone Dagger:Stone Axe:Ropes:Stone Chunk:Cancel")) { case 1: if(countitem(40005) < 4) { mes "^ff0000 Stone Dagger ^000000"; mes "Requires:-"; mes "- [4] Rocks"; close; } delitem(40005, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40009, 1); goto OnCraftingStart; case 2: if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) { mes "^ff0000 Stone Axe ^000000"; mes "Requires:-"; mes "- [1] Rock Chunk"; mes "- [2] Ropes"; mes "- [1] Branch"; close; } delitem(40018, 1); delitem(40014, 2); delitem(40003, 1); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40017, 1); goto OnCraftingStart; case 3: if(countitem(40008) < 4) { mes "^ff0000 Ropes ^000000"; mes "Require:-"; mes "- [4] Stalk"; close; } delitem(40008, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40014, 1); goto OnCraftingStart; case 4: if(countitem(40005) < 4) { mes "^ff0000 Rock Chunk ^000000"; mes "Requires:-"; mes "- [4] Rock"; close; } delitem(40005, 4); setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40018, 1); goto OnCraftingStart; case 5: mes "Crafting canceled."; close; } end; OnCraftingStart: $wrkb_crafting_state[.@wrkb_id] = 1; waitingroom("CRAFTING...", 0); initnpctimer; end; OnTimer60000: $wrkb_crafting_state[strnpcinfo(2)] = 2; delwaitingroom; waitingroom("COMPLETED!", 0); end; OnInit: .@wrkb_id = atoi(strnpcinfo(2)); if(.@wrkb_id < 1) end; if($wrkb_crafting_state[.@wrkb_id] == 1) goto OnCraftingStart; } //Duplicate //===================================================== new_1-3,98,58,6 duplicate(Workbench) Workbench#1 665 new_1-3,98,50,6 duplicate(Workbench) Workbench#2 665 new_1-3,98,43,6 duplicate(Workbench) Workbench#3 665 //new_1-3,113,45,6 duplicate(Workbench) Workbench#4 665 //new_1-3,114,39,6 duplicate(Workbench) Workbench#5 665 //new_1-3,110,36,6 duplicate(Workbench) Workbench#6 665 //new_1-3,114,33,6 duplicate(Workbench) Workbench#7 665
  25. - script Workbench FAKE_NPC,{ .@wrkb_id = strnpcinfo(2); if($wrkb_crafting_state[.@wrkb_id] == 1) { mes "Please wait until the crafting process is finished. "; close; } if($wrkb_crafting_state[.@wrkb_id] == 2) { mes "Here are your crafted items."; for(.@i = 0; .@i < getarraysize($product); .@i += 2) getitem($product[.@i], $product[.@i + 1]); delwaitingroom; $wrkb_crafting_state[.@wrkb_id] = 0; close; } mes "=============================="; mes "^ff0000 Any crafted item using public Workbech can be stolen by other player !! ^000000"; mes "=============================="; next; mes "What do you want to craft?"; next; switch(select("Stone Dagger:Stone Axe:Ropes:Stone Chunk:Cancel")) { case 1: if(countitem(40005) < 4) { mes "^ff0000 To craft Stone Dagger ^000000"; mes "Require:-"; mes "- [4] Rocks"; close; } delitem(40005, 4); setarray($product, 40007, 1, 40009, 1); goto OnCraftingStart; case 2: if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) { mes "^ff0000 To craft Stone Axe ^000000"; mes "Require:-"; mes "- [1] Rock Chunk"; mes "- [2] Ropes"; mes "- [1] Branch"; close; } delitem(40018, 1); delitem(40014, 2); delitem(40003, 1); setarray($product, 40007, 1, 40017, 1); goto OnCraftingStart; case 3: if(countitem(40008) < 4) { mes "^ff0000 To craft Ropes ^000000"; mes "Require:-"; mes "- [4] Stalk"; close; } delitem(40008, 4); setarray($product, 40007, 1, 40014, 1); goto OnCraftingStart; case 4: if(countitem(40005) < 4) { mes "^ff0000 To craft Rock Chunk ^000000"; mes "Require:-"; mes "- [4] Rock"; close; } delitem(40005, 4); setarray($product, 40007, 1, 40018, 1); goto OnCraftingStart; case 5: mes "Crafting canceled."; close; } end; OnCraftingStart: $wrkb_crafting_state[.@wrkb_id] = 1; waitingroom("CRAFTING...", 0); initnpctimer; end; OnTimer60000: $wrkb_crafting_state[strnpcinfo(2)] = 2; delwaitingroom; waitingroom("COMPLETED!", 0); end; OnInit: if($wrkb_crafting_state[strnpcinfo(2)] == 1) goto OnCraftingStart; } //Duplicate //===================================================== new_1-3,98,58,6 duplicate(Workbench) Workbench#1 665 new_1-3,98,50,6 duplicate(Workbench) Workbench#2 665 new_1-3,98,43,6 duplicate(Workbench) Workbench#3 665 //new_1-3,113,45,6 duplicate(Workbench) Workbench#4 665 //new_1-3,114,39,6 duplicate(Workbench) Workbench#5 665 //new_1-3,110,36,6 duplicate(Workbench) Workbench#6 665 //new_1-3,114,33,6 duplicate(Workbench) Workbench#7 665
×
×
  • Create New...