Jump to content
  • 0

I need script NPC Exchange items as points


NKCYBER

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  01/24/20
  • Last Seen:  

I need script NPC  Exchange items as points .

 

example I need Exchange  Muffler [1]    as 3 points     Shoes [1]  as  2 points   and Bring shopping points.

 

Sever rAthena SVN 17726 

Edited by NKCYBER
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

@NKCYBER you can edit the points and the item.

prontera,150,150,5	script	Bring Shopping	122,{
	mes "[Item Trader]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "What can I do for you?";
	next;
	switch(select(" > Information: > Trade in Items: > Point shop (^0055FF"+getd(.Points$)+"^000000): > Leave")) {
	case 1:
		mes "[Item Trader]";
		mes "Do you find that you've got";
		mes "useless Items lying around?";
		mes "I'll be glad to take them off";
		mes "your hands!";
		next;
		mes "[Item Trader]";
		mes "I'll give you ^0055FF"+.Points[0]+" Point"+((.Points[0] == 1)?"":"s")+"^000000 for normal Item each"; 
		mes "Item you give me, and";
		mes "^0055FF"+.Points[1]+" Points^000000 for Items.";
		mes "You can trade those points";
		mes "for items later on.";
		mes "How does that sound?";
		emotion ET_MONEY;
		close;
	case 2:
		mes "[Item Trader]";
		mes "Select the Items you";
		mes "want to trade in.";
		if (.Level) {
			mes " ";
			mes "They must be dropped";
			mes "by monsters of level";
			mes .Level+" and above.";
		}
		deletearray @sold_nameid[0],getarraysize(@sold_nameid);
		callshop "item_shopp",2;
		npcshopattach "item_shopp";
		end;
	case 3:
		mes "[Item Trader]";
		mes "You have ^0055FF"+getd(.Points$)+"^000000 Point"+((getd(.Points$) == 1)?".":"s.");
		callshop "item_shopp",1;
		npcshopattach "item_shopp";
		end;
	case 4:
		mes "[Item Trader]";
		mes "*yawn*";
		mes "See you later!";
		emotion ET_SLEEPY;
		close;		
	}

OnSellItem:
	mes "Items to sell:";
	mes "-----------------------------------";
	for(set .@i,0; .@i<getarraysize(@sold_nameid); set .@i,.@i+1)
		if (@sold_nameid[.@i] > 4000 && @sold_nameid[.@i] < 4700) {
			if (.Level) {
				query_sql("SELECT `LV` FROM `mob_db` WHERE `DropItemid` = "+@sold_nameid[.@i],.@lv);
				if (.@lv < .Level) {
					dispbottom getitemname(@sold_nameid[.@i])+" is under the minimum level.";
					continue;
				}
			}
			set .@Item_id[getarraysize(.@Item_id)], @sold_nameid[.@i];
			set .@Item_amt[getarraysize(.@Item_amt)], @sold_quantity[.@i];
			set .@item, compare(.ITEM$,""+@sold_nameid[.@i]);
			mes ((.@item)?"  ^FF0000":"  ^777777")+@sold_quantity[.@i]+"x "+getitemname(@sold_nameid[.@i])+"^000000";
			set .@Item_total, .@Item_total+(@sold_quantity[.@i]*((.@item)?.Points[1]:.Points[0]));
		}
	deletearray @sold_nameid[0], getarraysize(@sold_nameid);
	deletearray @sold_quantity[0], getarraysize(@sold_quantity);
	if (!.@Item_id) {
		mes "  ^777777(none)^000000";
		emotion ET_SWEAT;
		close;
	}
	mes " ";
	mes "---------- Total: ^0055FF"+.@Item_total+" pt.^000000 -------";
	next;
	if(select(" > ^0055FFComplete trade...^000000: > ^777777Cancel^000000") == 2) {
		mes "[Item Trader]";
		mes "Oh, okay...";
		emotion ET_SCRATCH;
		close;
	}
	for(set .@i,0; .@i<getarraysize(.@Item_id); set .@i,.@i+1)
		delitem .@Item_id[.@i],.@Item_amt[.@i];
	setd .Points$, getd(.Points$)+.@Item_total;
	mes "[Item Trader]";
	mes "All done!";
	emotion ET_DELIGHT;
	close;

OnBuyItem:
	for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
		for(set .@j,0; .@j<getarraysize(.Shop); set .@j,.@j+2)
			if (@bought_nameid[.@i] == .Shop[.@j]) {
				set .@cost, .@cost+(.Shop[.@j+1]*@bought_quantity[.@i]);
				break;
			}
	if (.@cost > getd(.Points$)) {
		mes "[Item Trader]";
		mes "You don't have enough Points.";
		emotion ET_HUK;
	}
	else {
		mes "Items purchased:";
		mes "-----------------------------------";
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
			getitem @bought_nameid[.@i], @bought_quantity[.@i];
			mes "  ^777777"+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"^000000";
		}
		mes " ";
		mes "---------- Total: ^0055FF"+.@cost+" pt.^000000 -------";
		setd .Points$, getd(.Points$)-.@cost;
		emotion ET_MONEY;
	}
	deletearray @bought_nameid[0], getarraysize(@bought_nameid);
	deletearray @bought_quantity[0], getarraysize(@bought_quantity);
	close;

