Jump to content
  • 0
konzen002

Edited Cointrader Problem

Question

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
 
 

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;}
Edited by Mumbles
Codeboxed content.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

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 =.

Share this post


Link to post
Share on other sites
  • 0

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

 

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;}
Edited by ossi0110

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.