How to finish State Tree Task?

How do I tell the State Tree Task that it can be finished with success or fail? Behavior tree tasks have Finish Execute but I don’t see similar way of doing it here.

can you provide a screenshot of your BT?

It’s not BT task, it’s a State Tree task :stuck_out_tongue:



I don’t know how to finish the task when montage finishes play, I guess it could be done with ‘OnTick’ event as it also returns task result but that doesn’t seem very optimized.

aaa my bad!

Could you trigger an event for when it finishes which then ends it?

That’s the big question bro

There is a bug (in 5.1) that meant that the on completion does not work properly. See here: State Trees and transition on completion - #3 by Light_Shock

This is now reported fixed in 5.2

my lack of knowledge how to finish task?

The bug - in answer to your question you can just let the task finish (like any other blueprint) and this is reported back up to the state tree automatically.

This doesn’t answer my question: how to invoke task finish when task is using async nodes like ‘play montage’. Only sensible answer is to use OnTick workaround but if my task is supposed to tick to detect changes then I can just do it in regular blueprint with less hassle.

Ah ok - I agree it would be better to play the montage in the actor not the state tree. What you could do is have the task trigger an event on the actor to play the montage. This would then decouple the task from the montage keeping the AI brain in the state tree and the animation in the actor.

Posting this here since the question is still a top Google hit for a common problem that has an answer in 5.3 which is still pretty poorly documented. State Trees now behave very similar to Behavior Trees, and you can use “Finish Task”:

yeah, I use it in 5.3 but forgot about this thread :stuck_out_tongue:

Do you know how to mark task “running”?

The state should be changed automatically - you don’t need to do anything - could you perhaps explain your problem more completely?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.