Thread: Leashing Mobs
View Single Post
  #11  
Old 05-15-2009, 12:51 AM
Kayen
Developer
 
Join Date: Mar 2009
Location: -
Posts: 228
Default

I tested this it works.

However your implementing it wrong. There are two mobs in this leash situation. Lets set it up
NPC #1248 King_Gnoll
NPC #1247 Gnoll_Guard

You want the guard to always leash back to the king if its out of range. You put this code on the King_Gnoll.pl . The code then when runs it gets the ID of the gnoll guard, it then calcs the distance of the Gnoll_Guard from the gnoll king, if the distance is greater then 30 it leashes it back got it?

Code:
sub EVENT_AGGRO
{
quest::settimer("LeashCheck",5);
}

sub EVENT_TIMER {

 if ($timer eq "LeashCheck") {
 $LeashedID = $entity_list->GetMobByNpcTypeID(1247);
 $distanceCHK = $LeashedID->CalculateDistance($x, $y, $z);
 #quest::shout("$distanceCHK x $LeashedID");
   	if ($distanceCHK >= 30) { 
   	$LeashedID->WipeHateList();
   	$LeashedID->GMMove($x, $y, $z, 1);
       }
  }
}
Reply With Quote