Closed NRH-AA closed 4 months ago
I could also change this so it uses the main path matching so there isn't a duplicate but I figured its better to keep path matching clean by adding an additional one for sightline. Note that the other code for checkSightLine does not work for this problem because we need to know if there is any way to get to them not only if we can see them in a straight line.
Here is the video to show with and without the second pathmatching function. Which behavior is correct?
Alternative to the video I also have a solution that allows them to turn randomly if there is no sight path to the target. So it would be like solution 1 in the video but when the doors are closed they turn randomly.
This is what it would look like https://youtu.be/heXUIHywUAQ
This comment shows a current video of tibia and it looks like the current behavior is correct. https://github.com/otland/forgottenserver/issues/4339#issuecomment-1460899713
Actually on the main repo the bottom right demon does not turn as it is supposed to.
In my first video. The first thing I show is the fix that is posted here. The second one is a fix that allows the mobs to turn even if their sight is blocked which I believe is what tibia has which is also in this repo.
The third video allows the monsters to "dance turn" when their path is blocked. Which might be how tibia actually has it. Thats not something I can really test.
This is the problem with current repo: The monsters will not turn at all if their sight is blocked. This happens because the look update is linked to doAttack() which doesn't execute if checkSight returns false. They should be able to update their look direction even if they can't attack as long as they have a target.
Pull Request Prelude
Changes Proposed
Monster do not update their look direction if they can't attack. They should still update even if they cant. Issues addressed: closes #4339