Jump to content
  • 0
Sign in to follow this  
nyxfatalis

Item Exchange

Question

Hi hercules,

 

Can Someone make me 

An NPC That will change ( with menu )

100 TCG to 10 PODS

100 TCG to 20 Convex Mirror

100 TCG to 15 Jellopy.

 

NPC message will be :

 

Hi there, i can trade your 100 TCG's to 10 PODS or 20 Convex Mirror or 15 Jellopy.

Pick what you want.

 

 

menu : 10 PODS , 20 Convex Mirror , 15 Jellopy.

 

 

THANKS IN ADVANCE. ^^~!

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

 

prontera,150,150,0	script	Exchanger	100,{	mes .npc$;	mes "Hi there, i can trade your 100 TCG's to 10 PODS or 20 Convex Mirror or 15 Jellopy.";	next;		switch(select(.choice$)) {		case 1:			if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 7179,10;			break;		case 2:			if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 12214,20;			break;		case 3:			 if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 909,15;			break;		default: break;	}		OnInit:		.npc$ = "[ " +strnpcinfo(1)+ " ]";		.choice$ = "10 PODS:20 Convex Mirror:15 Jellopy";		end;}

 

Err...this line will cause the player to freeze if the expression is false:

if ( countitem(7227) < 100 ) end;

 

Additionally, the check can be placed before the switch; since it's checked every time anyways, it would be pointless to repeat the check.

 

 

 

Here's my method:

prontera,150,150,5    script    Exchanger    100,{        // Dialogue I    mes .name$;    mes "Hi there, I can exchange "+ .voucher_amt +" of your "+ getitemname(.voucher_id) +" for several different rewards.";    next;        // Choose item to exchange    menu .option$, -;        // Dialogue II    mes .name$;            // Check required voucher amount    if (countitem(.voucher_id) < .voucher_amt)    {        mes "Sorry, but you do not have enough "+ getitemname(.voucher_id) +" to complete this transaction.";        close;    }        // Delete required item    delitem .voucher_id, .voucher_amt;        // Get reward    .@i = @menu - 1;    getitem .item_id[.@i], .amount[.@i];        // Dialogue III    mes "Thank you! Enjoy your "+ .amount[.@i] +" "+ getitemname(.item_id[.@i]) +"!";    close;   	 OnInit:        // NPC name	    .name$ = "["+ strnpcinfo(1) +"]";                // Voucher ID and amount        .voucher_id = 7227;        .voucher_amt = 100;                // Item IDs and corresponding amounts        setarray .item_id[0],    7179,    12214,    909;        setarray .amount[0],      10,       20,     15;                // Fill secondary menu items        for (.@i = 1; .@i < getarraysize(.item_id); .@i++)            .option$ = .option$ +":"+ .amount[.@i] +" "+ getitemname(.item_id[.@i]);                // Add menu items to primary option	    .option$ = .amount[0] +" "+ getitemname(.item_id[0]) + .option$;            end;}

Share this post


Link to post
Share on other sites
  • 0
prontera,150,150,0	script	Exchanger	100,{	mes .npc$;	mes "Hi there, i can trade your 100 TCG's to 10 PODS or 20 Convex Mirror or 15 Jellopy.";	next;		switch(select(.choice$)) {		case 1:			if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 7179,10;			break;		case 2:			if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 12214,20;			break;		case 3:			 if ( countitem(7227) < 100 ) end;			delitem 7227,100;			getitem 909,15;			break;		default: break;	}		OnInit:		.npc$ = "[ " +strnpcinfo(1)+ " ]";		.choice$ = "10 PODS:20 Convex Mirror:15 Jellopy";		end;}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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