Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix monster not updating their look direction #4644

Closed
wants to merge 2 commits into from

Conversation

NRH-AA
Copy link
Contributor

@NRH-AA NRH-AA commented Apr 5, 2024

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

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Apr 5, 2024

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?

https://youtu.be/Y3BWs3_qP_w

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

@MillhioreBT
Copy link
Contributor

This comment shows a current video of tibia and it looks like the current behavior is correct.
#4339 (comment)

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Apr 6, 2024

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.

@NRH-AA NRH-AA closed this Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong direction of monster with hasFollowPath
2 participants