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 06-19-2014, 03:42 PM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default is NPC spawned

Hola,

Is there a way to check if an NPC is spawned before doing something?

Something like:

Code:
if (defined $qglobals{"MjarakIsDead"}){ 
		my $mjarak = $entity_list->GetMobByNpcTypeID(4770015);
		if ($mjarak == 1){
		quest::ze(15, "texthere");
		quest::settimer(4772, 120);
		}
		else {
		}
		}
The if ($mjarak == 1) { was just wishful thinking, I've tried if ($mjarak->IsMob()){ too.
Reply With Quote
  #2  
Old 06-19-2014, 04:15 PM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Found EntityVariableExists() under the mob-> commands,

Tried the following with no luck.

Code:
if (defined $qglobals{"MjarakIsDead"}){ ###Mjarak 2 min warning
		my $mjarak = $entity_list->GetMobByNpcTypeID(4770015);
		if ($mjarak->EntityVariableExists()){
		quest::ze(15, "texthere");
		quest::settimer(4772, 120);
		}
		}
Reply With Quote
  #3  
Old 06-19-2014, 05:14 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Quote:
Originally Posted by Esildor View Post
The if ($mjarak == 1) { was just wishful thinking, I've tried if ($mjarak->IsMob()){ too.
What about just:
if ($mjarak)
Reply With Quote
  #4  
Old 06-19-2014, 05:30 PM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Quote:
Originally Posted by joligario View Post
What about just:
if ($mjarak)

Tadah! if ($mjarak) { works, Thanks Jolig!
Reply With Quote
  #5  
Old 06-19-2014, 08:52 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

EntityList::IsMobSpawnedByNpcTypeID() should work with both lua and Perl. (I'm not sure the exact syntax though :P)
Reply With Quote
  #6  
Old 06-20-2014, 12:39 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Quote:
Originally Posted by demonstar55 View Post
EntityList::IsMobSpawnedByNpcTypeID() should work with both lua and Perl. (I'm not sure the exact syntax though :P)
Grabbing the entity with:

Code:
my $mjarak = $entity_list->GetMobByNpcTypeID(4770039);
if ($mjarak) {
Is working fine. Is there any reason that doing EntityList::IsMobSpawnedByNpcTypeID() any better?
Reply With Quote
  #7  
Old 06-20-2014, 01:01 AM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Quote:
Originally Posted by Esildor View Post
Grabbing the entity with:

Code:
my $mjarak = $entity_list->GetMobByNpcTypeID(4770039);
if ($mjarak) {
Is working fine. Is there any reason that doing EntityList::IsMobSpawnedByNpcTypeID() any better?
It does the same thing, but in code, so you don't have to worry about go through the quest system. It also makes sure the NPC is alive, since the enity list can contain mobs that are dead and will be quickly removed :P (they get removed on the next cycle)
Reply With Quote
  #8  
Old 06-20-2014, 02:18 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

I see.

The entity variables I'm using won't last long, only 2 minutes. Using it for a lockout system, if someone zones in and the mob is up it's going to despawn it w/in 2 minutes unless the player leaves the zone. If I'm only using the variables for a relatively short amount of time, should I really be worried about them being buggy?

Sidenote, anyone know of a way to return the time remaining on a qglobal to players?
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 04:08 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