Jump to content
  • 0

NPC Check Either Item To Start


Question

Posted (edited)

hi i have totally no idea how can i make this script..

player will bring either of this item before he can talk to the npc, 

Note : Item A, Item B and Item C are rental weapon, equipped or not equipped, not matter as long its with the player

example:

if (check item (A) <1, or check item (B) <1, or check item (C) <1 ){

	mes "Hello, Good day huh?";
	close;
}

	mes "Oh you want this juice?":
	mes "let me have a look that (either item)";
	next;
	mes "Nice!, thanks for showing me,";
	mes "you can have this juice !";
	getitem 7709, 1;
	close;

it wont delete player item, just to enable the npc to trigger the other massage and npc give item to the player

Edited by Dolphin86

7 answers to this question

Recommended Posts

  • 0
Posted

You have many ways of doing it. You could use a loop with an array, but this one is pretty straightfoward:

if (countitem(A)) {
	.@itemid = A;
}
else if (countitem(B)) {
	.@itemid = B;
}
else if (countitem(C)) {
	.@itemid = C;
}

if (!.@itemid) {
	mes "Hello, Good day huh?";
	close;
}

mes "Oh you want this juice?":
mes "let me have a look that " + getitemname(.@itemid);
next;
mes "Nice!, thanks for showing me,";
mes "you can have this juice !";
getitem 7709, 1;
close;

 

  • 0
Posted (edited)
28 minutes ago, Tokei said:

You have many ways of doing it. You could use a loop with an array, but this one is pretty straightfoward:

if (countitem(A)) {
	.@itemid = A;
}
else if (countitem(B)) {
	.@itemid = B;
}
else if (countitem(C)) {
	.@itemid = C;
}

if (!.@itemid) {
	mes "Hello, Good day huh?";
	close;
}

mes "Oh you want this juice?":
mes "let me have a look that " + getitemname(.@itemid);
next;
mes "Nice!, thanks for showing me,";
mes "you can have this juice !";
getitem 7709, 1;
close;

 

thanks @Tokei for correcting, but the items are rental weapons, how can i make it possible? either the item is equipped or not equipped ?

i think this is the correct way, but how can i add this to my test script?

@inventorylist_expire[]    - expire time (Unix time stamp). 0 means never expires.

 

Edited by Dolphin86
  • 0
Posted
new_1-3,95,60,6	script	Test	808,{
	if (countitem("40024")) {
	.@itemid = 40024;
	}
	else if (countitem("40046")) {
	.@itemid = 40046;
	}
	else if (countitem("40052")) {
	.@itemid = 40052;
	}

	if (!.@itemid) {
	mes "Hello, Good day huh?";
	close;
}

mes "Oh you want this juice?";
mes "let me have a look that " + getitemname(.@itemid);
next;
mes "Nice!, thanks for showing me,";
mes "you can have this juice !";
getitem 7709, 1;
close;
}

Untitled.png.0f5b1b6fbab245ebd4c13b4a81a77c29.png

  • 0
Posted (edited)

problem solved.. with redneck solution 

new_1-3,95,60,6	script	Test	808,{

	if (rentalcountitem(40024) > 1) {
	goto have;
	}
	if (rentalcountitem(40046) > 1) {
	goto have;
	}
	else if (rentalcountitem(40052) > 1) {
	goto have;
	}

	mes "Hello, Good day huh?";
	close;
	
have:
	mes "Yuhuuuuuuu";
	close;
}

 

Edited by Dolphin86
  • 0
Posted (edited)

That's one way of doing it, here your spoon to fed with ^^:
 

new_1-3,95,60,6	script	Test	808,{
	if (rentalcountitem(item_id) < 1 || rentalcountitem(item_id) < 1 || rentalcountitem(item_id) < 1){
		mes "Hello, Good day huh?";
		close;
	}
	mes "Oh you want this juice?":
	mes "let me have a look that (either item)";
	next;
	mes "Nice!, thanks for showing me,";
	mes "you can have this juice !";
	getitem 7709, 1;
	close;
}

just edit the "item_id" to yours and should be good

Edited by llchrisll
  • 0
Posted
41 minutes ago, llchrisll said:

That's one way of doing it, here your spoon to fed with ^^:
 

new_1-3,95,60,6	script	Test	808,{
	if (rentalcountitem(item_id) < 1 || rentalcountitem(item_id) < 1 || rentalcountitem(item_id) < 1){
		mes "Hello, Good day huh?";
		close;
	}
	mes "Oh you want this juice?":
	mes "let me have a look that (either item)";
	next;
	mes "Nice!, thanks for showing me,";
	mes "you can have this juice !";
	getitem 7709, 1;
	close;
}

just edit the "item_id" to yours and should be good

well it did work, but it will only work if i have 3 of the items, the plan was if player had either 1 of the item it will work ahaha thanks for the golden spoon

  • 0
Posted
7 minutes ago, Dolphin86 said:

well it did work, but it will only work if i have 3 of the items, the plan was if player had either 1 of the item it will work ahaha thanks for the golden spoon

That's what it does
|| = or
&& = and

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