Jump to content
  • 0
Sign in to follow this  
ThyroDree

Request: NPC Exchanger item to Item

Question

2 answers to this question

Recommended Posts

  • 0

Post error if any :

prontera,150,150,0	script	Sample	100,{	setarray .choices[0],7229,7228,7757;	.size = getarraysize(.choices);	for ( .@i = 0; .@i < .size; .@i++ ) {		.@menu$ += getitemname(.choices[.@i]);		.@menu$ += ":";	}	.@selected = select(.@menu$) - 1;	.npc$ = "["+strnpcinfo(1)+"]";	mes .npc$;	mes "Exchange Rates : ";	mes "1x " +getitemname(.choices[.@selected]);	if ( !.@selected ) {		setarray .req[0],15,7232;		mes .req[0]+ "x " +getitemname(.req[1]);	} else if ( .@selected == 1 ) {		setarray .req[0],10,7231;		mes .req[0]+ "x " +getitemname(.req[1]);	} else {		setarray .req[0],5,7233;		mes .req[0]+ "x " +getitemname(.req[1]);	}	next;	if (select("I have the following requirements:No, thanks") - 1) close;	if ( countitem(.req[1]) < .req[0] ) {		mes .npc$;		mes "You lack requirements";		close;	}	delitem .req[1],.req[0];	getitem .choices[.@selected],1;	mes .npc$;	mes "Thanks for exchanging!";	close;}

Share this post


Link to post
Share on other sites
  • 0

 

 

<header>,{    for( set .@i, 1; .@i < getarraysize(.exchange); set .@i, .@i + 1 ) {        set .@menu$, .@menu$ + " - " + "^0000ff" + getitemname(.exchange[.@i]) + "^000000";        set .@menu$, .@menu$ + ":"; // build menu.    }        set .@choice, select(.@menu$);        mes "[ "+strnpcinfo(1)+" ]",            "Exchange Rates : ",            "1x " + getitemname(.exchange[.@choice]),            .cost[.@choice]+"x " + getitemname(.requirement[.@choice]);        if ( select( "Exchange", "Later" ) == 2 ) close;        if ( countitem(.requirement[.@choice]) < .cost[.@choice] ) { // count if you have sufficient items to exchange.            mes " ","I need ^ff0000"+ ( .cost[.@choice] - countitem(.requirement[.@choice]) ) + " "+ getitemname(.requirement[.@choice])+ "^000000.";            close;        }        delitem .requirement[.@choice],.cost[.@choice]; // delete item requirements        getitem .exchange[.@choice], 1; // get item        mes " ","Thanks for exchanging!";        close;OnInit: // Config    setarray .exchange[1],7229, 7228, 7757, 501;        // exchange item.    setarray .requirement[1],7232, 7231, 7233,502;    // item requirement.    setarray .cost[1], 5, 10, 15, 20;                 // exchange cost.    end;}

 

 

 

or

 

 

 

<header>,{    for( set .@i, 1; .@i < getarraysize(.exchange); set .@i, .@i + 1 ) {        set .@menu$, .@menu$ + " - " + "^0000ff" + getitemname(.exchange[.@i]) + "^000000";        set .@menu$, .@menu$ + ":"; // build menu.    }        set .@choice, select(.@menu$);        mes "[ "+strnpcinfo(1)+" ]",            "Exchange Rates : ",            .cost[.@choice]+"x ^ff0000" + getitemname(.requirement[.@choice])+ "^000000 is to", "1x ^ff0000" + getitemname(.exchange[.@choice])+"^000000";                    if ( select( "Exchange", "Later" ) == 2 ) close;        mes "How many do you want to exchange?";        input .@input; // input how many items you want to exchange.        if ( countitem(.requirement[.@choice]) < (.cost[.@choice] * .@input ) || .@input == 0) { // count if you have sufficient items to exchange.            mes " ",.@input == 0?"Value is not accepted!":"I need ^ff0000"+ ( (.cost[.@choice] * .@input ) - countitem(.requirement[.@choice]) ) + " "+ getitemname(.requirement[.@choice])+ "^000000.";            close;        }        delitem .requirement[.@choice], (.cost[.@choice] * .@input ); // delete item requirements        getitem .exchange[.@choice], .@input; // get item        mes " ","Thanks for exchanging!";        close;OnInit: // Config    setarray .exchange[1],7229, 7228, 7757;        // exchange item.    setarray .requirement[1],7232, 7231, 7233;    // item requirement.    setarray .cost[1], 5, 10, 15;                 // exchange cost.    end;}

 

 

Edited by quesoph

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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