Closed AGandrup closed 1 year ago
What npc did you test this with?
It can happen with any npc. I posted a video in the description where i test it with a few random mobs
Managed to come up with a solution, which turned out to be quite simple. Please see PR #346
Can't you just check if the path type isn't PATHTYPE_SHORTCUT
?
Description:
Non-flying NPCs can walk in the air and through objects/terrain. This happens when the NPC is chasing its target thus generating a path to its target. For the most part, this bug occurs when the NPC cannot see its target (Out of Line of Sight).
Current behaviour:
Non-flying NPCs can generate a path to the target that it is chasing, regardless of the path being valid or not, causing it to walk in the air and walk through objects/terrain.
Expected behaviour:
If no valid path is available the NPC should stand still and eventually reset.
Steps to reproduce the problem:
It can be a bit difficult to reproduce as it depends on where you are standing. But anyway:
.gm fly on
Video of the problem:
https://www.youtube.com/watch?v=QCsooLd2XwA
TC rev. hash/commit:
TrinityCore rev. c9d9066cfa26+ 2022-04-02 17:52:10 +0200 (dev-blizzlike branch) (Win64, Release, Static) (worldserver-daemon)
TDB version:
TDB 434.22011
Operating system:
Windows 10
Notes:
I have somewhat solved the problem however I am not happy with solution which is why I haven't made a PR. I have tried quite a lot things and what seems to work the best so far, is just checking the difference between the NPCs end position and its current position and see if the end Z position is higher than the current Z position and if the end X and Y positions are too close to the current X and Y positions. Unfortunatly, doing it this way kinda breaks path finding in a way so that NPCs wont walk to you if you are right above them even though there is a valid path leading up to you.
A proper solution (I think) is to "look one step in the future" - So basically check if the Z position of the NPCs next step is higher than the next steps' FloorZ position. If so, then we know that the NPC is trying to walk in the air and we can just simply prevent it from moving. Unfortunatly I haven't really found my way to do this yet, which is why I am now opening an issue.