Change "setarray"

nyxfatalis

New member
Messages
64
Points
0
Hi,

Could someone edit this script?

trinity_in,166,143,2 script Armor Craftsman 58,{ disable_items; deletearray @inventorylist_id[0], getarraysize(@inventorylist_id); getinventorylist; mes "[Armor Craftsman]"; mes "I've been studying ways to improve armor to increase its real capacity."; next; mes "[Armor Craftsman]"; mes "Enchant is an amazing ability blowing a mysterious power hidden in a space of armor."; next; mes "[Armor Craftsman]"; mes "One minute, please, I will check your items."; for (set .@i,0; .@i <= @inventorylist_count; set .@i,.@i+1) { for (set .@j,0; .@j < getarraysize(.armaduras); set .@j,.@j+1) { if ((@inventorylist_id[.@i] > 0) && (.armaduras[.@j] > 0) && (@inventorylist_id[.@i] == .armaduras[.@j])) { if (countitem(@inventorylist_id[.@i]) >= 2) { next; mes "[Armor Craftsman]"; mes "I notice that you more of a (a) "+getitemname(@inventorylist_id[.@i])+" in your inventory."; next; mes "[Armor Craftsman]"; mes "For the spell to occur with total security, ie no risk of damaging your item ask you to carry only one of each armor type."; next; mes "[Armor Craftsman]"; mes "Well, remove these armor parts of your inventory and get back here with me!"; mes "I will await your return!"; close; } else { if (@inventorylist_attribute[.@i]) { next; mes "[Armor Craftsman]"; mes "I see that you have a broken armor ..."; mes "To perform this procedure, you must bring me the items in perfect condition, ok?"; close; } else { set .@k,.@k+1; set .@menu$, .@menu$+getitemname(@inventorylist_id[.@i])+(getiteminfo(@inventorylist_id[.@i],10) ? " [1]:":":"); set .@armadlista[.@k],@inventorylist_id[.@i]; set .@refine[.@k],@inventorylist_refine[.@i]; set .@carta[.@k],@inventorylist_card1[.@i]; set .@runa[.@k],@inventorylist_card4[.@i]; set .@j,getarraysize(.armaduras); } } } } sleep2 1; } next; mes "[Armor Craftsman]"; if (!.@k) { mes "Hmm? There is nothing to be enchanted!"; mes "Please come with only ONE device to enchant."; close; } else { mes "Choose one of the armors listed below so we can progressir with this enchantment."; next; set .@armadesc,select(.@menu$+"Nothing."); mes "[Armor Craftsman]"; if (.@armadesc > .@k) { mes "Please come back when you have some interest in enchant your armor."; close; } else { mes "I will now check if you have some rune to enchant your armor."; mes " "; mes "One minute, please."; set .@menu$,""; set .@j,0; for (set .@i,0; .@i < getarraysize(.runas); set .@i,.@i+1) { if (countitem(.runas[.@i])) { set .@j,.@j+1; set .@menu$, .@menu$+getitemname(.runas[.@i])+":"; set .@runalista[.@j],.runas[.@i]; } sleep2 1; } next; mes "[Armor Craftsman]"; if (!.@j) { mes "You must bring me some rune power to do the spell."; close; } else { mes "What kind of enchantment you want to this armor?"; next; set .@runaesc,select(.@menu$+"Nothing."); if (.@runaesc > .@j) { mes "[Armor Craftsman]"; mes "Please come back when you have some interest in enchanting your armor."; close; } else { mes "[Armor Craftsman]"; if (.@runa[.@armadesc]) mes "(a) "+getitemname(.@armadlista[.@armadesc])+" already has a charming "+getitemname(.@runa[.@armadesc])+", if you enchant this item with "+getitemname(.@runalista[.@runaesc])+" that consume and ancient enchantment will be missed."; else mes "This spell will cost A "+getitemname(.@runalista[.@runaesc])+"."; next; if(select("Hmm .. Let me think about it.: Go ahead.") == 1) { mes "[Armor Craftsman]"; mes "Well, I can not blame him. My cost is not of the lower, but I need to pay for my studies and efforts, right?"; mes "Have a nice day."; close; } else { mes "[Armor Craftsman]"; mes "So, an adventurer willing to increase its power, huh?"; mes "Well, let the enchantment"; pcblockmove getcharid(3),1; close2; delitem .@runalista[.@runaesc],1; delitem .@armadlista[.@armadesc],1; specialeffect 873; specialeffect 865; sleep2 6000; specialeffect 44; sleep2 1000; getitem2 .@armadlista[.@armadesc],1,1,.@refine[.@armadesc],0,.@carta[.@armadesc],0,0,.@runalista[.@runaesc]; pcblockmove getcharid(3),0; end; } } } } }OnInit: setarray .armaduras[0],20178,20181,2307,13450,2309,2314,2316,2321,2325,2327,2328,2330,2332,2334,2335,2341,2344,2346,2348,2350,2337,2386,2394,2395,2396,2311,2318,2319,2320,2308,2310,2315,2317,2322,2324,2326,2331,2333,2336,2342,2345,2347,2349,2351,2364,2365,2391,2374,2375,2376,2377,2378,2379,2380,2381,2382,2387,2388,2389,2390; setarray .runas[0],26000,26027,26037,26038,26039; end;}

