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

**URL:** <https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850>\
**Category:** AI\
**Tags:** Behavior-Tree, unreal-engine, question\
**Created:** [December 12, 2024, 8:57pm UTC](https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850 "2024-12-12T20:57:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_AKIMBO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_AKIMBO](https://forums.unrealengine.com/u/Mr_AKIMBO)\
**Post date:** [December 12, 2024, 8:57pm UTC](https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850/1 "2024-12-12T20:57:58Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/e/a/5eaeaf470fc23fca584cf088b11fff56e881f58a.png)  
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.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/a/42a108772bc6a4e621e19044282c2f7529def02d.png)  
This is how the BT is called from the AI\_Controller.  
Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [December 12, 2024, 9:35pm UTC](https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850/2 "2024-12-12T21:35:36Z")

</div>

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. 🙂

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Mr\_AKIMBO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_AKIMBO](https://forums.unrealengine.com/u/Mr_AKIMBO)\
**Post date:** [December 13, 2024, 10:03am UTC](https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850/3 "2024-12-13T10:03:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 12, 2025, 10:03am UTC](https://forums.unrealengine.com/t/how-to-get-the-current-running-sequence-of-a-behavior-tree/2214850/4 "2025-01-12T10:03:50Z")

</div>

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