Jump to content
  • 0

ask about script sell item


LearningRO

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

hi, i want to ask its possible to make npc sell item but only accept specify items 

like only can sell red potion yellow potion blue potion ??

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   3
  • Joined:  04/23/17
  • Last Seen:  

Of course you can add a specify items in your NPC. Give me your script and I try to fix it.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

OnSellItem:
	set .@TotalEarn,0;	
		for(set .@j,0; .@j < getarraysize( .bitem ); set .@j,.@j+1)
			if( @sold_nameid[.@i] == .bitem[.@j] ) {
				set .@TotalEarn,.@TotalEarn + ( .bprice[.@j] * @sold_quantity[.@i] );
					set Zeny,Zeny + .@TotalEarn;
					for(set .@i,0; .@i < getarraysize( @sold_nameid ); set .@i,.@i+1)
						delitem @sold_nameid[.@i],@sold_quantity[.@i];
						close;
				} else {
						mes "Sorry I dont buy that kind of item";
						close;
					}

setarray .bitem[0],501,502; //== Item
setarray .bprice[0],1000,2000; //== Item Price [Sell]

A Simple One. :))

Edited by crazyarashi
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

2 hours ago, crazyarashi said:

OnSellItem:
	set .@TotalEarn,0;	
		for(set .@j,0; .@j < getarraysize( .bitem ); set .@j,.@j+1)
			if( @sold_nameid[.@i] == .bitem[.@j] ) {
				set .@TotalEarn,.@TotalEarn + ( .bprice[.@j] * @sold_quantity[.@i] );
					set Zeny,Zeny + .@TotalEarn;
					for(set .@i,0; .@i < getarraysize( @sold_nameid ); set .@i,.@i+1)
						delitem @sold_nameid[.@i],@sold_quantity[.@i];
						close;
				} else {
						mes "Sorry I dont buy that kind of item";
						close;
					}

setarray .bitem[0],501,502; //== Item
setarray .bprice[0],1000,2000; //== Item Price [Sell]

A Simple One. :))

thanks u ill try this

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