Instead adding the armors on

setarray .armaduras[0]

the npc will detect if the item is armor [equipped on : 16]

Thanks in Advance.

Script: http://pastebin.com/Rq6B3By9

 
Let's see if I understood this correctly: You want us to drop the .armaduras array so that any equipped armor can be enchanted, and the only armors you can enchant are the current ones you have equipped, right?

In that case I think I can cut off some of the code for a matter of efficiency. For example if you check your equipped armor, there's no need of checking if it's broken. Just comment so that I make sure that's what you want and I'll start this.

 
Let's see if I understood this correctly: You want us to drop the .armaduras array so that any equipped armor can be enchanted, and the only armors you can enchant are the current ones you have equipped, right?

In that case I think I can cut off some of the code for a matter of efficiency. For example if you check your equipped armor, there's no need of checking if it's broken. Just comment so that I make sure that's what you want and I'll start this.
Yes i want to drop off the .armaduras array.

So, the npc will just detect if the equipped item is armor (whis is equipped on: 16)

no need to check if the armor is broken since broken items cannot be equipped.

Thanks,

 
Here it is. I haven't tested it but it seems I haven't made any mistakes. Try it out by yourself before using it on an actual server and tell me any problem it has, in case it does.

trinity_in,166,143,2 script Armor Craftsman 58,{ disable_items; mes "[Armor Craftsman]"; mes "I've been studying ways to improve armor to increase its real capacity."; next; mes "[Armor Craftsman]"; mes "Enchant is an amazing ability blowing a mysterious power hidden in a space of armor."; next; mes "[Armor Craftsman]"; mes "One minute, please, I will check your items."; next; if (!getequipisequiped(EQI_ARMOR)){ mes "[Armor Craftsman]"; mes "Hey, you don't have any equipped armor!"; mes "Come back when you've equipped the armor you want to be enchanted."; close; } set .@armadura, getequipid(EQI_ARMOR); set .@refine, getequiprefinerycnt(EQI_ARMOR); set .@carta, getequipcardid(EQI_ARMOR,0); set .@runa, getequipcardid(EQI_ARMOR,3); if (countitem(.@armadura) > 1){ mes "[Armor Craftsman]"; mes "Hey! you've more than armor of the kind you want to enchant!"; mes "Please, come back with only one of its kind so I don't mess enchanting the wrong one. He, he!"; close; } mes "[Armor Craftsman]"; mes "I will now check if you have some rune to enchant your armor."; mes " "; mes "One minute, please."; set .@menu$,""; set .@j,0; for (set .@i,0; .@i < getarraysize(.runas); set .@i,.@i+1) { if (countitem(.runas[.@i])) { set .@j,.@j+1; set .@menu$, .@menu$+getitemname(.runas[.@i])+":"; set .@runalista[.@j],.runas[.@i]; } sleep2 1; } next; mes "[Armor Craftsman]"; if (!.@j) { mes "You must bring me some rune power to do the spell."; close; } else { mes "What kind of enchantment you want to this armor?"; next; set .@runaesc,select(.@menu$+"Nothing."); if (.@runaesc > .@j) { mes "[Armor Craftsman]"; mes "Please come back when you have some interest in enchanting your armor."; close; } else { mes "[Armor Craftsman]"; if (.@runa) mes "(a) "+getequipname(EQI_ARMOR)+" already has a charming "+getitemname(.@runa)+", if you enchant this item with "+getitemname(.@runalista[.@runaesc])+" that consume and ancient enchantment will be missed."; else mes "This spell will cost A "+getitemname(.@runalista[.@runaesc])+"."; next; if(select("Hmm .. Let me think about it.: Go ahead.") == 1) { mes "[Armor Craftsman]"; mes "Well, I can not blame him. My cost is not of the lower, but I need to pay for my studies and efforts, right?"; mes "Have a nice day."; close; } else { mes "[Armor Craftsman]"; mes "So, an adventurer willing to increase its power, huh?"; mes "Well, let the enchantment"; pcblockmove getcharid(3),1; close2; delitem .@runalista[.@runaesc],1; unequip EQI_ARMOR; delitem .@armadura,1; specialeffect 873; specialeffect 865; sleep2 6000; specialeffect 44; sleep2 1000; getitem2 .@armadura,1,1,.@refine,0,.@carta,0,0,.@runalista[.@runaesc]; pcblockmove getcharid(3),0; end; } } } OnInit: setarray .runas[0],26000,26027,26037,26038,26039; end;}
Enjoy it!

 
Last edited by a moderator:
Here it is. I haven't tested it but it seems I haven't made any mistakes. Try it out by yourself before using it on an actual server and tell me any problem it has, in case it does.