OnInit:
	//waitingroom "Item Trader",0;
	set .Level,0;   		// Minimum monster level to trade corresponding Items.  
	set .Points$,"#Item_Points";	// Variable to store points.
	setarray .Shop[0],		// Item Shop items: <ID>,<point cost>
	  512,10; 
	setarray .Points[0],0,1,1;	// Points per <normal Item>,<Item> 
	set .ITEM$,			// List of Items.
	  "2504,2311"+
	  "2403,2103";
	
	npcshopdelitem "item_shopp",909;
	for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2)
		npcshopadditem "item_shopp",.Shop[.@i],.Shop[.@i+1];
	end;
}
-	shop	item_shopp	-1,909:-1

 

Edited by BeWan
  • Upvote 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  01/24/20
  • Last Seen:  

20 hours ago, BeWan said:

@NKCYBER you can edit the points and the item.


prontera,150,150,5	script	Bring Shopping	122,{
	mes "[Item Trader]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "What can I do for you?";
	next;
	switch(select(" > Information: > Trade in Items: > Point shop (^0055FF"+getd(.Points$)+"^000000): > Leave")) {
	case 1:
		mes "[Item Trader]";
		mes "Do you find that you've got";
		mes "useless Items lying around?";
		mes "I'll be glad to take them off";
		mes "your hands!";
		next;
		mes "[Item Trader]";
		mes "I'll give you ^0055FF"+.Points[0]+" Point"+((.Points[0] == 1)?"":"s")+"^000000 for normal Item each"; 
		mes "Item you give me, and";
		mes "^0055FF"+.Points[1]+" Points^000000 for Items.";
		mes "You can trade those points";
		mes "for items later on.";
		mes "How does that sound?";
		emotion ET_MONEY;
		close;
	case 2:
		mes "[Item Trader]";
		mes "Select the Items you";
		mes "want to trade in.";
		if (.Level) {
			mes " ";
			mes "They must be dropped";
			mes "by monsters of level";
			mes .Level+" and above.";
		}
		deletearray @sold_nameid[0],getarraysize(@sold_nameid);
		callshop "item_shopp",2;
		npcshopattach "item_shopp";
		end;
	case 3:
		mes "[Item Trader]";
		mes "You have ^0055FF"+getd(.Points$)+"^000000 Point"+((getd(.Points$) == 1)?".":"s.");
		callshop "item_shopp",1;
		npcshopattach "item_shopp";
		end;
	case 4:
		mes "[Item Trader]";
		mes "*yawn*";
		mes "See you later!";
		emotion ET_SLEEPY;
		close;		
	}

OnSellItem:
	mes "Items to sell:";
	mes "-----------------------------------";
	for(set .@i,0; .@i<getarraysize(@sold_nameid); set .@i,.@i+1)
		if (@sold_nameid[.@i] > 4000 && @sold_nameid[.@i] < 4700) {
			if (.Level) {
				query_sql("SELECT `LV` FROM `mob_db` WHERE `DropItemid` = "+@sold_nameid[.@i],.@lv);
				if (.@lv < .Level) {
					dispbottom getitemname(@sold_nameid[.@i])+" is under the minimum level.";
					continue;
				}
			}
			set .@Item_id[getarraysize(.@Item_id)], @sold_nameid[.@i];
			set .@Item_amt[getarraysize(.@Item_amt)], @sold_quantity[.@i];
			set .@item, compare(.ITEM$,""+@sold_nameid[.@i]);
			mes ((.@item)?"  ^FF0000":"  ^777777")+@sold_quantity[.@i]+"x "+getitemname(@sold_nameid[.@i])+"^000000";
			set .@Item_total, .@Item_total+(@sold_quantity[.@i]*((.@item)?.Points[1]:.Points[0]));
		}
	deletearray @sold_nameid[0], getarraysize(@sold_nameid);
	deletearray @sold_quantity[0], getarraysize(@sold_quantity);
	if (!.@Item_id) {
		mes "  ^777777(none)^000000";
		emotion ET_SWEAT;
		close;
	}
	mes " ";
	mes "---------- Total: ^0055FF"+.@Item_total+" pt.^000000 -------";
	next;
	if(select(" > ^0055FFComplete trade...^000000: > ^777777Cancel^000000") == 2) {
		mes "[Item Trader]";
		mes "Oh, okay...";
		emotion ET_SCRATCH;
		close;
	}
	for(set .@i,0; .@i<getarraysize(.@Item_id); set .@i,.@i+1)
		delitem .@Item_id[.@i],.@Item_amt[.@i];
	setd .Points$, getd(.Points$)+.@Item_total;
	mes "[Item Trader]";
	mes "All done!";
	emotion ET_DELIGHT;
	close;

OnBuyItem:
	for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
		for(set .@j,0; .@j<getarraysize(.Shop); set .@j,.@j+2)
			if (@bought_nameid[.@i] == .Shop[.@j]) {
				set .@cost, .@cost+(.Shop[.@j+1]*@bought_quantity[.@i]);
				break;
			}
	if (.@cost > getd(.Points$)) {
		mes "[Item Trader]";
		mes "You don't have enough Points.";
		emotion ET_HUK;
	}
	else {
		mes "Items purchased:";
		mes "-----------------------------------";
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
			getitem @bought_nameid[.@i], @bought_quantity[.@i];
			mes "  ^777777"+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"^000000";
		}
		mes " ";
		mes "---------- Total: ^0055FF"+.@cost+" pt.^000000 -------";
		setd .Points$, getd(.Points$)-.@cost;
		emotion ET_MONEY;
	}
	deletearray @bought_nameid[0], getarraysize(@bought_nameid);
	deletearray @bought_quantity[0], getarraysize(@bought_quantity);
	close;

OnInit:
	//waitingroom "Item Trader",0;
	set .Level,0;   		// Minimum monster level to trade corresponding Items.  
	set .Points$,"#Item_Points";	// Variable to store points.
	setarray .Shop[0],		// Item Shop items: <ID>,<point cost>
	  512,10; 
	setarray .Points[0],0,1,1;	// Points per <normal Item>,<Item> 
	set .ITEM$,			// List of Items.
	  "2504,2311"+
	  "2403,2103";
	
	npcshopdelitem "item_shopp",909;
	for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2)
		npcshopadditem "item_shopp",.Shop[.@i],.Shop[.@i+1];
	end;
}
-	shop	item_shopp	-1,909:-1

 

Thank you sir ♥♥
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   2
  • Joined:  04/27/16
  • Last Seen:  

@BeWan

Im trying to use the script, when i try to sell item id ( 2504 ) it shows me 

Items to sell: 

------------------------------

(none)

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