State Tree ... how use Output from Task?

In a State Tree, trying to find a way to use the "Output"s from a Task as “Input” to the next Task? Also tried finding a way to send outputs to a Global Task or Evaluator.

Any suggestions?

Hi espr3ss0,

Instead of using the tasks as states, use them as tasks. For example, if you want your npc to get a patrol point location and move to it, instead of using the state tree as follows:

  • Root
    • Patrol
      • Get Patrol Point (Tasks: STT_GetPatrolPoint)
      • Move To Location (Tasks: STT_MoveToLocation)

Add all the tasks to Patrol:

  • Root
    • Patrol (Tasks: STT_GetPatrolPoint, STT_MoveToLocation)

This way, you can use the output Location in GetPatrolPoint in MoveToLocation:

image

Hopefully that makes sense.

Thanks but a bit limited, can only have those happen together. :frowning:

Can you give an example of the tasks and tree setup in which you are wanting to use the Output as an Input?

If you want to push data back to Global Tasks, I recommend using a parameter on the StateTree and have the task that you want to update the parameter use TStateTreePropertyRef<> that binds to the StateTree parameter you are updating. The property refs are currently only available in C++ in 5.4.

-James

So Just to make sure I understand it TStateTreePropertyRef<> in most cases wil be either under the Property Binding Category Input and sometimes Context but rarely a normal property / parameter or Output. All because it’s meant to write data back via the mutable pointer that’s in the wrapper?

I also watched the State Tree Deep Dive video which explains it at around 20:00. And from what I understand it’s mainly used to copy / write data in a more memory friendly way than the normal property bindings which just copy the properties. But you can still write to global data using the normal properties via bindings for example for an int16 which doesn’t take much memory anyway?

Hope someone can confirm or deny what I think the use cases are, thanks in advance.