Bug #4184

Guards can initiate dialogue even though you are far above them

Added by Randy Davin 22 days ago. Updated 17 days ago.

Target version:
Start date:
% Done:


Operating system:


1. Tcl, setflying 1, or levitate. Setspeed 1000
2. Hit someone(commit a minor crime), make the guards pursue you
3. Fly up above them, and stop, let the guards try to find the exact position below you
4. Guard open dialogue with you

See picture to understand

screenshot014.jpg View (299 KB) Randy Davin, 11/01/2017 12:41 AM

screenshot013.jpg View (321 KB) Randy Davin, 11/01/2017 12:41 AM

Associated revisions

Revision 801f2d42
Added by scrawl . 17 days ago

Merge pull request #1537 from drummyfish/guardfix

Check the real distance to target in AIPursue (issue #4184)


#1 Updated by Miloslav Číž 22 days ago

  • Status changed from New to Confirmed
  • Operating system changed from Windows to Other

Confirmed on Linux.

#2 Updated by rexelion . 21 days ago

Seems like the cause is in PathFinder::checkPathCompleted(). It doesn't take into account the z-component of the displacement from the target. Taking the vertical distance into consideration should fix this issue, but it may break something else, so maybe we can check it in AiPursue?

#3 Updated by Miloslav Číž 21 days ago

This is weird, MWMechanics::AiPackage::pathTo(...) takes 3D point as the path destination but then only checks if the path is completed with checkPathCompleted that only uses XY. What if you tell an NPC to walk up a spiral stairs for example? I think it'll bug, but will have to try this.

#4 Updated by rexelion . 21 days ago

I've just tested it on a spiral staircase in Wolverine Hall, guards were able to find me several flights up. I think it works because the path created by the pathfinder in this case is not empty as there are points on the pathgrid that are closer to the player than the one the guard is currently standing on, even if he is directly below/above me, but when the player is levitating, the closest point (and final in the path) is the one directly below. The PathFinder::mPath is empty, horizontal distance is close to 0, PathFinder::checkPathCompleted returns true, and so does AiPackage::pathTo.

#5 Updated by Miloslav Číž 21 days ago

Thanks for testing, I'm trying it too. For anyone else, you can make an NPC travel to your position with "aitravel player->getpos x, player->getpos y, player->getpos z" in the console. You can also use this to reproduce the issue without attacking the guards, just invoke the command while flying high above ground.

#6 Updated by Miloslav Číž 20 days ago

  • Status changed from Confirmed to In Progress
  • Assignee set to Miloslav Číž

#7 Updated by Alexei Dobrohotov 20 days ago

  • Category set to AI
  • Status changed from In Progress to Resolved
  • Target version set to openmw-0.44
  • % Done changed from 0 to 100

#8 Updated by Alexei Dobrohotov 17 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF