# Behavior Tree "if-else" (stuck in root node)

**URL:** <https://forums.unrealengine.com/t/behavior-tree-if-else-stuck-in-root-node/359810>\
**Category:** AI\
**Tags:** Behavior-Tree, unreal-engine, Blueprint, question\
**Created:** [June 6, 2016, 11:01am UTC](https://forums.unrealengine.com/t/behavior-tree-if-else-stuck-in-root-node/359810 "2016-06-06T11:01:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Napoleonite](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Napoleonite](https://forums.unrealengine.com/u/Napoleonite)\
**Post date:** [June 6, 2016, 11:01am UTC](https://forums.unrealengine.com/t/behavior-tree-if-else-stuck-in-root-node/359810/1 "2016-06-06T11:01:17Z")

</div>

I’m trying to tell the behavior tree to execute the service on the left only if the state is equal to “Deactivated” and in all other cases it should execute the Activated\_Service on the right instead. But the Behavior-tree is stuck in the root-node. Connecting the Root directly to a selector that contains a service does fix it from being stuck in the root-node. But now the if-else is no longer working.

 ![93562-bp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/d/b1deb3d6c2475db96d2e4a635fcb23dff75b4647.png)

Another attempt (with decorator set to “Abort Self”):

 ![93563-bpa.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/e/2feb57c505561ca67436d32926b8e87141e0cd1f.png)

How do I implement an if-else in behavior-trees?

---

<div class="post-metadata">

**Author:** ![Napoleonite](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Napoleonite](https://forums.unrealengine.com/u/Napoleonite)\
**Post date:** [June 7, 2016, 9:19am UTC](https://forums.unrealengine.com/t/behavior-tree-if-else-stuck-in-root-node/359810/2 "2016-06-07T09:19:36Z")

</div>

The problem was that the service TryToActivate MUST have an empty task below it for it to work. If not then the behaviortree for some reason skips the entire leaf there including the entire service. There is no warning nothing… It just skips it entirely.
