Jump to content
  • 0

Need help for my Equipment Trader to point script


Question

Posted (edited)

Hi,

I'm make equipment trader from Euphy card trader script.

it's works but also could change card into point.

I just want the npc accept equipment.

here the script

Spoiler

//===== rAthena Script =======================================
//= Equipment Trader
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.1 
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Exchange Equipments for points.
//============================================================

prontera,155,183,4	script	Equipment Trader	90,{
	mes "[Equipment Trader]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "What can I do for you?";
	next;
	switch(select(" > Information: > Trade in Equipments: > Point shop (^0055FF"+getd(.Points$)+"^000000): > Leave")) {
	case 1:
		mes "[Equipment Trader]";
		mes "Do you find that you've got";
		mes "useless Equipments lying around?";
		mes "I'll be glad to take them off";
		mes "your hands!";
		next;
		mes "[Equipment Trader]";
		mes "I'll give you ^0055FF"+.Points[0]+" Point"+((.Points[0] == 1)?"":"s")+"^000000 for each";
		mes "Equipment you give me, and";
		mes "^0055FF"+.Points[1]+" Points^000000 for MVP Equipments.";
		mes "You can trade those points";
		mes "for items later on.";
		mes "How does that sound?";
		emotion ET_MONEY;
		close;
	case 2:
		mes "[Equipment Trader]";
		mes "Select the Equipments 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 "Equipment_shop",2;
		npcshopattach "Equipment_shop";
		end;
	case 3:
		mes "[Equipment Trader]";
		mes "You have ^0055FF"+getd(.Points$)+"^000000 Point"+((getd(.Points$) == 1)?".":"s.");
		callshop "Equipment_shop",1;
		npcshopattach "Equipment_shop";
		end;
	case 4:
		mes "[Equipment Trader]";
		mes "*yawn*";
		mes "See you later!";
		emotion ET_SLEEPY;
		close;		
	}

OnSellItem:
	mes "Equipments to sell:";
	mes "-----------------------------------";
	for(set .@i,0; .@i<getarraysize(@sold_nameid); set .@i,.@i+1)
		if (@sold_nameid[.@i] > 2100 && @sold_nameid[.@i] < 22076) {
			if (.Level) {
				query_sql("SELECT `type` FROM `item_db_re` WHERE `ID` = "+@sold_nameid[.@i],.@lv);
				if (.@lv < .Level) {
					dispbottom getitemname(@sold_nameid[.@i])+" is under the minimum level.";
					continue;
				}
			}
			set .@Equipment_id[getarraysize(.@Equipment_id)], @sold_nameid[.@i];
			set .@Equipment_amt[getarraysize(.@Equipment_amt)], @sold_quantity[.@i];
			//set .@mvp, compare(.MVP$,""+@sold_nameid[.@i]);
			//mes ((.@mvp)?"  ^FF0000":"  ^777777")+@sold_quantity[.@i]+"x "+getitemname(@sold_nameid[.@i])+"^000000";
			set .@Equipment_total, .@Equipment_total+(@sold_quantity[.@i]*((.@mvp)?.Points[1]:.Points[0]));
		}
	deletearray @sold_nameid[0], getarraysize(@sold_nameid);
	deletearray @sold_quantity[0], getarraysize(@sold_quantity);
	if (!.@Equipment_id) {
		mes "  ^777777(none)^000000";
		emotion ET_SWEAT;
		close;
	}
	mes " ";
	mes "---------- Total: ^0055FF"+.@Equipment_total+" pt.^000000 -------";
	next;
	if(select(" > ^0055FFComplete trade...^000000: > ^777777Cancel^000000") == 2) {
		mes "[Equipment Trader]";
		mes "Oh, okay...";
		emotion ET_SCRATCH;
		close;
	}
	for(set .@i,0; .@i<getarraysize(.@Equipment_id); set .@i,.@i+1)
		delitem .@Equipment_id[.@i],.@Equipment_amt[.@i];
	setd .Points$, getd(.Points$)+.@Equipment_total;
	mes "[Equipment 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 "[Equipment 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:
	set .Level,4;   		// Minimum monster level to trade corresponding Equipments.
	set .Points$,"#Equipment_Points";	// Variable to store points.
	setarray .Shop[0],		// Equipment Shop items: <ID>,<point cost>
	  985,1,12997,4,13889,8,7619,20,13610,90,12920,150,6241,5,16396,40;
	setarray .Points[0],1,100;	// Points per <normal Equipment>,<MVP Equipment>
	set .MVP$,			// List of MVP Equipments.
	  "4121,4123,4128,4131,4132,4134,4135,4137,4142,4143,4144,4145,4146,4147,4148,4168,4236,"+
	  "4241,4263,4276,4302,4305,4318,4324,4330,4342,4357,4359,4361,4363,4365,4399,4403,4407";
	
	npcshopdelitem "Equipment_shop",909;
	for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2)
		npcshopadditem "Equipment_shop",.Shop[.@i],.Shop[.@i+1];
	end;
}
-	shop	Equipment_shop	-1,909:-1

 

 

Edited by hendra814
fix the title

2 answers to this question

Recommended Posts

  • 0
Posted
2 hours ago, hendra814 said:

if (@sold_nameid[.@i] > 2100 && @sold_nameid[.@i] < 22076) {

change it to something like this

if (@sold_nameid[.@i] > 4000 && @sold_nameid[.@i] < 4700 | @sold_nameid[.@i] > 32999 && @sold_nameid[.@i] < 33006) {

I added a " | "  mark for npc to skip data from 4701 ->  32999 I guess you get my point /heh 

My item numbers 33000 - 33006 are all custom cards. Well, it works for me at least

  • MVP 1
  • 0
Posted
4 hours ago, pajodex said:

change it to something like this


if (@sold_nameid[.@i] > 4000 && @sold_nameid[.@i] < 4700 | @sold_nameid[.@i] > 32999 && @sold_nameid[.@i] < 33006) {

I added a " | "  mark for npc to skip data from 4701 ->  32999 I guess you get my point /heh 

My item numbers 33000 - 33006 are all custom cards. Well, it works for me at least

@pajodex

Thanks for the guide, already solved now

here my worked script.

click

 

  • MVP 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...