Quote:
Originally Posted by Cottus
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()