Edited Cointrader Problem

konzen002

New member
Messages
13
Points
0
Need help in my Coin Trader NPC. even if I dont have the necessary required items in trading for Gold Coins to Cash Points it still gives mithril coins.
here's my script
 
 

Code:
turbo_room,103,114,3	script	Trader	874,{		mes "[Coin Trader]";	mes "Hello "+StrCharInfo(0)+"!";	mes "What would you like to do?";menu	"Gold Coin to Cash Points",goldcoin, "Mithrill Coin to Zeny",coin, "Zeny to Mithril Coin",mithril; goldcoin:		if(countitem(671) >= 1)		{			delitem 671,1;						next;			mes "[Sample]";			mes "Here is your item!";			atcommand "@cash 5";			close;		}coin:		if(countitem(674) >= 1)		{			delitem 674,1;						next;			mes "[Sample]";			mes "Here is your money!";			set Zeny,Zeny + 1000000000;			close;		}mithril:		if(zenny = 1000000000)		{			getitem 674,1;						next;			mes "[Sample]";			mes "Here is your Mithril Coin!";			set Zeny,Zeny - 1000000000;			close;		}		next;	mes "[Coin Trader]";	mes "Sorry but you don't have the requirements to continue.";	close;	OnInit:	waitingroom "Coin Trader",0;}
 
Last edited by a moderator:
The problem lies in the check made for Zeny:

        if(zenny = 1000000000)        {            getitem 674,1;                      next;            mes "[Sample]";            mes "Here is your Mithril Coin!";            set Zeny,Zeny - 1000000000;            close;        }

The proper method would be to compare the character variable, Zeny:

if(Zeny >= 1000000000) { getitem 674,1; next; mes "[Sample]"; mes "Here is your Mithril Coin!"; set Zeny,Zeny - 1000000000; close; }

The previous method incorrectly "checks" the character variable, zenny; additionally, a == or >= should be used to compare both sides of this expression, not =.

 
Last edited by a moderator:
thanks alot! 
default_laugh.png


 
still having problems even if I dont have enough zeny it still gives mithril coins 
be sure that your Lables working with end;  or he will jump to the next one

mithril: if(Zeny >= 1000000000) { getitem 674,1; next; mes "[Sample]"; mes "Here is your Mithril Coin!"; set Zeny,Zeny - 1000000000; close; } end;


edit:

changed a few party of the script , now it works like you want

Code:
turbo_room,103,114,3	script	Trader	874,{        mes "[Coin Trader]";    mes "Hello"+StrCharInfo(0)+"!";    mes "What would you like to do?";	menu    "Gold Coin to Cash Points",goldcoin, "Mithrill Coin to Zeny",coin, "Zeny to Mithril Coin",mithril; goldcoin:        if(countitem(671) >= 1)        {            delitem 671,1;                        next;            mes "[Sample]";            mes "Here is your item!";            atcommand "@cash 5";            close;         } else { next; mes "[Coin Trader]"; mes "Sorry but you don't have the requirements to continue."; close; }	end;coin:        if(countitem(674) >= 1)        {            delitem 674,1;                        next;            mes "[Sample]";            mes "Here is your money!";            set Zeny,Zeny + 1000000000;            close;        } else { next;  mes "[Coin Trader]"; mes "Sorry but you don't have the requirements to continue."; close; }	end;mithril:         if(Zeny >= 1000000000)        {            getitem 674,1;            next;            mes "[Sample]";            mes "Here is your Mithril Coin!";            set Zeny,Zeny - 1000000000;            close;        } else { next;  mes "[Coin Trader]"; mes "Sorry but you don't have the requirements to continue."; close; }	end;    OnInit:waitingroom "Coin Trader",0;}
 
Last edited by a moderator:
Back
Top