Best way to make a friendly monster follow closely?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
mrspeaker
Posts: 21
Joined: Mon Dec 14, 2020 10:24 pm

Best way to make a friendly monster follow closely?

Post by mrspeaker »

in DECORATE?
And also, is there any difference in pathfinding from a monster that follows a TARGET to a monster that follows a GOAL?

I'm still not 100% happy with my friendlies. In their Spawn state I set the player as their GOAL with Thing_SetGoal, but with A_Chase it seems they always try to take the shortest route to the player, meaning if you are behind a wall or in a neighboring room, they will keep humping that wall trying to get to you through it instead of simply turning.
[imgur]
https://imgur.com/a/puHurk3
[/imgur]
What I ended up doing is calling A_CheckSight at the end of their See state, and if they can't see the player, they go into an alternate See where they do A_FastChase instead of A_Chase and receive A_Recoil(-3). This along with +SLIDESONWALLS makes them kind of do what I need them to. It is far from perfect though (especially cause FastChase makes them strafe randomly, not always in the direction you need), and doesn't work everytime. It's even worse in more mazelike areas full of twists and turns (basically the entirety of Doom lol) or in a situation like in my images but with a very long wall for example, since the chance of them strafing in the right direction several times in a row to come out the other side is much lower.

Return to “Scripting”