Gouki Posted May 21, 2022 Group: Members Topic Count: 88 Topics Per Day: 0.05 Content Count: 261 Reputation: 13 Joined: 08/12/20 Last Seen: November 21, 2024 Share Posted May 21, 2022 Hi I've been working on this NPC, and I find it promising and handy for a loot converter, I tried modifying the script to accept but failed. Can anyone help me modify this script to accept Misc or Consumable items instead of only just Weapon and Armor? // https://irowiki.org/wiki/Ben_Recycle - shop ben_recycle_shop -1,909:-1 payon,111,117,4 script Ben Recycler 2_M_OLDBLSMITH,{ function func_GetItemName; function func_AddItem; mes "[Equipment Recycler]"; mes "Hi, I can convert certain equipment into ores."; mes "Would you give it a try?"; next; if (select("Convert", "Information") == 2) { for (.@i = 0; .@i < .size; .@i++) { mes func_GetItemName(.nameid[.@i]); if (.amount1[.@i] > 0 && .nameid1[.@i] > 0) mes " ~ "+F_InsertComma(.amount1[.@i])+"x "+func_GetItemName(.nameid1[.@i]); if (.amount2[.@i] > 0 && .nameid2[.@i] > 0) mes " ~ "+F_InsertComma(.amount2[.@i])+"x "+func_GetItemName(.nameid2[.@i]); mes " "; } next; } if (.shop_npc$ != "") { mes "[Equipment Recycler]"; mes "Place all the equipments you wish to convert into ores."; close2; npcshopattach .shop_npc$, 1; callshop .shop_npc$, 2; end; } else { for (.@i = 0; .@i < .size; .@i++) .@menu$ = .@menu$ + func_GetItemName(.nameid[.@i]) + ":"; .@i = select(.@menu$) - 1; if (countitem(.nameid[.@i])) { delitem .nameid[.@i], 1; mes "[Equipment Recycler]"; mes "Exchanged "+func_GetItemName(.nameid[.@i])+":"; if (.nameid1[.@i] > 0 && .amount1[.@i] > 0) { mes " ~ "+F_InsertComma(.amount1[.@i])+"x "+func_GetItemName(.nameid1[.@i]); getitem .nameid1[.@i], .amount1[.@i]; } if (.nameid2[.@i] > 0 && .amount2[.@i] > 0) { mes " ~ "+F_InsertComma(.amount2[.@i])+"x "+func_GetItemName(.nameid2[.@i]); getitem .nameid2[.@i], .amount2[.@i]; } } else { mes "[Equipment Recycler]"; mes "you dont have "+func_GetItemName(.nameid[.@i]); } } close; OnSellItem: .@sold_nameid_size = getarraysize(@sold_nameid); for (.@i = 0; .@i < .@sold_nameid_size && !.@fail; .@i++) { for (.@x = 0; .@x < .size && !.@fail; .@x++) { if (.nameid[.@x] == @sold_nameid[.@i]) { if (!checkweight(.nameid1[.@x], .amount1[.@x])) { mes "Exchange stopped, you're overweight."; .@fail++; } else { .@total++; delitem2(@sold_nameid[.@i], @sold_quantity[.@i], @sold_identify[.@i], @sold_refine[.@i], @sold_attribute[.@i], @sold_card1[.@i], @sold_card2[.@i], @sold_card3[.@i], @sold_card4[.@i]); mes "Exchanged "+func_GetItemName(.nameid[.@x])+":"; if (.nameid1[.@x] > 0 && .amount1[.@x] > 0) { mes " ~ "+F_InsertComma(.amount1[.@x])+"x "+func_GetItemName(.nameid1[.@x]); getitem .nameid1[.@x], .amount1[.@x]; } if (.nameid2[.@x] > 0 && .amount2[.@x] > 0) { mes " ~ "+F_InsertComma(.amount2[.@x])+"x "+func_GetItemName(.nameid2[.@x]); getitem .nameid2[.@x], .amount2[.@x]; } mes " "; } } } if (.@i && .@i % 10 == 0) sleep2 1; } mes "Exchanged "+.@total+" item(s)."; close2; npcshopattach .shop_npc$, 0; end; function func_GetItemName { .@itemid = getarg(0, 0); .@itemslot = getitemslots(.@itemid); .@item_name$ = getitemname(.@itemid); .@itemtype = getiteminfo(.@itemid, 2); if (.@itemslot || .@itemtype == IT_WEAPON || .@itemtype == IT_ARMOR) .@item_name$ = .@item_name$ + " ["+.@itemslot+"]"; return .@item_name$; } function func_AddItem { .@nameid = getarg(0, 0); .@nameid1 = getarg(1, 0); .@amount1 = getarg(2, 0); //.@nameid2 = getarg(3, 0); //.@amount2 = getarg(4, 0); if (.@nameid > 0 && .@nameid1 > 0 && .@amount1 > 0 //&& .@nameid2 > 0 && .@amount2 > 0 ) { .nameid[.size] = .@nameid; .nameid1[.size] = .@nameid1; .amount1[.size] = .@amount1; //.nameid2[.size] = .@nameid2; //.amount2[.size] = .@amount2; .size++; } } OnInit: // if enable shop UI (only work if items can sell to npc shop) .shop_npc$ = "ben_recycle_shop"; // func_AddItem(<equipment_id>, <item1>, <amount1>, <item2>, <amount2>); // WEAPONS func_AddItem(1116, 40903, 3); //func_AddItem(1158, 984, 3, 757, 2); //func_AddItem(1553, 984, 2, 757, 3); // ARMORS //func_AddItem(2313, 985, 2, 757, 2); //func_AddItem(2326, 985, 3, 757, 3); end; } Quote Link to comment Share on other sites More sharing options...
0 mR L Posted May 22, 2022 Group: Members Topic Count: 10 Topics Per Day: 0.00 Content Count: 177 Reputation: 26 Joined: 12/24/14 Last Seen: December 25, 2024 Share Posted May 22, 2022 you can setting at this On 5/21/2022 at 3:57 PM, Almond Snicker said: OnInit: // if enable shop UI (only work if items can sell to npc shop) .shop_npc$ = "ben_recycle_shop"; // func_AddItem(<equipment_id>, <item1>, <amount1>, <item2>, <amount2>); // WEAPONS func_AddItem(1116, 40903, 3); //func_AddItem(1158, 984, 3, 757, 2); //func_AddItem(1553, 984, 2, 757, 3); // ARMORS //func_AddItem(2313, 985, 2, 757, 2); //func_AddItem(2326, 985, 3, 757, 3); end; if you want add misc or consumable item just add this // ETC func_AddItem(7444, 969, 3); Quote Link to comment Share on other sites More sharing options...
0 Gouki Posted May 23, 2022 Group: Members Topic Count: 88 Topics Per Day: 0.05 Content Count: 261 Reputation: 13 Joined: 08/12/20 Last Seen: November 21, 2024 Author Share Posted May 23, 2022 On 5/22/2022 at 9:26 PM, mR L said: you can setting at this if you want add misc or consumable item just add this // ETC func_AddItem(7444, 969, 3); Yup, tried this already, unfortunately the script doesn't recognize it. Quote Link to comment Share on other sites More sharing options...
Question
Gouki
Hi I've been working on this NPC, and I find it promising and handy for a loot converter, I tried modifying the script to accept but failed.
Can anyone help me modify this script to accept Misc or Consumable items instead of only just Weapon and Armor?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.