Jump to content
  • 0

NPC Check Either Item To Start


Dolphin86

Question


  • Group:  Members
  • Topic Count:  256
  • Topics Per Day:  0.06
  • Content Count:  707
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

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
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  663
  • Reputation:   671
  • Joined:  11/12/12
  • Last Seen:  

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;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  256
  • Topics Per Day:  0.06
  • Content Count:  707
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  256
  • Topics Per Day:  0.06
  • Content Count:  707
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  256
  • Topics Per Day:  0.06
  • Content Count:  707
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  256
  • Topics Per Day:  0.06
  • Content Count:  707
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

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

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