Jump to content
  • 0

R> Items = Cash points Converter


Pink Guy

Question


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Can someone please make me an NPC that converts 3 kinds of item = cash point? It's kinda like those Coin Trader NPC = Zeny but they have cash points and it allows you to choose how much you want to trade. The NPC will ask you which item you want to trade.

Let's say poring coin = 3 cash points, tcg card = 5 pts, and gold coin = 10 pts. Also if possible add the option to do vice-versa convert with cash point = poring c / tcg / gold coin.

Bump!


Can someone help? :(


.


Help pls

Edited by Lorenzo Von Matterhorn
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Help pls

 

 

Just sell the items you want to convert to cashpoints to this npc he also sells the items for cashpoints to convert them back.

-	shop	exg_exp	-1,501:50.

prontera,100,100,5	script	Exchanger Express	100,{
	callshop "exg_exp",0;
	npcshopattach "exg_exp";
	end;

OnBuyItem:
	setarray .@choice$, "@bought_", "bought", "-1", "@item";
	if( !checkweight2(getd(.@choice$+"nameid"),getd(.@choice$+"quantity")) ) {
		mes "I'm sorry but purchasing this many items would put you over weight!";
		close;
	}
	
OnSellItem:
	if( !getarraysize(.@choice$) )
		setarray .@choice$, "@sold_", "sold", "1", "@delitem";
	.@len = getarraysize(getd(.@choice$+"nameid"));
	for ( .@i = 0; .@i < .@len; .@i++ ) {
	
		if( .@choice$[1] == "sold" ) {
			if ( countitem(@sold_nameid[.@i]) < @sold_quantity[.@i] || @sold_quantity[.@i] <= 0 ) {
				mes "Something went wrong!";
				close;
			}
		} else {
			if ( @bought_quantity[.@i] <= 0 ) {
				mes "Something went wrong...";
				close;
			}
		}
		
		for ( .@a = 0; .@a < .len; .@a = .@a + 2 ) {
			if( getd(.@choice$+"nameid["+.@i+"]") == .item_base[.@a] ) {
				if ( #CASHPOINTS < .item_base[.@a+1] * @bought_quantity[.@i]
				&&   .@choice$[1] != "sold" ) {
					mes "You have insufficient cashpoints.";
					close;
				}
				atcommand .@choice$[3]+" "+.item_base[.@a]+" "+getd(.@choice$+"quantity["+.@i+"]");
				.@cashpoints = ( getd(.@choice$+"quantity["+.@i+"]") * .item_base[.@a+1] ) * atoi(.@choice$[2]);
				#CASHPOINTS = #CASHPOINTS + .@cashpoints;
				dispbottom getitemname(.item_base[.@a]) +" x"+ getd(.@choice$+"quantity["+.@i+"]") +" "+ .@choice$[1] +" for "+ .@cashpoints +" CASHPOINTS!";
			}
		}
	}
	deletearray getd(.@choice$+"quantity");
	deletearray getd(.@choice$+"nameid");
	mes "Deal completed.";
	close;
	
OnInit:
	setarray .item_base, 7539, 3, 7227, 5, 671, 10;
	.len = getarraysize(.item_base);
	npcshopdelitem "exg_exp",501;
	for ( .@a = 0; .@a < .len; .@a = .@a + 2 )
		npcshopadditem "exg_exp",.item_base[.@a],.item_base[.@a+1];
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Ok. Thanks.

Link to comment
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.   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.

×
×
  • Create New...