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 07-09-2011, 11:14 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default count of mobs by npc_id or clean name

How can I get a count of the mobs in a zone by their NPC_id or their CleanName

have a quest that I need to reduce boss HP based on # of mobs of a certain name.

I would prefer not to have to make 9 different NPC's when i only need 1
Reply With Quote
  #2  
Old 07-09-2011, 11:22 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

You can probably walk the NPC list and count them. http://www.eqemulator.net/wiki/wikka...ListIterations
Reply With Quote
  #3  
Old 07-09-2011, 11:38 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

was trying to avoid that because this needs to be checked repeatedly.

let me restate, is there any current function that will let me get a count of mobs or even a list by npc_id or CleanName. because if you dump something into an array and then dump the array into a scalar you get the count of the array.
This example for clients will get all clients in zone and $size will have the count.
Code:
  @list = $entity_list->GetClientList();
  $size = @list;
Just felt I shouldn't have to walk the entire mob list in perl to count my mobs.
Reply With Quote
  #4  
Old 07-10-2011, 09:35 AM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

The current functions for getting npc's by type id return the first matching npc. One would need to write a similar function to the existing ones except instead of returning on the first result, you would populate a container and return it at the end. From there you would adapt the perl interface to return a perl array. Either way, you're iterating that list, it's just faster using C++ and STL containers.

Another option would be to set up spawn and death events for the applicable NPC type where they signal a quest manager NPC, or the boss directly.
If the number of target mobs to start is static, you could easily just reduce boss hp by a fixed amount per signal, otherwise you would want to use the management NPC so they could increment the current count with a spawn signal and decrement with a death signal.
Reply With Quote
  #5  
Old 07-10-2011, 01:40 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Signals suck. The reason this came up was because the event was originally using signals, and a player got stuck with all 9 mobs down but the bosses unchanged.

The event in question is the ikkinz group 2 trial. If you look at the current quest SVN you can see how it was waiting for counter == 18 that was incrementing on a signal from the Constained Servitors. Yeah it seemed to work most of the time, but it failed once. I added the GM to instance and checked on the player. yup all down, but the Malevolent Priests were not switched. Obviously a failed signal.

I've rewrote the event and it works fine getting this counter would only make it cosmetically look better, when the serivtors are killed to reduce HP by 10% each. There are 5 constrained servitors npc id's. 1 is spawned 4 times, 1 is spawned twice and the other three are all up once for a total of nine. The way i redid it if 294086 is found i add 4 so it will suddenly drop the boss by 40% once the last one goes down. since the boss is not attackable at that point anyway it is only cosmetic.
Reply With Quote
  #6  
Old 07-10-2011, 03:49 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

If you don't want to walk the list or write C++ code to walk the list and return a count then signals with a backup check for existence using $entity_list->GetMobByNpcTypeID(...) would probably work ok.
Reply With Quote
  #7  
Old 07-10-2011, 11:23 PM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

That's actually a pretty simple and elegant fix.

Looking at the source, NPC AI is processed every 10ms and only a single signal can be handled per process, so two kills inside of that 10ms window (10 ms in the high end, could be 0-10 really) would trample each other. It would be a very rare case, but it could happen.
Reply With Quote
  #8  
Old 07-11-2011, 12:23 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I would definitely recommend just iterating the list to do a count as needed. Even if that means 1 time per second, it isn't all that heavy on resources. If you can just start a timer with the start of the event, then iterating just while the event is going on is definitely fine IMO.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 06:46 PM.


 

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