EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Checking pet owners in script files (https://www.eqemulator.org/forums/showthread.php?t=32271)

Cottus 10-10-2010 11:34 PM

Checking pet owners in script files
 
I have a quest file which basically has the following:

Code:

sub EVENT_ATTACK {
    quest::shout("$name is attacking me (level $ulevel)");
}

sub EVENT_AGGRO {
    quest::shout("$name has aggroed me (level $ulevel)");
}

This NPC casts an aoe. Now I have my warrior and a mage with a pet, lets call him Larer.

When my warrior attacks I get

"Cottus has aggroed me (level 60)"
"Cottus is attacking me (level 60)"

Then the aoe goes off and I get:
"Larer000 is attacking me (level 49)".

The aggro event never fires for the mage, even though the mage makes it onto the hatelist. And the attack event only fires for the pet, which makes sense.

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().

Secrets 10-11-2010 01:06 AM

Quote:

Originally Posted by Cottus (Post 192957)
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()

Cottus 10-13-2010 12:40 AM

Thanks much for the suggestions, Secrets.

The script still isnt working, so I need to dig into what version of eqemu I'm working with. I am nearly 100% its an issue with the $mob variable or some of its methods not being properly exposed to perl.


All times are GMT -4. The time now is 05:33 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.