View Single Post
  #2  
Old 10-11-2010, 01:06 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by Cottus View Post
Is there any way in the perl script to check if the "client" is a pet in the attack portion and get its owner? Calling $mob->GetOwnerID() doesnt seem to work, nor does $mob->GetOwnerOrSelf().

Something like this should work:

Code:
sub EVENT_ATTACK {

f( $mob->IsPet() && $mob->IsNPC() )
{
$mob = $mob->GetOwner();
}

    quest::shout("$mob->GetCleanName() is attacking me (level $mob->GetLevel())");
}

sub EVENT_AGGRO {

f( $mob->IsPet() && $mob->IsNPC() )
{
$mob = $mob->GetOwner();
}

    quest::shout("$mob->GetCleanName() has aggroed me (level $mob->GetLevel())");
}
You can even call other functions, because you now have a pointer to that client object. So if you want to do other things based on that client who aggroed, you can by using $mob->CastToClient()
Reply With Quote