Jump to content

All Activity

This stream auto-updates

  1. Today
  2. This is my code but i always get an error: set @string$, "( `name_aegis` IN ( SELECT DISTINCT `drop1_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop2_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop3_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop4_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop5_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop6_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop7_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop8_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop9_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop10_item` FROM `mob_db_re` ) )"; set @sql_query$, "SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND " + .@string$; dispbottom "Generated SQL query: " + @sql_query$; .@nb = query_sql(@sql_query$, .@id); Error: [SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 [Debug]: at D:\Games\Ragnarok\01_emulator\renewal\src\map\script.cpp:17797 - SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND [Warning]: Script command 'query_sql' returned failure. [Debug]: Source (NPC): Card_Quest_NPC at moc_para01 (16,13) [Debug]: Source (NPC): Card_Quest_NPC is located in: npc/custom/Card_Collector.txt I even tried this in query tab of database SELECT COUNT(*) FROM `mob_db_re` WHERE `drop8_item` IS NOT NULL; it returned 859. So meaning it has value. I also tried this set @query$, "SELECT `mob_db_re`.`drop8_item` FROM `mob_db_re`"; dispbottom "Generated SQL query: " + .@query$; .@nb = query_sql(.@query$, .@id); dispbottom "Number of rows returned: " + .@nb; it didn't return anything.
  3. Could anyone help me find out how this happened? My clone damage on was about 900+ And The clone damagetaken was 8500 / 6500 I think there was a problem with the source code mob.cpp in line mob_spawn() function that needs to be edited/Modified or need to add new line of codes. WindowsRO 2024-06-02 14-44-46.mp4 WindowsRO 2024-06-02 14-45-29.mp4
  4. i dont think its possible then without duplicate it.
  5. yeep but its only have 1 item. but i want like a : Goblin Mask can use at TOP or Middle. without duplicate the id item
  6. Like Chaos mentioned, each quest need it's own variable to register each cooldown time. Try using tr0n's Questboard, it does what you want and it is easy to add/edit quests. Find these lines to see the examples: AddHunting("Prontera Field 01",11340,1,21,"40221|40222",1,0,2100,2100,1002,300,1007,300,1008,300); AddCollect("Foliage Gathering",1,11,"40221",1,0,2100,2100,705,10,707,10,7100,10,706,1);
  7. I am not sure if I am posting in the correct category. I apologize if not. Only included here are sprites inside the Classes folder that has gibberish characters on it. This does not include 4th jobs and some jobs that have English names. This also does not include weapons, NPCs and mobs. I also removed the “_³²” and “_¿©” for male and female respectively after each names. The list also does not follow the order inside the folder. Classes Path: data.grf > data > sprite > Àΰ£Á· > ¸öÅë ³² - Male ¿© - Female Novices: Ãʺ¸ÀÚ - Novice ½´ÆÛ³ëºñ½º - Super Novice / Expanded Super Novice 1st Jobs: ¼ºÁ÷ÀÚ - Acolyte ¼ºÁ÷ÀÚ_h - Acolyte ±Ã¼ö - Archer ¸¶¹ý»ç - Magician »óÀÎ - Merchant °Ë»ç - Swordsman µµµÏ - Thief 2-1 Jobs: ÇÁ¸®½ºÆ® - Priest ÇÁ¸®½ºÆ®_h - Priest ¼ºÅõ»ç - Priest ÇåÅÍ - Hunter ÇåÅÍ_h - Hunter À§Àúµå - Wizard À§Àúµå_h - Wizard Á¦Ã¶°ø - Blacksmith Á¦Ã¶°ø_h - Blacksmith ±â»ç - Knight ±â»ç_h - Knight ¾î¼¼½Å - Assassin ¾î¼¼½Å_h - Assassin 2-2 Jobs: ¸ùÅ© - Monk ¸ùÅ©_h - Monk ¹Ùµå - Bard ¹Ùµå_h - Bard ¹«Èñ - Dancer ¹«Èñ_h - Dancer ¼¼ÀÌÁö - Sage ¼¼ÀÌÁö_h - Sage ¿¬±Ý¼ú»ç - Alchemist ¿¬±Ý¼ú»ç_h - Alchemist Å©·ç¼¼ÀÌ´õ - Crusader Å©·ç¼¼ÀÌ´õ_h - Crusader ·Î±× - Rogue ·Î±×_h - Rogue Transcendent 2-1 Jobs: ÇÏÀÌÇÁ¸® - High Priest ¼ºÅõ»ç2 - High Priest ½º³ªÀÌÆÛ - Sniper ÇÏÀÌÀ§Àúµå - High Wizard È­ÀÌÆ®½º¹Ì½º - Whitesmith ·Îµå³ªÀÌÆ® - Lord Knight ¾î½Ø½ÅÅ©·Î½º - Assassin Cross Transcendent 2-2 Jobs: èÇÇ¿Â - Champion Ŭ¶ó¿î - Clown Áý½Ã - Gypsy ÇÁ·ÎÆä¼­ - Professor Å©¸®¿¡ÀÌÅÍ - Creator Æȶóµò - Paladin ½ºÅäÄ¿ - Stalker 3-1 Jobs: ¾ÆÅ©ºñ¼ó - Archbishop ·¹ÀÎÁ® - Ranger ¿ö·Ï - Warlock ¹ÌÄÉ´Ð - Mechanic ·é³ªÀÌÆ® - Rune Knight ±æ·Îƾũ·Î½º - Guillotine Cross 3-2 Jobs: ½´¶ó - Sura ¹Î½ºÆ®·² - Minstrel ¿ø´õ·¯ - Wanderer ¼Ò¼­·¯ - Sorcerer Á¦³×¸¯ - Genetic °¡µå - Royal Guard ½¦µµ¿ìüÀ̼­ - Shadow Chaser Expanded Jobs: °Ç³Ê - Gunslinger ´ÑÀÚ - Ninja űǼҳâ - Taekwon ±Ç¼º - Star Gladiator ¼Ò¿ï¸µÄ¿ - Soul Linker ¼ºÁ¦ - Star Emperor ¼Ò¿ï¸®ÆÛ - Soul Reaper -------------------------------------------------- Cash Mounts Novices: ³ëºñ½ºÆ÷¸µ - Poring Novice ½´ÆÛ³ëºñ½ºÆ÷¸µ - Poring Super Novice / Expanded Super Novice 1st: º¹»ç¾ËÆÄÄ« - Alpaca Acolyte ŸÁ¶±Ã¼ö - Ostrich Archer ¿©¿ì¸¶¹ý»ç - Nine Tail Magician »óÀθäµÅÁö - Savage Merchant ÆäÄÚ°Ë»ç - Peco Peco Swordsman Ä̺£·Î½ºµµµÏ - Galleon Thief 2-1: ÇÁ¸®½ºÆ®¾ËÆÄÄ« - Alpaca Priest ŸÁ¶ÇåÅÍ - Ostrich Hunter ¿©¿ìÀ§Àúµå - Nine Tail Wizard Á¦Ã¶°ø¸äµÅÁö - Savage Blacksmith »çÀÚ±â»ç - King Lion Knight Ä̺£·Î½º¾î½ê½Å - Galleon Assassin 2-2: ¸ùÅ©¾ËÆÄÄ« - Alpaca Monk ŸÁ¶¹Ùµå - Ostrich Bard ŸÁ¶¹«Èñ - Ostrich Dancer ¿©¿ì¼¼ÀÌÁö - Nine Tail Sage ¿¬±Ý¼ú»ç¸äµÅÁö - Savage Alchemist »çÀÚÅ©·ç¼¼ÀÌ´õ - King Lion Crusader Ä̺£·Î½º·Î±× - Galleon Rogue T2-1: ÇÏÀÌÇÁ¸®½ºÆ®¾ËÆÄÄ« - Alpaca High Priest ŸÁ¶½º³ªÀÌÆÛ - Ostrich Sniper ¿©¿ìÇÏÀÌÀ§Àúµå - Nine Tail High Wizard È­ÀÌÆ®½º¹Ì½º¸äµÅÁö - Savage Whitesmith »çÀڷε峪ÀÌÆ® - King Lion Lord Knight Ä̺£·Î½º¾î½ê½ÅÅ©·Î½º - Galleon Assassin Cross T2-2: èÇǿ¾ËÆÄÄ« - Alpaca Champion ŸÁ¶Å©¶ó¿î - Ostrich Clown ŸÁ¶Â¤½Ã - Ostrich Gypsy ¿©¿ìÇÁ·ÎÆä¼­ - Nine Tail Professor Å©¸®¿¡ÀÌÅ͸äµÅÁö - Savage Creator »çÀÚÆȶóµò - King Lion Paladin Ä̺£·Î½º½ºÅäÄ¿ - Galleon Stalker 3-1: ¾ÆÅ©ºñ¼ó¾ËÆÄÄ« - Alpaca Archbishop ŸÁ¶·¹ÀÎÁ® - Ostrich Ranger ¿©¿ì¿ö·Ï - Nine Tail Warlock ¹ÌÄɴиäµÅÁö - Savage Mechanic »çÀڷ鳪ÀÌÆ® - King Lion Rune Knight Ä̺£·Î½º±æ·Îƾũ·Î½º - Galleon Guillotine Cross 3-2: ½´¶ó¾ËÆÄÄ« - Alpaca Sura ŸÁ¶¹Î½ºÆ®·² - Ostrich Minstrel ŸÁ¶¿ø´õ·¯ - Ostrich Wanderer ¿©¿ì¼Ò¼­·¯ - Nine Tail Sorcerer Á¦³×¸¯¸äµÅÁö - Savage Genetic »çÀڷξⰡµå - King Lion Royal Guard Ä̺£·Î½º½¦µµ¿ìüÀ̼­ - Galleon Shadow Chaser Expanded: űǼҳâÆ÷¸µ - Poring Taekwon µÎ²¨ºñ´ÑÀÚ - Poison Toad Ninja ÆäÄÚ°Ç³Ê - Bike Gunslinger (Peco Peco in older version) ±Ç¼ºÆ÷¸µ - Poring Star Gladiator µÎ²¨ºñ¼Ò¿ï¸µÄ¿ - Poison Toad Soul Linker ÇØżºÁ¦ - Haetae Star Emperor ÇØżҿ︮ÆÛ - Haetae Soul Reaper -------------------------------------------------- Skill/Combat Mounts ÆäÄÚÆäÄÚ_±â»ç - Peco Peco Knight ÆäÄÚÆäÄÚ_±â»ç_h - Peco Peco Knight ·ÎµåÆäÄÚ - Armored Peco Peco Lord Knight ·é³ªÀÌÆ®»Ú¶ì - Ferus Rune Knight ·é³ªÀÌÆ®»Ú¶ì2 - Black Ferus Rune Knight ·é³ªÀÌÆ®»Ú¶ì3 - White Ferus Rune Knight ·é³ªÀÌÆ®»Ú¶ì4 - Blue Ferus Rune Knight ·é³ªÀÌÆ®»Ú¶ì5 - Red Ferus Rune Knight ·¹ÀÎÁ®´Á´ë - Warg Ranger ¸¶µµ±â¾î - Magic Gear Mechanic ¸¶µµ¾Æ¸Ó - Magic Gear Mechanic (jRO) ±¸ÆäÄÚÅ©·ç¼¼ÀÌ´õ - Peco Peco Crusader ½ÅÆäÄÚÅ©·ç¼¼ÀÌ´õ - Grand Peco Crusader ½ÅÆäÄÚÅ©·ç¼¼ÀÌ´õ_h - Grand Peco Crusader ÆäÄÚÆȶóµò - Armored Grand Peco Paladin ±×¸®Æù°¡µå - Gryphon Royal Guard -------------------------------------------------- Others: ¹«Èñ_¿©_¹ÙÁö - Pants Dancer ±Ç¼ºÀ¶ÇÕ - Floating Star Gladiator ¼ºÁ¦À¶ÇÕ - Floating Star Emperor Costumes: »êŸ - Christmas ¿©¸§ - Summer ¿©¸§2 - Summer 2 °áÈ¥ - Wedding Åνõµ - Wedding ÇѺ¹ - Hanbok ¿ÁÅä¹öÆнºÆ® - Oktoberfest GMs: ¿î¿µÀÚ - Gamemaster ¿î¿µÀÚ2 - Gamemaster 2 Mercenaries: °Ë¿ëº´ - Mercenary Fencer (Male) â¿ëº´ - Mercenary Spearman (Male) È°¿ëº´ - Mercenary Bowman (Female) ================================================== Hairstyles Path (Norman): data.grf > data > sprite > Àΰ£Á· > ¸Ó¸®Åë Doram Path (Classes): data.grf > data > sprite > µµ¶÷Á· > ¸öÅë Doram Path (Hairstyles): data.grf > data > sprite > µµ¶÷Á· > ¸Ó¸®Åë
  8. I had to make a number of changes to the script, otherwise it didn't work correctly. src/map/map.cpp Change @@ -2829,6 +2835,27 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (map_getmapflag(m, MF_MOBITEMADDER)) { for (const auto& it : mapdata->mobitemadder_droplist) { if (it.mob_id == md->mob_id) { struct s_mob_drop mobdrop; drop_rate = it.item_per; mobdrop.nameid = it.item_id; if (rand() % 10000 > drop_rate) continue; - if (!ditem || !itemdb_exists(it.item_id)) + if (!itemdb_exists(it.item_id)) continue; ditem = mob_setdropitem(&mobdrop, 1, it.mob_id); mob_item_drop(md, dlist, ditem, 0, it.item_per, homkillonly); } } } src/map/npc.cpp new code case MF_MOBITEMADDER: { if (state) { // Copy the string so as not to modify the original string char* droplist = strdup(w4); if (droplist) { char* checkdroplist = strtok(droplist, ", "); if (checkdroplist) { union u_mapflag_args args = {}; args.mobitemadder.mob_id = atoi(checkdroplist); // Clearing the current item data of a mob before adding new ones map_setmapflag(m, MF_MOBITEMADDER, false); // Create a temporary array to store added items int added_items[50]; // Assume no more than 50 items per monster int num_added_items = 0; // Number of items added // Process the string and add the items while ((checkdroplist = strtok(NULL, ", "))) { args.mobitemadder.item_id = atoi(checkdroplist); if ((checkdroplist = strtok(NULL, ", "))) { args.mobitemadder.item_per = atoi(checkdroplist); // Check to see if the mob already has the item. bool already_added = false; for (int i = 0; i < num_added_items; ++i) { if (added_items[i] == args.mobitemadder.item_id) { already_added = true; break; } } // If the item is not already present on the mob, add it if (!already_added) { map_setmapflag_sub(m, MF_MOBITEMADDER, true, &args); added_items[num_added_items++] = args.mobitemadder.item_id; } } } } free(droplist); // Freeing the allocated memory } } else { map_setmapflag(m, MF_MOBITEMADDER, false); } break; } The only problem I have not been able to solve is the duplicate drop if @reloadscript is produced on the server That is, if you did reloadscript 10 times, the drop will drop in 10 instances.
  9. So I heard that in kRO, 3rd jobs from non-trans 2nd job cannot change to 4th job. They would need to change from a non-trans 3rd job to a transcendent 3rd job to be able to change to a 4th job as 4th jobs has access to trans stats and skills. I also heard that there is an NPC or option in kRO to change reg 3rd to trans 3rd. I guess my question is how to change from non-trans 3rd to trans 3rd so that you can change to 4th job? Like what are the requirements and process? Thank you for answering and God Bless =>
  10. #EXCOOLDOWN = gettimetick(2) + 86400 I just skimmed the script, and saw both quest are using the same variable, any quest finished will have the same cooldown for both since both are using the same variable cooldown.
  11. ever tried using this? *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}}; This command will attach a script to a player for a given duration, in seconds. After that time, the script will automatically expire. The same bonus cannot be stacked. By default, this bonus will be stored on `bonus_script` table when player logs out. Flags (bitmask): 1 : Remove when dead. 2 : Removable by Dispell. 4 : Removable by Clearance. 8 : Remove when player logs out. 16 : Removeable by Banishing Buster. 32 : Removable by Refresh. 64 : Removable by Lux Anima. 128 : Remove when Madogear is activated or deactivated. 256 : Remove when receive damage. 512 : Script is permanent, cannot be cleared by bonus_script_clear. 1024: Force to replace duplicated script by expanding the duration. 2048: Force to add duplicated script. This flag cannot be stacked with 1024, if both are defined, 1024 will be checked first and ignore this flag.
  12. Yesterday
  13. It working. But it walk like a dumb. Anyone can modify it to make it walk straight until it stuck and then try another path? Or make it choose more further point. Not random walking around same point. This is my diff for last rA I just pull yesterday. I'm not a coder. Just combined everything I read from this topic and read the code then apply it manually. I just googled how to made this patch file and want to share. I can read the code to analysis how it work but can't write the code by myself. xD @tack.patch
  14. When i finish 1 quest, the script reads as a whole, which means i cant take quest 2 or quest 3, even i have never done quest 2 or quest 3, i have only done quest 1, so how to make each quest individual? and if anymore can make this script more simplify and cleaner, i would be very much appricate it, please send help thanks for your time helping me.
  15. how to solve this after woe end i got this error and no mail sent on my RODEX
  16. Hi May I ask all of you kindhearted fellow if anyone could share this kind of standing portal sprite or anything alike. I really need a kind of portal like this for the feature I'm working on. I would greatly appreciate it. Thank you!
  17. @kanecharles,Thanks for the advice, I'll try to maneuver through it, thanks again for your contribution!
  18. im not asking for spoon feed, i was asking if there was an alternative ways for me to simplfy the script for save point feature instend of re write the script line by line for each individual npc, i was thinking about using function but kinda clueles on how should i write em
  19. This is the reason save_point: clear; soundeffect "menu.wav",0; mes "^ce7e00 === FARIDAH === ^000000"; mes "Your respawn point has been saved to Veil. Thank you."; savepoint "veil",120,104; <--------------------------------------- close; You specifically put the map name with coordinates . Instead of doing that just put return to save point script . Im not gonna spoon feed you anymore so you will learn
  20. thanks, but some of the mes overlap, but i fix that by adding clear; but the only problem now is save point feature, if im in amatsu town example, and choose to save, it would only save to veil town (custom main town), is there a way that i can make the save feature for all npc arcoding to which city player currently are? or the only option is to make idividual npc with diffrent save point ..??
  21. I go that to my github. but here is your request i added a boss chance too . The code is user friendly so you can customize it with your desire . If it helps make sure to up my response so other player will know that the post is solve prontera,155,185,5 script Random Card NPC 100,{ .@zeny_cost = 1000000; // Zeny cost per roll .@normal_chance = 89; // Normal monster card chance (89%) .@mini_chance = 10; // Mini monster card chance (10%) .@boss_chance = 1; // Boss card chance (1%) menu "Welcome to the Random Card NPC! What would you like to do?", "Roll for a random card (" + .@zeny_cost + " Zeny)", Roll, "Nevermind", Quit; OnInit: setarray .@normal_cards, 4001, 4002, 4003; // Example normal monster card IDs (You can add or remove as needed) setarray .@mini_cards, 4004, 4005, 4006; // Example mini monster card IDs (You can add or remove as needed) setarray .@boss_cards, 4007, 4008, 4009; // Example boss monster card IDs (You can add or remove as needed) end; Roll: if (countitem(zeny) < .@zeny_cost) { mes "[Random Card NPC]"; mes "You don't have enough Zeny."; close; } delitem zeny, .@zeny_cost; .@roll = rand(100); // Roll a random number between 0 and 99 if (.@roll < .@normal_chance) { // Player gets a normal monster card .@card_id = .@normal_cards[rand(getarraysize(.@normal_cards))]; getitem .@card_id, 1; mes "[Random Card NPC]"; mes "Congratulations! You got a normal monster card."; close; } else if (.@roll < .@normal_chance + .@mini_chance) { // Player gets a mini monster card .@card_id = .@mini_cards[rand(getarraysize(.@mini_cards))]; getitem .@card_id, 1; mes "[Random Card NPC]"; mes "Congratulations! You got a mini monster card."; close; } else if (.@roll < .@normal_chance + .@mini_chance + .@boss_chance) { // Player gets a boss monster card .@card_id = .@boss_cards[rand(getarraysize(.@boss_cards))]; getitem .@card_id, 1; mes "[Random Card NPC]"; mes "Congratulations! You got a boss monster card."; close; } else { // Player gets nothing mes "[Random Card NPC]"; mes "Sorry, you didn't get any card this time."; close; } Quit: mes "[Random Card NPC]"; mes "Come back anytime if you want to try your luck again!"; close; }
  22. Try this i made // Gold Room Entrance NPC firstcity,100,100,4 script Gold Room Entrance 857,{ mes "[Gold Room NPC]"; mes "Welcome to the Gold Room!"; mes "Do you want to enter the Gold Room?"; if(select("Yes:No") == 2) { mes "[Gold Room NPC]"; mes "Alright, come back if you change your mind."; close; } if (checkweight(969, 1)) { // Ensure the player has at least 1 weight free to collect Gold Bars warp "gold_room", 50, 50; // Replace "gold_room" with your actual Gold Room map name close; } else { mes "[Gold Room NPC]"; mes "You are carrying too much weight!"; close; } } // Exchange Gold Bars for Coins NPC gold_room,50,50,4 script Exchange NPC 858,{ mes "[Exchange NPC]"; mes "I can exchange your Gold Bars for coins."; mes "What would you like to do?"; switch(select("Exchange Gold Bars for Coins:Exchange Coins for Zeny:Cancel")) { case 1: callfunc("exchange_goldbars"); break; case 2: callfunc("exchange_coins"); break; case 3: mes "[Exchange NPC]"; mes "Come back if you change your mind."; close; } close; } function script exchange_goldbars { mes "[Exchange NPC]"; mes "How many Gold Bars do you want to exchange?"; input .@goldbars; if (countitem(969) < .@goldbars) { mes "You don't have that many Gold Bars."; close; } mes "Which coin do you want to receive?"; switch(select("Platinum Coin:Gold Coin:Bronze Coin:Cancel")) { case 1: delitem 969, .@goldbars; getitem 671, .@goldbars / 10; // Example exchange rate: 10 Gold Bars = 1 Platinum Coin break; case 2: delitem 969, .@goldbars; getitem 673, .@goldbars / 5; // Example exchange rate: 5 Gold Bars = 1 Gold Coin break; case 3: delitem 969, .@goldbars; getitem 672, .@goldbars / 1; // Example exchange rate: 1 Gold Bar = 1 Bronze Coin break; case 4: mes "Alright, come back if you change your mind."; close; } mes "Thank you! Here are your coins."; close; } function script exchange_coins { mes "[Exchange NPC]"; mes "Which coin do you want to exchange for Zeny?"; switch(select("Platinum Coin:Gold Coin:Bronze Coin:Cancel")) { case 1: mes "How many Platinum Coins do you want to exchange?"; input .@platinum; if (countitem(671) < .@platinum) { mes "You don't have that many Platinum Coins."; close; } delitem 671, .@platinum; set zeny, zeny + (.@platinum * 1000000); // Example exchange rate: 1 Platinum Coin = 1,000,000 Zeny break; case 2: mes "How many Gold Coins do you want to exchange?"; input .@gold; if (countitem(673) < .@gold) { mes "You don't have that many Gold Coins."; close; } delitem 673, .@gold; set zeny, zeny + (.@gold * 100000); // Example exchange rate: 1 Gold Coin = 100,000 Zeny break; case 3: mes "How many Bronze Coins do you want to exchange?"; input .@bronze; if (countitem(672) < .@bronze) { mes "You don't have that many Bronze Coins."; close; } delitem 672, .@bronze; set zeny, zeny + (.@bronze * 10000); // Example exchange rate: 1 Bronze Coin = 10,000 Zeny break; case 4: mes "Alright, come back if you change your mind."; close; } mes "Thank you! Here is your Zeny."; close; }
  23. The script you provided is close to being functional, but there are some issues that need to be addressed to ensure it works correctly. Below is the corrected script with explanations for the changes: Here is the corrected script firstcity,229,87,4 script Salvage NPC 856,{ mes "[Salvage NPC]"; mes "Hello! I can salvage your old weapons and armor."; mes "In return, I'll give you a special item based on the weapon's level."; next; mes "[Salvage NPC]"; mes "Would you like to proceed?"; switch(select("Yes:No")) { case 1: callfunc("salvage_item"); break; case 2: mes "[Salvage NPC]"; mes "Alright, come back if you change your mind."; close; } close; } function script salvage_item { mes "[Salvage NPC]"; mes "Please show me the items you want to salvage."; next; // Fetch player's inventory getinventorylist; // Collect all weapons and armor in the player's inventory set .@item_count, 0; for (.@i = 0; .@i < @inventorylist_count; .@i++) { set .@type, getiteminfo(@inventorylist_id[.@i], ITEMINFO_TYPE); if ((.@type == IT_WEAPON || .@type == IT_ARMOR) && @inventorylist_equip[.@i] == 0) { // Type 4 = Weapon, Type 5 = Armor, and not equipped set .@salvageable_items[.@item_count], @inventorylist_id[.@i]; set .@salvageable_items_qty[.@item_count], @inventorylist_amount[.@i]; set .@item_count, .@item_count + 1; } } if (.@item_count == 0) { mes "[Salvage NPC]"; mes "You don't have any salvageable items."; close; } mes "[Salvage NPC]"; mes "Here is a summary of the items you can salvage:"; for (.@i = 0; .@i < .@item_count; .@i++) { mes "^0000FF" + getitemname(.@salvageable_items[.@i]) + "^000000 x" + .@salvageable_items_qty[.@i]; } next; if (select("Proceed with Salvage:Cancel") == 2) { mes "[Salvage NPC]"; mes "Alright, come back if you change your mind."; close; } // Call the shop callshop "salvage_shop", 1; npcshopattach "salvage_shop"; close; } // Shop definition with placeholder items (you need to fill this with the actual items you want to allow for salvage) - shop salvage_shop -1,501:10000,502:10000,503:10000,504:10000,505:10000,506:10000,507:10000,508:10000,509:10000,510:10000 OnSellItem: // Rewards based on weapon level setarray .@reward_common, 501, 502; // Example common loot item IDs setarray .@reward_rare, 503, 504; // Example rare loot item IDs setarray .@reward_unique, 505, 506; // Example unique loot item IDs setarray .@reward_legendary, 507, 508; // Example legendary loot item IDs setarray .@reward_ancient, 509, 510; // Example ancient loot item IDs set .@item_id, @sold_nameid; set .@weapon_level, getiteminfo(.@item_id, ITEMINFO_WEAPONLV); switch (.@weapon_level) { case 1: // Reward common item/points getitem .@reward_common[rand(getarraysize(.@reward_common))], 1; break; case 2: // Reward rare item/points getitem .@reward_rare[rand(getarraysize(.@reward_rare))], 1; break; case 3: // Reward unique item/points getitem .@reward_unique[rand(getarraysize(.@reward_unique))], 1; break; case 4: // Reward legendary item/points getitem .@reward_legendary[rand(getarraysize(.@reward_legendary))], 1; break; case 5: // Reward ancient item/points getitem .@reward_ancient[rand(getarraysize(.@reward_ancient))], 1; break; default: dispbottom "This item cannot be salvaged."; } dispbottom "Thank you! Here is your reward."; end; The OnSellItem label should be properly defined and hooked into the shop functionality. The shop definition needs to include the items that are eligible for sale. The getiteminfo function needs to fetch the correct item information. Some logic and flow improvements. Key Changes and Fixes: Item Info Fetching: Changed getiteminfo(.@item_id, ITEMINFO_WEAPONLEVEL) to getiteminfo(.@item_id, ITEMINFO_WEAPONLV) to correctly fetch the weapon level. Shop Definition: The salvage_shop now includes example items with prices. Adjust these item IDs and prices according to your server's item database. Shop Invocation: Adjusted callshop "salvage_shop", 1; to make sure the shop is called correctly. Reward Logic: getiteminfo uses ITEMINFO_WEAPONLV to fetch the weapon level correctly. Item Type Constants: Added constants IT_WEAPON and IT_ARMOR for better readability. Make sure the items you want to allow for salvage are included in the salvage_shop definition. Adjust the item IDs and the rewards as per your server's requirements. This should make the script functional and enable the salvage NPC to work correctly.
  24. Your script has the core logic to spawn a monster and handle its death, but there are some adjustments needed to ensure that the monster respawns correctly. Specifically, the issue seems to stem from not correctly transitioning from the monster's death event back to the initial spawning logic. Here is an improved version of your script with these adjustments: function script BossniaHP { .@monsterID = getarg(0,0); .@monsterName$ = getarg(1,""); .@amount = getarg(2,0); .@map$ = getarg(3,""); .@hp = getarg(4,0); OnInit: // Spawn the monster and store its ID $@Cheffenia_ID = bg_monster("BossniaHP::OnMyMobDead", .@map$, 192, 99, .@monsterName$, .@monsterID, .@amount); setunitdata $@Cheffenia_ID, UMOB_HP, .@hp; // Set the monster's HP end; OnMyMobDead: // Initiate the timer to respawn the monster after a delay initnpctimer; end; OnTimer500: // Stop the timer stopnpctimer; // Respawn the monster by calling the OnInit label donpcevent "BossniaHP::OnInit"; end; } Ensure the OnMyMobDead event properly respawns the monster. Correctly initialize the timer to control the respawning of the monster. Explanation: OnInit: This section is called to initially spawn the monster. It uses the bg_monster function to spawn the monster and stores its ID in the variable $@Cheffenia_ID. The setunitdata function sets the HP of the monster. OnMyMobDead: This section is called when the monster dies. The initnpctimer function starts the timer which will eventually trigger the OnTimer500 event. OnTimer500: This section is called when the timer started by OnMyMobDead reaches 500 milliseconds. The stopnpctimer function stops the timer. The donpcevent "BossniaHP::OnInit" function calls the OnInit label, which respawns the monster. Common Issues to Check: Ensure that the timer duration (500 milliseconds in this case) is appropriate for your needs. You can adjust this value if you need a different respawn delay. Verify that the monster ID and other parameters passed to the bg_monster function are correct and that the monster can be spawned without issues. Ensure there are no other script conflicts that might prevent the OnMyMobDead event from triggering. This should ensure that the monster respawns correctly after it is killed.
  1. Load more activity
×
×
  • Create New...