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