Best Practices and Help Regarding Behavior Tree Chase/RotateToPlayer Task and Walk Speed Adjustments Based on Player Proximity

N0dnarb
Tue, 05 Dec 2023 03:24:19 +0000
Programming & Scripting

Hello anyone, I have a few issues I’d like clarity on, all involve each other.
Issue 1:
I think I’ve scripted an interesting way of combining the functionality of an NPC chasing and rotating to face a player in one task (Below Pic Related). I have a couple Questions regarding this setup:

Issue 1 Question A - Does this setup ring any alarm bells or violate any best practices?
Issue 1 Question B - This setup seems to remove my existing functionality of the NPC losing track of me using a simple MoveTo Task, the NPC will follow me forever as opposed to losing track of me when I move out of sight. Is there a way I can fix this so it works bore like the base MoveTo Task?

Issue 2:
I want to set up a service that checks the NPCs distance to the playerTarget and will allow me to adjust the walk speed based on that distance. I want the NPC to approach the player slowly after running to reach them initially. I’ve started a service to do this but I didn’t get far as you can see from the image below. Any specific instruciton on how to do this would be pretty rad.

Thanks in advance.

3 posts - 1 participant