The script currently works fine, however i'm hoping to get an opinion whether if the script below can be improved or better answer my query which is whether is it possible to join 2 variables into 1 ?
Here's the NPC that i've made so far.
mes "Select Equipment to Craft.";for(.@i=1;.@i< getarraysize(.itemID);.@i++).@menu$=.@menu$+"~ "+ getitemname(.itemID[.@i])+":";switch(select(.@menu$)){case1:.@n=1;
mes "Item Preview: <ITEM>"+getitemname(.itemID[.@n])+"<INFO>"+.itemID[.@n]+"</INFO></ITEM>";
mes "====================";for(.@i=0;.@i< getarraysize(.reqItemID1);.@i++){
mes "^FF0000"+countitem(.reqItemID1[.@i])+"^000000 / "+.reqItemQty1[.@i]+" ~ "+getitemname(.reqItemID1[.@i]);}
mes "^FF0000"+callfunc("F_InsertComma",Zeny)+" / "+callfunc("F_InsertComma",.Zeny[.@n])+" Zeny";
next;
mes "Do you wish to continue?";switch(select("Let me think about it: Yes, create item.")){case1:
mes "Come back anytime";
close;case2:if(Zeny<=.Zeny[.@n]){ mes "You have insufficient Zeny!"; close;}for(.@i=0;.@i< getarraysize(.reqItemID1);.@i++){if(countitem(.reqItemID1[.@i])<.reqItemQty1[.@i]){
mes "You have insufficient items";
close;}}for(.@i=0;.@i< getarraysize(.reqItemID1);.@i++){
delitem .reqItemID1[.@i],.reqItemQty1[.@i];}Zeny-=.Zeny[.@n];
getitem .itemID[.@n],1;
mes "Here you go!";
close;}// mini case endcase2:.@n=2;
mes "Item Preview: <ITEM>"+getitemname(.itemID[.@n])+"<INFO>"+.itemID[.@n]+"</INFO></ITEM>";
mes "====================";for(.@i=0;.@i< getarraysize(.reqItemID2);.@i++){
mes "^FF0000"+countitem(.reqItemID2[.@i])+"^000000 / "+.reqItemQty2[.@i]+" ~ "+getitemname(.reqItemID2[.@i]);}
mes "^FF0000"+callfunc("F_InsertComma",Zeny)+" / "+callfunc("F_InsertComma",.Zeny[.@n])+" Zeny";
next;
mes "Do you wish to continue?";switch(select("Let me think about it: Yes, create item.")){case1:
mes "Come back anytime";
close;case2:if(Zeny<=.Zeny[.@n]){mes "You have insufficient Zeny!";close;}for(.@i=0;.@i< getarraysize(.reqItemID2);.@i++){if(countitem(.reqItemID2[.@i])<.reqItemQty2[.@i]){
mes "You have insufficient items";
close;}}for(.@i=0;.@i< getarraysize(.reqItemID2);.@i++){
delitem .reqItemID2[.@i],.reqItemQty2[.@i];}Zeny-=.Zeny[.@n];
getitem .itemID[.@n],1;
mes "Here you go!";
close;}OnInit:
setarray .itemID,0,2589,18600;
setarray .Zeny,0,50000000,20000000;//item requirement for each items //Fallen Angel Wing
setarray .reqItemID1,2573,7441,916,949,1039,7063,7511,983,982;
setarray .reqItemQty1,1,300,300,300,300,100,50,20,20;//Cat Ear Beret
setarray .reqItemID2,5172,714,5057,919,7161,1059,983;
setarray .reqItemQty2,1,1,1,100,200,200,5;
end;}
currently i copy and paste case 1 and case 2 and only changing the .@n variable. If i can add the use .reqitemID + .@n together then i'd be able to save much more on this one.
Would appreciate on your feedback, thanks!
P.S., the itemID being 0 for the first array is kinda because i wanna align the case with the .@n >_>
Question
ToiletMaster
Hi guys,
The script currently works fine, however i'm hoping to get an opinion whether if the script below can be improved or better answer my query which is whether is it possible to join 2 variables into 1 ?
Here's the NPC that i've made so far.
currently i copy and paste case 1 and case 2 and only changing the .@n variable. If i can add the use .reqitemID + .@n together then i'd be able to save much more on this one.
Would appreciate on your feedback, thanks!
P.S., the itemID being 0 for the first array is kinda because i wanna align the case with the .@n >_>
Edited by ToiletMasterLink to comment
Share on other sites
8 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.