Jump to content
  • 0

Item X or Item Y receive item Z


Question

Posted

Good night I've been seeing some npcs but I do not find any that do what I need. Emistry has some npcs that almost do what I want.

I need an npc that exchanges X item or Y item for Z item:

Quest:

5 Fabre Card
or
5 Poring Card
per
1 Old Album card

The question here is the "or", I know how to do 5X + 5Y = Z, what I need is 5X or 5Y = Z

Thank you very much in advance.

7 answers to this question

Recommended Posts

  • 0
Posted
-	script	asdfjkl	-1,{
for(.@i = 0; .@i < getarraysize(.ask); .@i++){
	if(countitem(.ask[.@i]) > 5){
		.@found = .ask[.@i];
		break;
	}
}
if(!.@found) end;
delitem .ask[.@i],5;
getitem .give,1;
OnInit:
	setarray .ask,501,502;
	.give = 505;
end;
}

No idea if it works, but it should, i guess.

  • 0
Posted (edited)
prontera,155,183,4	script	redeem	717,{
if (countitem(4002)>=5 || countitem(4001)>=5){
	getitem 616,1;
	if (countitem(4002)>=5){
	delitem 4002,5;
	goto OnThanks;
	}
	if (countitem(4001)>=5){
	delitem 4001,5;
	goto OnThanks;
	}
	end;
}
end;

OnThanks:
mes "Thanks You";
end;
}

 

Edited by hendra814
  • Upvote 1
  • 0
Posted (edited)
On 11/28/2018 at 4:09 PM, hendra814 said:

prontera,161,194,4	script	redeem	717,{
if (countitem(4002)>=5 || countitem(4001)>=5){
	getitem 616,1;
}
end;
}

 

And how do I delete one item or the other?
 

if (countitem(6223)>=25 || countitem(6224)>=25){
	delitem 6223,25;  || delitem 6224,25;
	getitem 674,1;

It's correct?

On 11/28/2018 at 3:54 PM, Hijirikawa said:

-	script	asdfjkl	-1,{
for(.@i = 0; .@i < getarraysize(.ask); .@i++){
	if(countitem(.ask[.@i]) > 5){
		.@found = .ask[.@i];
		break;
	}
}
if(!.@found) end;
delitem .ask[.@i],5;
getitem .give,1;
OnInit:
	setarray .ask,501,502;
	.give = 505;
end;
}

No idea if it works, but it should, i guess.

Tks. Thank you. I'll test.

Edited by Tassadar
post part of the code
  • 0
Posted
1 hour ago, hendra814 said:

prontera,161,194,4	script	redeem	717,{
if (countitem(4002)>=5 || countitem(4001)>=5){
	getitem 616,1;
}
end;
}

 

If you want to use this one, I advise using this one.

prontera,161,194,4	script	redeem	717,{
	switch(select("card 1:card2")){
		case 1:
			if(countitem(4002) > = 5){
				getitem 616,1;
				delitem 4002,5;
			}
			break;
		case 2:
			if(countitem(4001) > = 5){
				getitem 616,1;
				delitem 4002,5;
			}
			break;	
	}
end;
}

 

  • Upvote 1
  • 0
Posted
17 minutes ago, Tassadar said:

And how do I delete one item or the other?
 


if (countitem(6223)>=25 || countitem(6224)>=25){
	delitem 6223,25;  || delitem 6224,25;
	getitem 674,1;

It's correct?

sorry forget to put delitem

i already fixed the script and test it. please check it.

  • 0
Posted
prontera,1,1,1	script	exchanger	123,{
	for(.@i = 0; .@i < getarraysize(.possible_trade); .@i++){
		if(countitem(.possible_trade[.@i]) >= .trade_amount[.@i]){
			.@menu$ += .trade_amount[.@i] + " - " + getitemname(.possible_trade[.@i]) + ":";
			.@trade += 1;
		} else {
			.@menu$ += "^d3d3d3You lack " + getitemname(.possible_trade[.@i]) + "^000000" + ":";
		}
	}
	if(.@trade == 0){
		mes "- You don't have any possible items to trade. -";
		close;
	}
	.@i = select(.@menu$) - 1;
	if(countitem(.possible_trade[.@i]) < .trade_amount[.@i]){
		mes "- You lack "+getitemname(.possible_trade[.@i])+" for trading.";
		close;
	}
	mes "Are you sure you want to trade your "+.trade_amount[.@i]+" "+getitemname(.possible_trade[.@i])+"?";
	next;
	if(select("Yes:No") == 2) end;
	delitem .possible_trade[.@i],.trade_amount[.@i];
	getitem .reward_item,1;
	end;	

	
OnInit:
	setarray .possible_trade,501,502,503; // Item ID To Exchange
	setarray .trade_amount,5,5,10; // Amount To Exchange
	.reward_item = 607; // Item Reward for Exchanging
	end;	
}

Just change the ID in possible trade and the reward item for each trade. You can also add possible id to trade in the array

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