EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Code: Pet agro fix (well, if it was broken) (https://www.eqemulator.org/forums/showthread.php?t=4759)

IASoveraign 01-12-2003 06:03 AM

Code: Pet agro fix (well, if it was broken)
 
I noticed my pets weren't attacking critters that attacked me, so I made a small change to attack.cpp (highlighted below).

Code:

                // Agro the client's pet if it has one.
                if (other->IsClient())
                {
                        // TODO: When NPC's charm - pet might become client, not NPC -- Soveraign
                        NPC * client_pet = (NPC *) other->GetPet();
                        if (client_pet)
                        {
                                client_pet->AddToHateList(this);
                        }
                }


IASoveraign 01-12-2003 11:35 AM

FYI - that attack.cpp is from the 4.1 distribution and looks to be out of sync with the CVS.

Baron Sprite 01-12-2003 12:03 PM

k I merged it for you, gj.

neotokyo 01-13-2003 02:48 AM

and i just removed it again, it was in the wrong function :-/

you not only need to check for NPC melee attacks but spell attacks too, and you'd miss them in NPC::Attack. so i put it where it belongs (Client::Damage)

good point about clients being charmed pets too - i would have missed that, but since i didn't put charm as possible offensive spell it wouldnt matter until someone changed the NPC behavior code.

Baron Sprite 01-13-2003 07:53 AM

Oh yeah. :oops:

IASoveraign 01-13-2003 08:46 AM

Yeah, that makes more sense to make sure special attacks are considered. Which reminds me, I've noticed in 0.4.1 that NPCs do not agro if special attacked by a PC. Perhaps a line needs to be moved from Client::Attack to NPC::Damage?

But that begs the question, what about agro on misses? I'm really new to the code base but, ::Damage isn't called if you miss, right?

If that is the case, then should AddToHateList be added to all attack methods (using a low hate of zero or 1)?


All times are GMT -4. The time now is 02:17 AM.

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