freehit21 Posted April 18, 2014 Posted April 18, 2014 can you help me please.. does anyone know how to do this script a NPC that sells a TCG card in exchange of items here's an example. TCG = price syntax "itemID1" or "itemID2" or "itemID3" or "itemID4" Quote
EL Dragon Posted April 18, 2014 Posted April 18, 2014 quiz_02,45,386,4 script TCG 108,{ set @i,0; mes "[TGC Echanger]"; mes "------ INFO -----"; mes "TCG to ITEM's Shop!!"; callshop "quest_shop8",1; npcshopattach "quest_shop8"; end; OnBuyItem: if(.BuildQuest8) { for(set .e,0; !compare(getarg(.e+1)+"", "Zeny"); set .e,.e+2) {} npcshopadditem "quest_shop8",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"SZeny"); setarray .Shop[.i],getarg(.e+2); set .i,.i+1; goto Quest_Setup; } if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; } for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; } mes "[Shop Quest NPC]"; mes "I require the following:"; for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]"; if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny"; mes "^000000In exchange, I will give you:^0000FF"; for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i)); switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) { case 1: for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) { next; mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + "."; mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000."; close; } if(Zeny < getarg(@i)) { next; mes "You do not have enough Zeny."; mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000."; close; } for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1); set Zeny,Zeny-getarg(@i); for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1); if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all; close; case 2: set @bottomview, getlook(3); set @topview, getlook(4); set @midview, getlook(5); addtimer 1000, strnpcinfo(3)+"::On_Leave"; set @equip,getiteminfo(@bought_nameid, 5); set @view, getiteminfo(@bought_nameid, 11); if(@equip != -1 && @view > 0) { if(@equip & 1) atcommand "@changelook 3 " + @view; if(@equip & 256) atcommand "@changelook 1 " + @view; if(@equip & 512) atcommand "@changelook 2 " + @view; } next; goto OnBuyItem; case 3: close; } On_Leave: atcommand "@changelook 1 " + @topview; atcommand "@changelook 2 " + @midview; atcommand "@changelook 3 " + @bottomview; set @equip,0; set @view,0; set @topview,0; set @midview,0; set @bottomview,0; end; OnInit: npcshopitem "quest_shop8",0,0; waitingroom "Kill MvPs and Drop TCG Cards",0; set .BuildQuest8,1; set .i,1; Quest_Setup: // THEESE ARE JUST A FEW EXAMPLES;WHICH I MADE,YOU HAVE TO PUT IN YOUR OWN ITEM ID'S HERE! switch(.i) { default: set .BuildQuest8,0; set .e,0; set .i,0; end; case 1: callsub OnBuyItem,7227,1000,1000000,"SZeny",13036,1,"announce"; case 2: callsub OnBuyItem,7227,1000,1000000,"SZeny",13411,1,"announce"; case 3: callsub OnBuyItem,7227,1000,1000000,"SZeny",1183,1,"announce"; case 4: callsub OnBuyItem,7227,1000,1000000,"SZeny",1632,1,"announce"; case 5: callsub OnBuyItem,7227,1000,1000000,"SZeny",1634,1,"announce"; case 6: callsub OnBuyItem,7227,1000,1000000,"SZeny",1543,1,"announce"; case 7: callsub OnBuyItem,7227,1000,1000000,"SZeny",1380,1,"announce"; case 8: callsub OnBuyItem,7227,1000,1000000,"SZeny",13305,1,"announce"; case 9: callsub OnBuyItem,7227,1000,1000000,"SZeny",1279,1,"announce"; case 10: callsub OnBuyItem,7227,1000,1000000,"SZeny",1924,1,"announce"; case 11: callsub OnBuyItem,7227,1000,1000000,"SZeny",1978,1,"announce"; case 12: callsub OnBuyItem,7227,1000,1000000,"SZeny",1574,1,"announce"; case 13: callsub OnBuyItem,7227,1000,1000000,"SZeny",1824,1,"announce"; case 14: callsub OnBuyItem,7227,1000,1000000,"SZeny",13108,1,"announce"; case 15: callsub OnBuyItem,7227,1000,1000000,"SZeny",2772,1,"announce"; case 16: callsub OnBuyItem,7227,50,1000000,"SZeny",5378,1,"announce"; case 17: callsub OnBuyItem,7227,50,1000000,"SZeny",5380,1,"announce"; case 18: callsub OnBuyItem,7227,50,1000000,"SZeny",5334,1,"announce"; case 19: callsub OnBuyItem,7227,50,1000000,"SZeny",5361,1,"announce"; case 20: callsub OnBuyItem,7227,50,1000000,"SZeny",5374,1,"announce"; case 21: callsub OnBuyItem,7227,50,1000000,"SZeny",5319,1,"announce"; case 22: callsub OnBuyItem,7227,50,1000000,"SZeny",5383,1,"announce"; case 23: callsub OnBuyItem,7227,50,1000000,"SZeny",5497,1,"announce"; case 24: callsub OnBuyItem,7227,50,1000000,"SZeny",5372,1,"announce"; case 25: callsub OnBuyItem,7227,50,1000000,"SZeny",5690,1,"announce"; } } Quote
PHiLiP Posted May 5, 2014 Posted May 5, 2014 Like this? //Script Author: PHiLiP prontera,155,181,5 script Item to TCG 763,{ //<Payment> set .pay,7227; //<item id>,<tcg repayment> setarray .item,5022,100,5032,200; for(set .@i,0; .@i<getarraysize(.item); set .@i,.@i+2){ set .item_name$[.@i],getitemname(.item[.@i]); set .item_id[.@i],.item[.@i]; set .amount[.@i],.item[.@i+1]; } mes "Exchange what?"; .@item = select( implode( .item_name$,":" ) ) - 1; mes "Amount: " +.amount[.@item]+ " " +getitemname(.pay); if(select("Proceed:Close")==2){close;} if(countitem(.item_id[.@item])<1){ mes "Error!"; close; } delitem .item_id[.@item],1; getitem .pay,.amount[.@item]; close; } Quote
freehit21 Posted May 6, 2014 Author Posted May 6, 2014 something like that sir but its too many item to add.. i just want to exchange it to like this 1 "option" = TCG in "option" the syntax is like this "id01","id02","id03", and so on and so fort.......... like this in format "you want to exchange back your item to TCG" "yes" or "no" if yes the item will be exchange back to TCG.. if no the quest will exit.. thanks sir i hope you understand my noob english. Quote
Kido Posted May 10, 2014 Posted May 10, 2014 why dont you try euphy quest shop? http://rathena.org/board/topic/64394-%E2%9C%B0-euphys-scripts-%E2%9C%B0/ well for the part of inveting the items to TCG let me know o: Quote
freehit21 Posted May 11, 2014 Author Posted May 11, 2014 Like this? //Script Author: PHiLiP prontera,155,181,5 script Item to TCG 763,{ //<Payment> set .pay,7227; //<item id>,<tcg repayment> setarray .item,5022,100,5032,200; for(set .@i,0; .@i<getarraysize(.item); set .@i,.@i+2){ set .item_name$[.@i],getitemname(.item[.@i]); set .item_id[.@i],.item[.@i]; set .amount[.@i],.item[.@i+1]; } mes "Exchange what?"; .@item = select( implode( .item_name$,":" ) ) - 1; mes "Amount: " +.amount[.@item]+ " " +getitemname(.pay); if(select("Proceed:Close")==2){close;} if(countitem(.item_id[.@item])<1){ mes "Error!"; close; } delitem .item_id[.@item],1; getitem .pay,.amount[.@item]; close; } ^ this one is good but if you talk into npc. all of the items that in the item array will be gone automatically even it has cards.. i am requesting this npc to do this more specifically like exchanging items into tcg but in exchange i will choose what item in my inventory in it.. well here sir. it should be like this.. the item should be set for this set "@ID01","@ID02","@ID03" so on and so fort = "ID01","ID02","ID03","ID04" so on and so fort... set pay 7227... in npc i will choose my items at my inventory on what item should be choose in exchange on tcg. Quote
Question
freehit21
10 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.