View Single Post
  #5  
Old 12-16-2010, 08:58 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Here is one way to do it:

Code:
sub EVENT_SPAWN {
	quest::setnexthpevent(98);
}

sub EVENT_HP {
	if($hpevent <= 98)
	{
		quest::shout("Roar Mother *******!!");
		my $NPCTarget = $npc->GetTarget(); # Get the NPC's Target
		# Make sure they have a target before getting the ID, or the zone could crash
		if ($NPCTarget)
		{
			my $TargetID = $NPCTarget->GetID();
			$npc->CastSpell(21439, $TargetID);
		}
	}

}
I always just use this simple plugin I made a while back for casting on the NPC's target:

Code:
#Usage: plugin::CastOnTarget(spellid);
# This can be used anywhere, but is best used from events
# that don't export a $client value such as EVENT_TIMER.
# This simply tries to get the NPCs target and then casts
# the spell on them if it has a target

sub CastOnTarget {

	my $npc = plugin::val('$npc');
	my $CastSpellID = $_[0];	#Use the Spell ID Supplied to the Function - "$_[0]" means to use the first argument given
	my $Cur_Target = $npc->GetTarget();	#Get the current Target for this NPC
	if ($Cur_Target && ($Cur_Target->IsNPC() || $Cur_Target->IsClient())) {	#Only cast if the NPC actually has a Target
		my $My_Target = $Cur_Target->GetID();	#Get the Entity ID of the Target
		$npc->CastSpell($CastSpellID, $My_Target, 11);	#Cast the requested Spell ID on the NPC's Target
		# Note: Uses slot 11 argument to prevent fizzling from ever happening
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-17-2010 at 10:52 PM..
Reply With Quote