Jump to content

Let's Talk: Pet 'defensive' Mode

Guest SWGuard

Recommended Posts


Before tackling the Beastmastery talents, I thought I'd take a stab at fixing the fact

that pets on 'defensive' behave as if on 'aggressive'.

With your pet on 'defensive', if you walk within 10 yards or so of a hostile mob, your

pet will take off to attack it even if the mob didn't initiate combat.

I started debugging here: PetAI::UpdateAI() but quickly learned that by the time this

function is called, my pet is already attacking the mob. I then tried some tricks in

Unit::Attack() but unfortunately it always reported me as "in combat" even though

in the game I wasn't.

I also tried a few other functions where I tested things like owner->isInCombat()

and tested for GetCharmInfo()->HasCommandState(COMMAND_ATTACK) and / or

GetCharmInfo()->HasReactState(REACT_DEFENSIVE) but each attempt failed for

some reason or another.

Would one of the devs. be so kind as to explain a bit how the AI works? Where exactly

does it decide "hey, there's a hostile target"? It seems to me there's a function somewhere

that does this which needs to say "wait a minute, is my owner in combat?" and not attack.

Side note: No matter where I checked owner->isInCombat() it always evaluated to true

even though I was never in combat.

I'd like to get this fixed since it's one of the important aspects of a Hunter (pet control).

I don't mind taking a stab at it if someone could outline the sequence of events regarding

pet AI.


Link to comment
Share on other sites

Posting some new information:

It would appear after some more debugging, defensive is not acting like 'aggressive'

so to speak but rather the pet is simply attacking too early.

It seems that the pet on defensive attacks anything that targets either the pet or

the owner, as soon as the mob aggros. When this happens, your pet runs out to

meet the incoming attacker.

The way this should work is your pet on defensive should only attack if

either the owner or pet receives damage (in case of melee or spells) or has a

harmful spell / debuff cast on them (such as a curse).

So what needs to be changed in the core is to only have defensive pets attack

on damage taken or debuffs cast, not on aggro gain. I've been unable to pinpoint

exactly where in the core that aggro is initiating combat though.

Link to comment
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use