Jump to content

Item Collector/Changer


Boom

Recommended Posts


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  182
  • Reputation:   22
  • Joined:  12/30/12
  • Last Seen:  

This is a simple script as requested by Kido here:

http://rathena.org/board/topic/88786-may-i-ask-for-a-npc-tha-exchanges-a-cetain-ammount-of-items/

 

Maybe someone might need a similar script so I posted it in here.

 

Description: For every item listed in the array (multiplied by its item count), this will trade all of those items for an equivalent item with the same count.

 

Cheers! /no1

util_itemchanger.txt

Edited by Boom
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

thank you so much! just a question, how can i make it to give 2000 silver coins for each item of the array instead of one?

thank you again!

 

Edit:

I do not why but for some IDs the npc is not giving silver coins ):

jupe_ele,47,49,6	script	Coin Trader	510,{

	set .npcname$, "[Custom Trader]";
	cutin "ep14_nyd04",2;
	mes .npcname$;
	mes "Hey i can exchange you some items for silver coins";
	menu "Sure!",-,"No thanks", EXIT;
	next;
	mes "Allright, for each one you will get close to 2000 silver coins! ";
	next;
	mes "Lets start";
	next;
	mes "Hmm";

	setarray .@itemlist[0],26140,26141,26142,26143,26144,26145,26146,26147,26148,26149,26150,26151,26152,26173,26174,26175,26176,26177,26178,26179,26180,26181,26182,26183,26184,26194,26195,26196,26197,26198,26199,26822,26824,26171,26202,26798,26809,26817,26789,16527,16528,3174,20000,20001,26341,16533,3169,26416,26417,26418,26419,26420,26421,26422,26423,26424,26425,26426,26427,26792,26793,26794,26795,26796,26797,20072,26119,26121,26123,26446,26447,26448,26449,26450,26451,26452,27001,27003,27004,27005,27007,27008,27009,27010,27011,27012,27015,27017,27019,27020,27021,27025,27026,27027,27030,27033,27034,27037,27038,27039,27041,27043,27046,27048,27049,27050,27051,27052,27055,27056,27058,27062,27063,27064,27066,27069,27070,27071,27072,27074,27075,27076,27080,27082,27083,27084,27095,27096,27097,27099,27100,27109,27111,27112,27114,27115,27117,27118,27119,27124,27126,27127,27128,27130,27131,27132,27133,27135,27140,27143,27144,27145,27146,27147,27149,27150,27151,27154,27155,27157,27160,27161,27162,27163,7164,27165,27167,27168,27169;
	set .@reward, 0;
	
	for( set .@i,0; .@i < getarraysize(.@itemlist); set .@i,.@i + 1 )
		{
			if(countitem(.@itemlist[.@i]) >= 1)
				set .@count, countitem(.@itemlist[.@i]);
				set .@reward, .@reward + .@count;
		}

		if (.@count > 0)
			{
				mes "Here you go!";
				for( set .@i,0; .@i < getarraysize(.@itemlist); set .@i,.@i + 1 )
					{
							set .@countdel, countitem(.@itemlist[.@i]);
							delitem .@itemlist[.@i], .@countdel;
					}
				getitem 675,.@reward*18;
		close2;
	cutin "",255;
	end;
			}
		else
			{
			goto NOITEM;
			}

	NOITEM:
		next;
		mes .npcname$;
		mes "aw you do not hace the correct items";
		close2;
	cutin "",255;
	end;
	EXIT:
		next;
		mes .npcname$;
		mes "if you ever get more items just tell me n.n";
		close2;
		cutin "",255;
end;
}
Edited by Kido
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  182
  • Reputation:   22
  • Joined:  12/30/12
  • Last Seen:  

thank you so much! just a question, how can i make it to give 2000 silver coins for each item of the array instead of one?

thank you again!

 

Edit:

I do not why but for some IDs the npc is not giving silver coins ):

jupe_ele,47,49,6	script	Coin Trader	510,{

	set .npcname$, "[Custom Trader]";
	cutin "ep14_nyd04",2;
	mes .npcname$;
	mes "Hey i can exchange you some items for silver coins";
	menu "Sure!",-,"No thanks", EXIT;
	next;
	mes "Allright, for each one you will get close to 2000 silver coins! ";
	next;
	mes "Lets start";
	next;
	mes "Hmm";

	setarray .@itemlist[0],26140,26141,26142,26143,26144,26145,26146,26147,26148,26149,26150,26151,26152,26173,26174,26175,26176,26177,26178,26179,26180,26181,26182,26183,26184,26194,26195,26196,26197,26198,26199,26822,26824,26171,26202,26798,26809,26817,26789,16527,16528,3174,20000,20001,26341,16533,3169,26416,26417,26418,26419,26420,26421,26422,26423,26424,26425,26426,26427,26792,26793,26794,26795,26796,26797,20072,26119,26121,26123,26446,26447,26448,26449,26450,26451,26452,27001,27003,27004,27005,27007,27008,27009,27010,27011,27012,27015,27017,27019,27020,27021,27025,27026,27027,27030,27033,27034,27037,27038,27039,27041,27043,27046,27048,27049,27050,27051,27052,27055,27056,27058,27062,27063,27064,27066,27069,27070,27071,27072,27074,27075,27076,27080,27082,27083,27084,27095,27096,27097,27099,27100,27109,27111,27112,27114,27115,27117,27118,27119,27124,27126,27127,27128,27130,27131,27132,27133,27135,27140,27143,27144,27145,27146,27147,27149,27150,27151,27154,27155,27157,27160,27161,27162,27163,7164,27165,27167,27168,27169;
	set .@reward, 0;
	
	for( set .@i,0; .@i < getarraysize(.@itemlist); set .@i,.@i + 1 )
		{
			if(countitem(.@itemlist[.@i]) >= 1)
				set .@count, countitem(.@itemlist[.@i]);
				set .@reward, .@reward + .@count;
		}

		if (.@count > 0)
			{
				mes "Here you go!";
				for( set .@i,0; .@i < getarraysize(.@itemlist); set .@i,.@i + 1 )
					{
							set .@countdel, countitem(.@itemlist[.@i]);
							delitem .@itemlist[.@i], .@countdel;
					}
				getitem 675,.@reward*18;
		close2;
	cutin "",255;
	end;
			}
		else
			{
			goto NOITEM;
			}

	NOITEM:
		next;
		mes .npcname$;
		mes "aw you do not hace the correct items";
		close2;
	cutin "",255;
	end;
	EXIT:
		next;
		mes .npcname$;
		mes "if you ever get more items just tell me n.n";
		close2;
		cutin "",255;
end;
}

 

Multiply the .@count variable by 2000.

 

set .@reward, .@reward + .@count*2000;

Retain this part to this

getitem 675,.@reward;

 

But, I think it's too much to give, since the maximum number (it think is 30000) of each item depends on the Weight of the character. Too much Silver Coins will result in too much weight, unless you edit the weight setting of Silver Coins.

 

If some items don't get traded... there might be some error on the way that item is listed on your item database txt file.

Edited by Boom
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

no worry i already edited them, thank you so much for the help it totally works!

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
Reply to this topic...

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