Help With Decorators

I need some help with decorators. I’m creating a behavior tree where the enemy begins in a passive state (patrolling, wandering, investigating), then if it senses it was shot it goes to a combat state which executes a healing state and a chasing state. The individual states work but combining them with decorators isn’t. An overview of the entire tree consists of a selector that either performs a passive state or a combat state. This has a decorator that responds to an enum. The changing of states work when the enum changes, the problem is that when it goes into the combat state the tree goes straight through to the end of the combat branch until it gets to the last Move To node then goes back to the root and tries to go back to the passive tree even though the enum has not changed.

Hi, the decorator with the enum does not work as you expect. How its located, it will either allow the whole behavior tree, or block it all. So it does not switch between the left combat branch and the right passive branch. If you want to go into the right branch if its passive, then you need to put the decorator on the left higher priority branch, and only execute the left branch if the enum is not passive.

What is likely happening right now, is that the enum is set to passive, so the behavior tree will run. It goes into the left branch, that fails, so the selector goes to the right passive branch.

I was able to get it working. It turns out I didn’t need the enum after all since I already had a blackboard key that set the player as the attack target when it needed to go into a combat state and clear it when it went back to passive. However it was your suggestion about putting a selector above the combat state that was the real trick. Thanks!