How to run Sequence with a "long running" Action in Behaviour 1.0.5

I hope this makes sense! I have the following Behaviour Graph:

The idea is that the agent moves to the destination transform, and once there it plays an animation. At any point, the agent should “flee” if it detects the player. The problem is that my “Move To” Action is “long running” - I call the NavMeshAgent to move in the OnStart() event, and wait for the NavMeshAgent to arrive in the OnUpdate() event.

So all the while the tree is running the “Move to Destination” node, it’s not checking to see if the agent is able to detect the player. Same goes for when the Animation is triggered, and the Wait.

How do I manage that scenario, where I want the “Check if Detector” Action to run every tick while allowing the “Move To” Action, and other actions, to run their course?

Do I need to implement a “Move To While Detecting…” action? Or is it possible with the actions I have already? Do I need to be looking at “Event” nodes?

Many thanks for your help!

I believe you would want to use an Abort node / a RunInParallel nodes in this case.

There should be some examples in the Demo Morgan shared with you on your other post :slight_smile:
I believe the patrolling character does something similar to what you are trying to achieve.

I hope that helps!

1 Like

Fantastic, thank you! I’ve set up a new project with Behaviour and the sample asset imported. I will need to spend some time looking for the relevant bits and pieces and seeing what I can learn and re-use.

Thanks again!

Don’t forget to check out the documentation of the sample, it might help you find figuring out quickly what you are looking for!

1 Like