Reply To: Intended way to control BTs with FSM

NodeCanvas Forums Support Intended way to control BTs with FSM Reply To: Intended way to control BTs with FSM


Thanks for the response,

That makes sense, however, if each sub-BT is a state, then how do I store other state-related information along with it? For example, let’s say I have an Aggro and Passive state, conceptually. Perhaps, in the Aggro state, I would want to store some encapsulated data like which target the AI is aggroed to, but I do not want to store that information in the Passive state. This alone would be easily possible with a normal FSM as each state can hold whatever it wants. But when I try to combine this normal state behaviour with a sub-BT, I realize that the sub-BT and the actual state (like Aggro or Passive) would be considered separate states.

So, to summarize, I do realize that using sub-BTs as states could achieve part of what I want, but how do you associate data with those specific states? Is there some way to “link” multiple states together so I can store data and execute specific behaviour?

To better illustrate what I want, I will explain a scenario that would work, but feels wrong. I could use a normal FSM with normal states, and each state could have an inspector-assignable sub-BT. Then, when any state is entered, the state assigns its sub-BT as the “current” BT to be evaluated. To do this I would need one parallel BT that is always being evaluated, and it just gets swapped out.

Hopefully this is a more explicit question.