EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Faction - DistNoRoot or DistNoRootNoz? (https://www.eqemulator.org/forums/showthread.php?t=3466)

Wynsom 10-17-2002 05:35 AM

Faction - DistNoRoot or DistNoRootNoz?
 
I noticed not all NPC aggro faction is working so i was looking through the source. I can trace what is going on up to this snippet here:

Code:

if(currentmob->CastToClient()->DistNoRoot(sender) <= dist2) {
                                                if (!sender->IsEngaged())
                                                        // Mob not engaged, kos to client, and client is fully connected
                                                {
                                                        sender->AddToHateList(currentmob,1);                               
                                                        //char buffer[200];
                                                        //_snprintf(buffer,200,"%s says: 'I shall attack you %s, because I hate you!'",sender->GetName(),currentmob->GetName());
                                                        //currentmob->Message(0,buffer);
                                                        cout << sender->GetName() << ": Aggro Added! Calculated aggrorange: " << dist2 << endl;                                               
                                                        return true; // Only aggro first player
                                                }
                                               
                                        }

I wanted to look over DistNoRoot( ) to see what exactly was going on but then i found DistNoRootNoZ( ) in npc.c. So which function is the one that tests if a npc is within radius? I've found the faction test in npcai.c and it looks like it should be working. Im still trying to familiarize myself with the source so its all a bit foggy to me still.

Thanks

kathgar 10-17-2002 12:11 PM

The distance formula for x,y is
squareroot((x1 - x2)^2 +(y1-y2)^2).. noz is that
distnorootnoz is the same, without the root(not always needed, takes cpu time)
distnoroot is xyz, with no root, same reason
dist is xyz with root


All times are GMT -4. The time now is 12:50 PM.

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