Jump to content
  • 0

Dynamic Shop --> Please Help me to find the error code T_T


Question

Posted

- shop President_shop -1,501:50
quiz_02,307,251,4 script President 965,{
	    set @i,0;
	    mes "[ President ]";
	    mes "Which item do you wish to obtain?";
	    mes "Select only one.";
	    callshop "President_shop",1;
	    npcshopattach "President_shop";
	    end;

OnBuyItem:
	    if(.BuildQuest) {
			    for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
			    npcshopadditem "President_shop",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 "[ President ]";
	    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 "President_shop",0,0;
	    set .BuildQuest,1;
	    set .i,1;
Quest_Setup:
	    switch(.i) {
 default: set .BuildQuest,0; set .e,0; set .i,0; end;
  case 1: callsub OnBuyItem,5083,1,2244,5,5091,2,975,10,976,10,7166,350,0,"SZeny",5382,1,"announce";
  case 2: callsub OnBuyItem,7441,600,978,20,916,1000,7226,20,4031,10,0,"SZeny",5405,1,"announce";
  case 3: callsub OnBuyItem,2214,2,5045,1,975,1,7038,400,949,1000,7213,500,0,"SZeny",5378,1,"announce";
  case 4: callsub OnBuyItem,5016,1,7108,30,7437,2,983,10,0,"SZeny",5184,1,"announce";
  case 5: callsub OnBuyItem,1039,1000,7023,1000,0,"SZeny",5254,1,"announce";
  case 6: callsub OnBuyItem,5048,4,5012,1,7169,100,0,"SZeny",5364,1,"announce";
  case 7: callsub OnBuyItem,5172,1,7301,666,979,20,980,10,982,5,0,"SZeny",5383,1,"announce";
  case 8: callsub OnBuyItem,982,10,1059,1000,7038,100,0,"SZeny",5322,1,"announce";
  case 9: callsub OnBuyItem,2254,1,7038,777,7063,500,0,"SZeny",5324,1,"announce";
  case 10: callsub OnBuyItem,949,1500,7063,500,6020,50,4006,10,982,10,0,"SZeny",5527,1,"announce";
  case 11: callsub OnBuyItem,7031,999,574,500,4074,10,7480,10,0,"SZeny",5365,1,"announce";
  case 12: callsub OnBuyItem,5057,1,5118,1,12211,500,2215,30,0,"SZeny",5387,1,"announce";
  case 13: callsub OnBuyItem,10016,10,5052,1,2220,1,7754,3,6020,500,7038,300,982,20,0,"SZeny",5468,1,"announce";
  case 14: callsub OnBuyItem,5036,1,7192,1000,975,20,0,"SZeny",5458,1,"announce";
  case 15: callsub OnBuyItem,741,33,909,456,7126,678,0,"SZeny",5255,1,"announce";
  case 16: callsub OnBuyItem,5065,1,1053,300,978,10,6022,60,0,"SZeny",5508,1,"announce";
  case 17: callsub OnBuyItem,5035,1,741,200,0,"SZeny",5335,1,"announce";
  case 18: callsub OnBuyItem,5045,10,5052,1,7217,500,919,1000,0,"SZeny",5359,1,"announce";
  case 19: callsub OnBuyItem,5058,1,703,1000,710,1000,7481,10,0,"SZeny",5289,1,"announce";
  case 20: callsub OnBuyItem,5016,1,975,30,4040,300,7063,500,0,"SZeny",5466,1,"announce";
  case 21: callsub OnBuyItem,976,20,7024,200,7166,700,0,"SZeny",5277,1,"announce";
  case 22: callsub OnBuyItem,753,1000,7011,200,0,"SZeny",5385,1,"announce";
  case 23: callsub OnBuyItem,2288,1,7187,1,949,500,982,5,0,"SZeny",5143,1,"announce";
  case 24: callsub OnBuyItem,5058,1,2214,1,7063,500,12045,10,0,"SZeny",5198,1,"announce";
  case 25: callsub OnBuyItem,5035,1,918,1,908,500,7155,979,20,0,"SZeny",5447,1,"announce";
  case 26: callsub OnBuyItem,2253,1,5048,1,5041,1,5077,1,5061,1,0,"SZeny",5103,1,"announce";
  case 27: callsub OnBuyItem,5035,1,7063,10,979,30,511,300,0,"SZeny",5352,1,"announce";
  case 28: callsub OnBuyItem,4218,1,5076,1,7570,100,0,"SZeny",5133,1,"announce";
  case 29: callsub OnBuyItem,7065,1000,720,100,950,300,7038,400,7562,3,978,10,0,"SZeny",5556,1,"announce";
  case 30: callsub OnBuyItem,5011,1,7069,1000,7507,500,7352,20,7353,20,7354,20,7355,20,0,"SZeny",5212,1,"announce";
  case 31: callsub OnBuyItem,7100,500,7198,500,7194,500,7186,50,0,"SZeny",5511,1,"announce";
  case 32: callsub OnBuyItem,2280,1,930,1000,7442,100,7207,300,983,5,0,"SZeny",5579,1,"announce";
  case 33: callsub OnBuyItem,5042,1,7095,200,7202,1000,960,1000,14557,5,0,"SZeny",5473,1,"announce";		
    }
}

Anyone help me...this script can't show the required item but..the the item can be load in my npc...

ex :

if i Buy item 5473 (nipper crab hairpin)

case 33: callsub OnBuyItem,5042,1,7095,200,7202,1000,960,1000,14557,5,0,"SZeny",5473,1,"announce"; -->NPC Can't show what i must collect to get nipper crab hairpin..

anyone can you help me..T_T

last week i make 6 NPC like this ,Success ! but now ,i wanna make one more NPC like that --> my script can't be load T_T please help me..

3 answers to this question

Recommended Posts

Posted

Where is the shop this calls?

callshop "President_shop",1;

npcshopattach "President_shop";

We can't tell you what's wrong without first seeing that shop.

Posted

Where is the shop this calls?

callshop "President_shop",1;

npcshopattach "President_shop";

We can't tell you what's wrong without first seeing that shop.

shop call at quiz_02,307,251,4 but the method call at

OnInit:

npcshopitem "President_shop",0,0;

set .BuildQuest,1;

set .i,1;

did you use @reloadscript? you need to restart the server i guess.

i try to type @reloadscript.. my npc spawn at the position but, after i choose an item, the required item can't be shown to me...i still confuse about that

FINNALY i know my problem hahahahaha....

if i create 10 item in my npc..the npc can show what i required but, i create 20++ item in one npc...my npc can't work Normally thanks all...:(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...