Page 1 of 1

Comabt AI problem

Posted: 23 Oct 2020, 12:00
by ervinkeel2001
So I was snooping through Arkngthand today when I noticed that enemy NPCs were getting into an endless loop of combat/no combat running in and out of my line of sight. To reproduce run command

Code: Select all

player->positioncell 175 2376 903 -28 "Arkngthand, Hall of Centrifuge" 
stay put, and wait for someone to notice you. (Interestingly this issue doesn't show up on Debug builds due to slower execution therefore fewer AI calls)

I have tracked down the issue to the MWMechanics::canFight function in aicombataction.cpp, specifically this bit (lines 459-460 on my current Git mirror): download gimp

Code: Select all

if (getDistanceMinusHalfExtents(actor, enemy, true) <= 0.0f)
            return false;
The result is that enemies far below you at a steep angle will stop fighting because getDistanceMinusHalfExtents here calculates Euclidean distance minus vertical distance. Can anyone say as to why this function is used to calculate whether combat is feasible? MiroslavR, perhaps you could bring some light?

Re: Comabt AI problem

Posted: 24 Oct 2020, 10:53
by heilkitty
Let me live! You will be disgraced for this! ?
My guess, it replicates original Morrowind behavior.

Re: Comabt AI problem

Posted: 24 Oct 2020, 21:19
by AnyOldName3
If you're a new user and your posts still need manual approval, it's best not to edit posts. The edit still requires manual approval, but is less likely to get seen than a fresh reply when a moderator visits the forums.