Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2014, 10:09 AM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default way to check if mob has an item

Is there a way I can check whether or not a mob has a particular item on it in the .pl file?

When a certain mob dies I want to code up an EVENT_DEATH that checks his drops/possessions and says different things based on what he has.

I think hasitem is only to check PC inventory?
Reply With Quote
  #2  
Old 08-24-2014, 12:20 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Not sure about this. Quick look at perl_npc.cpp I only see NPC::CountLoot
but that doesn't return item info.
I thought I saw a quest somewhere that did something like this but I cant find it. Any copy I had was probably lost on the last HD failure.

Wonder if Akk or Nate have something like this they could show you.
__________________

Reply With Quote
  #3  
Old 08-27-2014, 11:08 AM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default

It's a silly quest, but the http://www.runen.co.uk/Everquest/Zon...reAhendle2.htm quest calls for this and I was trying to add the finishing touches.
Reply With Quote
  #4  
Old 08-27-2014, 03:11 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

I took a look in perl_npc.cpp, questmgr.cpp, and perl_mob.cpp and couldn't seem to find anything for pulling an item from an NPC's loot. There is NPC::QueryLoot in npc.cpp, but it's only used for #npcstats. It may be possible to write something for Perl that allows you to check for certain items in the NPC's current loot though.
Reply With Quote
  #5  
Old 08-27-2014, 04:43 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Temporary work around if you only had one or two mobs that you wanted to use this on would be to use perl to assign loot. That way you would have direct knowledge in the quest file of what it has.
__________________

Reply With Quote
  #6  
Old 08-27-2014, 05:23 PM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default

Quote:
Originally Posted by wolfwalkereci View Post
Temporary work around if you only had one or two mobs that you wanted to use this on would be to use perl to assign loot. That way you would have direct knowledge in the quest file of what it has.
Great idea. Simple. Thanks.
Reply With Quote
  #7  
Old 08-28-2014, 01:25 PM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default

Here is my quest file if you want it.

You'd want to take the blurred map out of this mob's loottables as I roll and assign in the pl file. This is the mob in erudsxing (a_zombie_sailor).

Code:
sub EVENT_SPAWN
	{
	# use entity variable so each instance has his own copy.
	# Also because var{$mobid} does not work in EVENT_DEATH
	plugin::SEV($npc, "hasmap", 0);

	# Check to see if he should have the blurred map.  3.5%
	# Assigning loot locally since I can't find a way to see if he has
	# one if I let the loottables do this.
	$roll=plugin::RandomRange(1,200);
	if ($roll <= 7)
		{
		quest::addloot(13423, 1, 0); #Blurred Map
		plugin::SEV($npc, "hasmap", 1);
		}
	}

sub EVENT_COMBAT
	{
	# Talkative when he enters combat IF he has the map.
	$myhasmap=plugin::REV($npc, "hasmap");
	if ($myhasmap && $combat_state == 1)
		{
		quest::say("Join.. Glug.. Tombor in his.. watery grave!!");
		$classplural = "${class}s";
		quest::say("$classplural like you always bring out the worst in me.");
		}
	}

sub EVENT_DEATH
	{
	# Talkative when he dies IF he has the map.
	$myhasmap=plugin::REV($npc, "hasmap");
	if ($myhasmap)
		{
		quest::say("My map!! You have my.. map.");
		}
	}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:41 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3