How to get the current running sequence of a Behavior Tree?


I need to know which sequence a Characteris Behavior Tree is running to control a blueprints logic and I can’t find a stisfactory way to do it. The best “solution” I’ve figured out is to use the services to update an integer variable which will have a number assigned for each sequence. I’ll make higher priority services override lower ones. But this feels hacky. I was hoping for a cleaner solution.

This is how the BT is called from the AI_Controller.
Thanks for the help!

Hey @Mr_AKIMBO!

You can store these things on the character themselves instead of on the behavior tree- it’s better to do that anyway, for extended purposes it’s just a better storage place for variables. I see this is named “Edmon_BT” so I assume this is being used for one character- that means getting the AI Controller, then the Controlled Pawn, Cast to Edmon_BP, get value.

Instead, though, you can send the value to the Blackboard using “Set BlackBoard Value as ___” on the character, by getting the AI controller and using Get Blackboard. Then you only change the values as they change on the character instead of it being a constant monitor, and so you only need the decorators instead of 4 services. :slight_smile:

Hope that helps!

Thats makes a lot of sense, thanks for the answer. Also thanks for the optimization advice.