PDA

View Full Version : Heal aggro bug


dclark
02-02-2006, 08:45 AM
For starters I have the peq-velious DB and latest 0.6.4 source. I when running around eastwastes when I came to the orc fort. I saw it was setup as if the 8th ring quest was starting. Well I changed this and add quests to start this and not have the fort in a constant start of war. I got to the point where the dwarfs and orcs/giants would charge one another, but the dwarfs would do more damage to themselfs than they would to the orcs/giants. I came to find out that if I took out the healers the palies and priests then all was fine, so something was wrong with the casters. I did alot of digging though the code and decided to add debug messages everywhere someone was added to the hatelist. I found out if an npc healed himself or anyone all npcs around him friend or foe added him to their hatelist. Well this realy goes bad for an event like this when friends attack friends. I added this code to entity.cpp about line 2650 in void EntityList::AddHealAggro(Mob* target, Mob* caster, int16 thedam).

while(iterator.MoreElements())
{
cur = iterator.GetData();
if (!cur->GetOwnerID() && !cur->IsMezzed() && !cur->IsStunned()
&& cur->CheckAggro(target))
{
int16 tmpd = thedam;
if (cur->GetHateAmount(caster) < 100)
tmpd /= 20;
// This is the start
if(cur->GetPrimaryFaction() == caster->GetPrimaryFaction() ||
cur->IsFactionListAlly(caster->GetPrimaryFaction()))
{
LogFile->write(EQEMuLog::Debug, "I %s won't attack %s because we are friends",
cur->GetName(), caster->GetName());
}
else if(cur->GetOwnerID() == caster->GetOwnerID())
{
LogFile->write(EQEMuLog::Debug, "I %s am not a masticist",
cur->GetName());
}
else
{
cur->AddToHateList(caster, tmpd);
LogFile->write(EQEMuLog::Debug, "I %s don't like %s because he healed %s",
cur->GetName(), caster->GetName(), caster->GetTarget());
}//ending right here
}
iterator.Advance();
}

This keeps any npc on the same primary faction from being added to the hatelist and any faction that is allied with them. I am not so sure the else if statment is need. If they heal themselfs it would get added to their own hatelist. Never didn't see one attack themselfs I think the code prevents that elsewhere.

fathernitwit
02-02-2006, 03:03 PM
hmm..
it looks like something else is at the root of this problem... if you notice, there is a "cur->CheckAggro(target)" clause in the conditional there, so `cur` would only get aggro added to them if they are already mad at `target` (the person who was healed)... so this implies that for you to see what you are seeing, that `target` must have already been on `cur`'s hatelist.

if `caster` was healing an enemy (`target`) though, then anybody that was fighting `target` (`caster`'s friends) would have `target` on their hate list, and would then put `caster` on their hate list...

if that dosent hurt your head, I dont know what will.

I believe that this means that there is a beneficial spell set with the wrong AI type in your spell sets in your DB. This recently became a problem when I lifted the "NPCs must not cast beneficial spells on their enemies" rule, since its not needed if the spell sets are configured correctly.

I know that PEQ has an error in the default cleric list, with one of the symbol spells, prolly want to fix that. Then you might want to audit all the lists.

please post results.

dclark
02-04-2006, 09:36 AM
Thanks for the info I think I found the root of the problem now. I spawn a paly and a giant and had them fight. With my show npc spell filter on I saw that the paly was casting symbol of pinzarn(makes sence why he got attacked). I found in the DB that the paly spell entries had the wrong type. It was type 1 should be type 8. Also the entire line of cancel magic will get aggro. Both the palies and priests cast this on thier targets and would get their friends to attack them. In both the paly and priest spell entries it is type 1. I am guessing this is the right type number, so if that is the case then maybe it is call a beneficial spell where is shouldn't. This will also happen if a player casts cancel magic on a Kromrif giant when a drawf is attacking it, so I don't think is a problem with the DB entries.