How to correctly use the Wait task ?

JohnyBro

New member
Hello,

I recently started to use this asset to make a monster AI.
I want to start with a basic behaviour, the monster wander when there is nothing to do, every 30 sec he change floor (the navmesh is in a house) and every 10 secondes the monster start chasing the nearest player. The chase should have priority on floor switching.

The problem is I dont know how to cancel the wandering of the monster based on timers, I can't use abort types with the Wait task since it doesnt return failure, only in progress or success.

I attached a screenshot of my tree to show what I have.

Thank you in advance for your help.
 

Attachments

  • 1720781627937.png
    1720781627937.png
    132.5 KB · Views: 11
The problem is I dont know how to cancel the wandering of the monster based on timers, I can't use abort types with the Wait task since it doesnt return failure, only in progress or success.
You can use the Parallel Selector task for that. When the wait task ends it will also stop the other branch.
 
You can use the Parallel Selector task for that. When the wait task ends it will also stop the other branch.
Thank you for your response, do you mean replacing the sequence task under the repeater with a parallel selector ? If yes it's not what Im looking for because I dont want all the branches to run in parallel. What Im looking for is a way to do "Return failure while the timer run and return success when the timer end"
 
Ah, in that case I think that you could create a new wait task that is a conditional instead of an action. This would then allow you to use the same structure as you have and it would be a pretty easy new task. You could copy the existing wait task, change the type to conditional, and return failure instead of running when the timer is active.
 
Back
Top