trinity_in,166,143,2 script Armor Craftsman 58,{ disable_items; mes "[Armor Craftsman]"; mes "I've been studying ways to improve armor to increase its real capacity."; next; mes "[Armor Craftsman]"; mes "Enchant is an amazing ability blowing a mysterious power hidden in a space of armor."; next; mes "[Armor Craftsman]"; mes "One minute, please, I will check your items."; next; if (!getequipisequiped(EQI_ARMOR)){ mes "[Armor Craftsman]"; mes "Hey, you don't have any equipped armor!"; mes "Come back when you've equipped the armor you want to be enchanted."; close; } set .@armadura, getequipid(EQI_ARMOR); set .@refine, getequiprefinerycnt(EQI_ARMOR); set .@carta, getequipcardid(EQI_ARMOR,0); set .@runa, getequipcardid(EQI_ARMOR,3); if (countitem(.@armadura) > 1){ mes "[Armor Craftsman]"; mes "Hey! you've more than armor of the kind you want to enchant!"; mes "Please, come back with only one of its kind so I don't mess enchanting the wrong one. He, he!"; close; } mes "[Armor Craftsman]"; mes "I will now check if you have some rune to enchant your armor."; mes " "; mes "One minute, please."; set .@menu$,""; set .@j,0; for (set .@i,0; .@i < getarraysize(.runas); set .@i,.@i+1) { if (countitem(.runas[.@i])) { set .@j,.@j+1; set .@menu$, .@menu$+getitemname(.runas[.@i])+":"; set .@runalista[.@j],.runas[.@i]; } sleep2 1; } next; mes "[Armor Craftsman]"; if (!.@j) { mes "You must bring me some rune power to do the spell."; close; } else { mes "What kind of enchantment you want to this armor?"; next; set .@runaesc,select(.@menu$+"Nothing."); if (.@runaesc > .@j) { mes "[Armor Craftsman]"; mes "Please come back when you have some interest in enchanting your armor."; close; } else { mes "[Armor Craftsman]"; if (.@runa) mes "(a) "+getequipname(EQI_ARMOR)+" already has a charming "+getitemname(.@runa)+", if you enchant this item with "+getitemname(.@runalista[.@runaesc])+" that consume and ancient enchantment will be missed."; else mes "This spell will cost A "+getitemname(.@runalista[.@runaesc])+"."; next; if(select("Hmm .. Let me think about it.: Go ahead.") == 1) { mes "[Armor Craftsman]"; mes "Well, I can not blame him. My cost is not of the lower, but I need to pay for my studies and efforts, right?"; mes "Have a nice day."; close; } else { mes "[Armor Craftsman]"; mes "So, an adventurer willing to increase its power, huh?"; mes "Well, let the enchantment"; pcblockmove getcharid(3),1; close2; delitem .@runalista[.@runaesc],1; unequip EQI_ARMOR; delitem .@armadura; specialeffect 873; specialeffect 865; sleep2 6000; specialeffect 44; sleep2 1000; getitem2 .@armadura,1,1,.@refine,0,.@carta,0,0,.@runalista[.@runaesc]; pcblockmove getcharid(3),0; end; } } } OnInit: setarray .runas[0],26000,26027,26037,26038,26039; end;}
Enjoy it!
error on map server .sir

cannot click the npc

*   76 :                                delitem .@armadura';'

 
I've edited the reply in which I show you the main NPC.

Please tell me when you test it any bug you find, but there shouldn't be any (that one was provoked because I was in a hurry) or if it works OK.

 
Last edited by a moderator:
Back
Top