Best way to reset a sequence

gfribeiro

New member
First of all, I have just started using Behavior Designer and I'm astonished by all the possibilities!

I have this sequence in my tree. It works fine:
Check if there was a distraction, move the character towards it, then waits at that position for X seconds.

The problem is the sequence won't work for a second time because Check Distraction and Wait tasks are marked as completed, retaining the values when they ran for the first time.

The solution I thought was to call the OnReset() method of Check Distraction and Wait when the sequence is completed.

A created a Reset Task that references another task and calls the OnReset(). I have put it at the end of the sequence, but this doesn't seem very efficient and is very hard to maintain and modify. Especially because I was not able to add a list of Tasks to reset, just one per node.

So I wondering if there is an easier way to reset the tasks within a sequence after it is finished.

Thank you.
 

Attachments

  • Screenshot_13.png
    Screenshot_13.png
    28.5 KB · Views: 10
Great to hear that you're enjoying Behavior Designer!

The individual task should reset the needed variables within the OnStart. Seek for example will only return success when it has seeked to the target destination. OnReset is only called within the editor so likely isn't what you want.

If you're referring to running the branch again, you can do this by adding a repeater to the top of the sequence task.
 
Thanks, Justin!
The repeater worked!
For anyone with the same problem, the updated tree is in the attachments.
 

Attachments

  • unknown.png
    unknown.png
    54.2 KB · Views: 16
Top