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 09-16-2012, 03:07 AM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default 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.
Reply With Quote
  #2  
Old 09-16-2012, 09:33 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

something like

Code:
foreach $ent ($npc->GetHateList()) {
    $npc->CastSpell($spellID, $ent->GetID());
}
should work, triggered via a timer or hp event
Reply With Quote
  #3  
Old 09-16-2012, 11:40 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

meh. try this instead. syntax got me.

Code:
foreach $ent (@{$npc->GetHateList()}) {
    $npc->CastSpell($spellID, $ent->GetID());
}
Reply With Quote
  #4  
Old 09-16-2012, 11:51 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

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!
Reply With Quote
  #5  
Old 09-17-2012, 09:32 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Surprisingly people use perl for non eq related things, which makes searching for coding questions pretty easy
Reply With Quote
  #6  
Old 09-17-2012, 10:09 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

or you could use GetHateRandom()
Reply With Quote
  #7  
Old 09-18-2012, 11:34 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

thanks!
Reply With Quote
  #8  
Old 09-18-2012, 03:21 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

Code:
foreach $ent (@{$npc->GetHateList()}) {
    $npc->CastSpell($spellID, $ent->GetID());
}
This code doesn't seem to work. Quest stops working after "foreach $ent (@{$npc->GetHateList()}) {"
Reply With Quote
  #9  
Old 09-18-2012, 04:26 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

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.
Reply With Quote
  #10  
Old 09-18-2012, 07:11 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

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.
Reply With Quote
  #11  
Old 09-18-2012, 07:59 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

I cant remember since its been forever since I last did that. Think you need to cast it to mob though: $ent->CastToMob()->GetID();
Reply With Quote
  #12  
Old 09-18-2012, 08:37 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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.
Reply With Quote
  #13  
Old 09-18-2012, 09:56 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

Code:
if ($hpevent == 90)
	{
		foreach $ent ($npc->GetHateList()) 
		{
    			$npc->CastSpell(6799, $ent->GetEnt()->GetID());
		}
		quest::setnexthpevent(80);

	}
This is my current code. It only casts the selected spell on the player that it is directly attacking though.

Code:
@npcArray = $npc->GetHateList();
		foreach $ent (@npcArray)
		{
			$npc->CastSpell(6799, $ent->GetEnt()->GetID());
		}
Also just casts on the target.
Reply With Quote
  #14  
Old 09-18-2012, 10:30 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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.
Reply With Quote
  #15  
Old 09-18-2012, 10:57 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

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.
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 10:50 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