Jump to content
  • 0

if (!isequipped()


Kariton Revolution

Question


  • Group:  Members
  • Topic Count:  161
  • Topics Per Day:  0.04
  • Content Count:  429
  • Reputation:   5
  • Joined:  11/21/11
  • Last Seen:  

help me please

if (!isequipped( )??

how i can make a npc that wearing blankeyes,minstrel,blahblahblah only player who suit that item can talk to npc 

 

blank eyes
Minstrel Song Hat
Magic Eyes
Hunter's Cap
Striped Hat 
Brazil National Flag Hat

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

Give this a try. See lines 21+ for configuration settings. I've left comments to briefly explain what each section of code does.

prontera,150,150,5	script	Test NPC	999,{

	// Script
	mes .npc_name$;
	
	// Loop through item IDs
	for (.@i = 0; .@i < getarraysize(.item_id); .@i++) {
		// Check if current item is equipped
		if (isequipped(.item_id[.@i])) {
			// Display message if item is equipped
			mes "Hey, nice "+ getitemname(.item_id[.@i]) +"!";
			close;
		}
	}
	
	// Display if no items are equipped
	mes "Huh, what do you want? Get lost!";
	close;
	
	
	// Configuration
	OnInit:
		// NPC name
		.npc_name$ = "[Test NPC]";
		
		// Item IDs to speak to NPC
		setarray .item_id[0],
			5102,	// Blank Eyes
			5751,	// Minstrel Song Hat
			5138,	// Magic Eyes
			5383,	// Hunter's Cap
			5395,	// Striped Hat
			5308;	// Brazil National Flag Hat
			
		end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

*isequipped(<id>{,<id>{,<id>{,<id>}}})

This function will return 1 if the invoking character has all of the item
IDs given equipped (if card IDs are passed, then it checks if the cards are
inserted into slots in the equipment they are currently wearing). Theoretically
there is no limit to the number of items that may be tested for at the same time.
If even one of the items given is not equipped, 0 will be returned.

// (Poring,Santa Poring,Poporing,Marin)
if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
// (Poring)
if (isequipped(4001)) mes "A poring card is useful, don't you think?";

The function was meant for item scripts to support the cards released by Gravity
in February 2005, but it will work just fine in normal NPC scripts.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  161
  • Topics Per Day:  0.04
  • Content Count:  429
  • Reputation:   5
  • Joined:  11/21/11
  • Last Seen:  

if these posible

?
 

if (!isequipped(5200)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if(!isequipped(5201)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if (!isequipped(5203)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if (!isequipped(5204)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
 

*isequipped(<id>{,<id>{,<id>{,<id>}}})

This function will return 1 if the invoking character has all of the item
IDs given equipped (if card IDs are passed, then it checks if the cards are
inserted into slots in the equipment they are currently wearing). Theoretically
there is no limit to the number of items that may be tested for at the same time.
If even one of the items given is not equipped, 0 will be returned.

// (Poring,Santa Poring,Poporing,Marin)
if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
// (Poring)
if (isequipped(4001)) mes "A poring card is useful, don't you think?";

The function was meant for item scripts to support the cards released by Gravity
in February 2005, but it will work just fine in normal NPC scripts.

if these posible

?
 

if (!isequipped(5200)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if(!isequipped(5201)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if (!isequipped(5203)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
else if (!isequipped(5204)) { mes "Obtain atleast 1 item in QuestShop 1."; close; }
 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  161
  • Topics Per Day:  0.04
  • Content Count:  429
  • Reputation:   5
  • Joined:  11/21/11
  • Last Seen:  

 

Give this a try. See lines 21+ for configuration settings. I've left comments to briefly explain what each section of code does.

prontera,150,150,5	script	Test NPC	999,{

	// Script
	mes .npc_name$;
	
	// Loop through item IDs
	for (.@i = 0; .@i < getarraysize(.item_id); .@i++) {
		// Check if current item is equipped
		if (isequipped(.item_id[.@i])) {
			// Display message if item is equipped
			mes "Hey, nice "+ getitemname(.item_id[.@i]) +"!";
			close;
		}
	}
	
	// Display if no items are equipped
	mes "Huh, what do you want? Get lost!";
	close;
	
	
	// Configuration
	OnInit:
		// NPC name
		.npc_name$ = "[Test NPC]";
		
		// Item IDs to speak to NPC
		setarray .item_id[0],
			5102,	// Blank Eyes
			5751,	// Minstrel Song Hat
			5138,	// Magic Eyes
			5383,	// Hunter's Cap
			5395,	// Striped Hat
			5308;	// Brazil National Flag Hat
			
		end;

}

hi :) im using euphy quest shop how i can merge this script :D Hahaha ^_^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

hi :) im using euphy quest shop how i can merge this script :D Hahaha ^_^

 

The way I've written it, you can literally inject each section of code into your script. Place the configuration section under your script's OnInit label, and the item check at the beginning of the script (under the header).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  161
  • Topics Per Day:  0.04
  • Content Count:  429
  • Reputation:   5
  • Joined:  11/21/11
  • Last Seen:  

 

hi :) im using euphy quest shop how i can merge this script :D Hahaha ^_^

 

The way I've written it, you can literally inject each section of code into your script. Place the configuration section under your script's OnInit label, and the item check at the beginning of the script (under the header).

 

hi sir :) can you do it for me :) hahah THANKYOU VERY MUCH!

 

//===== eAthena Script =======================================
//= Euphy's Donate Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.4a - eAthena
//===== Description: =========================================
//= A dynamic Donate Shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//============================================================
					
que_temsky,146,143,6	script	Quest Shop	775,{
	waitingroom "Quest Shop",0;
function Add; function Chk; function Slot; function A_An;

	if(.Shops$ != "") set .@i,1;
	else {
		set .@menu$,"";
		for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
			set .@menu$, .@menu$+.Shops$[.@i]+":";
		set .@i, select(.@menu$); }
	dispbottom "Select one item at a time.";
	callshop "cshop"+.@i,1;
	npcshopattach "cshop"+.@i;
	end;

function Add {
	if (getitemname(getarg(1))=="null") {
		debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; }
	for(set .@n,5; .@n<127; set .@n,.@n+2) {
		if (!getarg(.@n,0)) break;
		if (getitemname(getarg(.@n))=="null") {
			debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped)."; return; } }
	for(set .@i,2; .@i<.@n; set .@i,.@i+1)
		set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
	npcshopadditem "cshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
	sleep 1;
	return; }
function Chk {
	if (getarg(0)<getarg(1)) { set @qe0,1; return "^FF0000"; }
	else return "^00FF00"; }
function Slot {
	set .@s$,getitemname(getarg(0));
	switch(.ShowSlot){
		case 1: if (!getitemslots(getarg(0))) return .@s$;
		case 2: if (getiteminfo(getarg(0),11)>0) return .@s$+" ["+getitemslots(getarg(0))+"]";
		default: return .@s$; } }
function A_An {
	setarray .@A$[0],"a","e","i","o","u";
	set .@B$, "_"+getarg(0);
	for(set .@i,0; .@i<5; set .@i,.@i+1)
		if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
	return "a "+getarg(0); }

OnBuyItem:
	set .@q[0],@bought_nameid;
	copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
	if (!.@q[1]) { message strcharinfo(0),"An error has occurred."; end; }
	mes "[Donate Shop]";
	mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
	mes "Requirements:";
	if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
	if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
	if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
		mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
	next;
	set @qe1, getiteminfo(.@q[0],5); set @qe2, getiteminfo(.@q[0],11);
	addtimer 1000, strnpcinfo(1)+"::OnEnd";
	while(1){
		switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2>0 && !@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
			case 1:
				if (@qe0) { 
					mes "[Donate Shop]";
					mes "You're missing one or more quest requirements.";
					close; }
				if (!checkweight(.@q[0],.@q[1])) {
					mes "[Donate Shop]";
					mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
					close; }
				if (.@q[2]) set Zeny, Zeny-.@q[2];
				if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
				if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
					delitem .@q[.@i],.@q[.@i+1];
				getitem .@q[0],.@q[1];
				if (.Announce) announce strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0;
				specialeffect2 699;
				close;
			case 2:
				set @qe3, getlook(3); set @qe4, getlook(4); set @qe5, getlook(5);
				if (@qe1&1) atcommand "@changelook 3 "+@qe2;
				if (@qe1&256) atcommand "@changelook 1 "+@qe2;
				if (@qe1&512) atcommand "@changelook 2 "+@qe2;
				set @qe6,1;
				break;
			case 3:
				close; } }
OnEnd:
	if (@qe6) { atcommand "@changelook 3 "+@qe3; atcommand "@changelook 1 "+@qe4; atcommand "@changelook 2 "+@qe5; }
	for(set .@i,0; .@i<7; set .@i,.@i+1) setd "@qe"+.@i,0;
	end;
OnInit:
// --------------------- Config ---------------------
// Custom points, if needed: "<variable>","<name to display>"
	setarray .Points$[0],"#CASHPOINTS","Cash Points";

	set .Announce,1;	// Announce quest completion? (1: yes / 0: no)
	set .ShowSlot,1;	// Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
	set .DisplayID,0;	// Show item IDs? (1: yes / 0: no)
	set .ShowZeny,0;	// Show Zeny cost, if any? (1: yes / 0: no)

// Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
// Duplicate dummy data for any additional shops (bottom of script).
// If no categories, use the second line instead (remove //).

	setarray .Shops$[1],"Headgear","Mid-Headgear","Lower-Headgear","Accessory","Armory","Weapon";
	// set .Shops$,"n/a";

// Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
//     <required item ID>,<required item amount>{,...});
// Shop number corresponds with order above (default is 1).
// Note: Do NOT use a reward item more than once!

	Add(1,7539,1,1000,10,7265,1,1064,1,7063,1,7021,1,952,1,969,2,4432,1,7227,1);
	Add(1,20082,1,10000000,10,7539,10);
	Add(1,20085,1,10000000,10,7539,10);
	Add(1,20032,1,10000000,10,7539,10);
	Add(1,20037,1,10000000,10,7539,10);
	Add(1,20050,1,10000000,10,7539,10);
	Add(1,20153,1,10000000,10,7539,10);
	Add(1,20090,1,10000000,10,7539,10);
	Add(1,20145,1,10000000,10,7539,10);
	Add(1,20076,1,10000000,10,7539,10);
	Add(1,20065,1,10000000,10,7539,10);
	Add(1,20066,1,10000000,10,7539,10);
	Add(1,20087,1,10000000,10,7539,10);
	Add(1,20089,1,10000000,10,7539,10);
	Add(1,20105,1,10000000,10,7539,10);
	Add(1,20092,1,10000000,10,7539,10);
	Add(1,20192,1,10000000,10,7539,10);
	Add(1,20051,1,10000000,10,7539,10);
	Add(1,20058,1,10000000,10,7539,10);
	Add(1,20032,1,10000000,10,7539,10);
	Add(1,20029,1,10000000,10,7539,10);
	Add(1,20152,1,10000000,10,7539,10);
	Add(1,20025,1,10000000,10,7539,10);
	Add(1,20053,1,10000000,10,7539,10);
	Add(1,20031,1,10000000,10,7539,10);
	Add(1,20173,1,10000000,10,7539,10);
	Add(1,20176,1,10000000,10,7539,10);
	Add(1,20028,1,10000000,10,7539,10);
	Add(1,20179,1,10000000,10,7539,10);
	Add(1,20020,1,10000000,10,7539,10);
	Add(1,20026,1,10000000,10,7539,10);
	Add(1,20030,1,10000000,10,7539,10);
	Add(1,20038,1,10000000,10,7539,10);
	Add(1,20039,1,10000000,10,7539,10);
	Add(1,20040,1,10000000,10,7539,10);
	Add(1,20042,1,10000000,10,7539,10);
	Add(1,20043,1,10000000,10,7539,10);
	Add(1,20046,1,10000000,10,7539,10);

//MIDGEARS

	Add(2,20093,1,10000000,10,7539,10);
	Add(2,20094,1,10000000,10,7539,10);
	Add(2,20155,1,10000000,10,7539,10);
	Add(2,20180,1,10000000,10,7539,10);
	Add(2,20081,1,10000000,10,7539,10);
	Add(2,20095,1,10000000,10,7539,10);
	Add(2,20151,1,10000000,10,7539,10);
	Add(2,20084,1,10000000,10,7539,10);
	Add(2,20181,1,10000000,10,7539,10);
	Add(2,20057,1,10000000,10,7539,10);
	Add(2,20185,1,10000000,10,7539,10);
	Add(2,20073,1,10000000,10,7539,10);
	Add(2,20132,1,10000000,10,7539,10);
	Add(2,20134,1,10000000,10,7539,10);
	Add(2,20177,1,10000000,10,7539,10);
	Add(2,20189,1,10000000,10,7539,10);
	
//LOWERGEARS


	Add(3,20083,1,10000000,10,7539,10);
	Add(3,20098,1,10000000,10,7539,10);
	Add(3,20100,1,10000000,10,7539,10);
	Add(3,20101,1,10000000,10,7539,10);
	Add(3,20104,1,10000000,10,7539,10);
	Add(3,20115,1,10000000,10,7539,10);
	Add(3,20116,1,10000000,10,7539,10);
	Add(3,20133,1,10000000,10,7539,10);
	Add(3,20148,1,10000000,10,7539,10);
	Add(3,20175,1,10000000,10,7539,10);
	Add(3,20178,1,10000000,10,7539,10);
	Add(3,20186,1,10000000,10,7539,10);
	Add(3,20000,1,10000000,10,7539,10);
	Add(3,20001,1,10000000,10,7539,10);
	Add(3,20002,1,10000000,10,7539,10);
	Add(3,20003,1,10000000,10,7539,10);
	Add(3,20005,1,10000000,10,7539,10);
	Add(3,20010,1,10000000,10,7539,10);
	Add(3,20048,1,10000000,10,7539,10);
	Add(3,20049,1,10000000,10,7539,10);
	Add(3,20052,1,10000000,10,7539,10);
	Add(3,20019,1,10000000,10,7539,10);
	Add(3,20035,1,10000000,10,7539,10);
	Add(3,20041,1,10000000,10,7539,10);
	Add(3,20004,1,10000000,10,7539,10);
	Add(3,20021,1,10000000,10,7539,10);
	Add(3,20009,1,10000000,10,7539,10);
	Add(3,20008,1,10000000,10,7539,10);
	Add(3,20014,1,10000000,10,7539,10);
	Add(3,20015,1,10000000,10,7539,10);
	Add(3,20018,1,10000000,10,7539,10);
	Add(3,20074,1,10000000,10,7539,10);
	Add(3,20135,1,10000000,10,7539,10);
	Add(3,20062,1,10000000,10,7539,10);
	Add(3,20063,1,10000000,10,7539,10);
	Add(3,20012,1,10000000,10,7539,10);
	Add(3,20044,1,10000000,10,7539,10);
	Add(3,20064,1,10000000,10,7539,10);

//ACCESSORY

	Add(4,20124,1,10000000,10,7539,20);
	Add(4,20125,1,10000000,10,7539,20);
	Add(4,20126,1,10000000,10,7539,20);
	Add(4,20128,1,10000000,10,7539,20);
	Add(4,20129,1,10000000,10,7539,20);
	Add(4,20127,1,10000000,10,7539,20);
	
//ARMORY

	Add(5,20106,1,10000000,10,7539,10);
	Add(5,20107,1,10000000,10,7539,10);
	Add(5,20108,1,10000000,10,7539,10);
	Add(5,20109,1,10000000,10,7539,10);
	
//WEAPON

	Add(6,30009,1,10000000,10,7539,15);
	Add(6,30012,1,10000000,10,7539,15);
	Add(6,30013,1,10000000,10,7539,15);
	Add(6,30030,1,10000000,10,7539,15);
	Add(6,30016,1,10000000,10,7539,15);
	Add(6,30019,1,10000000,10,7539,15);
	Add(6,30020,1,10000000,10,7539,15);
	Add(6,30031,1,10000000,10,7539,15);
	Add(6,30023,1,10000000,10,7539,15);
	Add(6,30024,1,10000000,10,7539,15);
	Add(6,30025,1,10000000,10,7539,15);
	Add(6,30005,1,10000000,10,7539,15);
	Add(6,30003,1,10000000,10,7539,15);


// --------------------------------------------------
	for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
		npcshopdelitem "cshop"+.@i,909;
	end;
}

// -------- Dummy data (duplicate as needed) --------
-	shop	cshop1	-1,909:-1
-	shop	cshop2	-1,909:-1
-	shop	cshop3	-1,909:-1
-	shop	cshop4	-1,909:-1
-	shop	cshop5	-1,909:-1
-	shop	cshop6	-1,909:-1
-	shop	cshop7	-1,909:-1

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


que_temsky,146,143,6 script Quest Shop 775,{

delwaitingroom;

waitingroom "Quest Shop",0;

if ( !isequipped( 5102,5751,5138,5383,5395,5308 ) ) {

mes "i only talk to people wearing :";

mes "- Blank Eyes";

mes "- Minstrel Song Hat";

mes "- Magic Eyes";

mes "- Hunter's Cap";

mes "- Striped Hat";

mes "- Brazil National Flag Hat";

close;

}

//etc..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  161
  • Topics Per Day:  0.04
  • Content Count:  429
  • Reputation:   5
  • Joined:  11/21/11
  • Last Seen:  

sir i want to make if any of this n5102,5751,5138,5383,5395,5308  item equip of a character can only talk the npc


que_temsky,146,143,6	script	Quest Shop	775,{
	delwaitingroom;
	waitingroom "Quest Shop",0;
	if ( !isequipped( 5102,5751,5138,5383,5395,5308 ) ) {
		mes "i only talk to people wearing :";
		mes "- Blank Eyes";
		mes "- Minstrel Song Hat";
		mes "- Magic Eyes";
		mes "- Hunter's Cap";
		mes "- Striped Hat";
		mes "- Brazil National Flag Hat";
		close;
	}
//etc..

s

sir:)

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

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