Mob attacks everything on hate list
I'm trying to think of a way for a monster to attack everything on its hate list like the title of the post says. I don't want to have it cast a PBAE, but rather cast a single target spell on each one of the people it is fighting. Is there anyway to do this? Also, if that wouldn't work, is there a way to count how many people are on a monster's hate list and store it as a variable? That might work as well.
|
something like
Code:
foreach $ent ($npc->GetHateList()) { |
meh. try this instead. syntax got me.
Code:
foreach $ent (@{$npc->GetHateList()}) { |
I have a related question on this.
Same idea, but I would like npc to a pick a RANDOM person from his hate list. How would it modify the code? thanks! |
|
or you could use GetHateRandom()
|
thanks! ;)
|
Code:
foreach $ent (@{$npc->GetHateList()}) { |
Thats where alittle perl knowledge comes in handy...
@npcArray = $npc->GetHateList(); foreach $ent (@npcArray) { } Having never used the syntax Concrete used, I can't comment on its correctness however the above works. |
And now what would you use as the client ID in a cast spell command using that syntax? $ent->GetID() did not work as a target type.
|
I cant remember since its been forever since I last did that. Think you need to cast it to mob though: $ent->CastToMob()->GetID();
|
it's what i get for second guessing myself. the data returned from GetHateList() doesn't need the be enclosed in @{} as it isn't a reference to an array. you might have to get the entity itself by using $ent->GetEnt()->GetID() or something of that nature first (see bottom of http://www.eqemulator.net/wiki/wikka...ListIterations for example). i wasn't at a computer with the emulator installed for testing and only had access to perl at the time of my posting(s), so i wrote a test class to emulate the $npc object.
as to creating an array for capturing the list of entities in the npc's hate list before iterating through them... i just have a habit of not storing returned values into individual variables if they're only going to be used once. it's just a preference. it should work either way, as long as you don't try to use the @{} as i did in my second post. |
Code:
if ($hpevent == 90) Code:
@npcArray = $npc->GetHateList(); |
that's because both of those snippets do the same thing. the only difference is that you aren't storing the hate list returned into a array variable, you're just using it directly from GetHateList().
not sure why CastSpell() isn't landing on the target specified. |
Interestingly, if I do something like having the monster shout a line saying the client's name and ID, it will do it for each person on the hate list, but the castspell will only affect the monster's target even if it is recognizing there are other people on its hate list.
Note: quest::castspell(spellid, entid) works. It will cast a spell on every client on its list. |
All times are GMT -4. The time now is 12:14 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.