Behavior Tree ignoring Node

I have a simple Behavior Tree that does 2 things:

  1. Use a Bool to enter “debug mode” (ManusDei)
  2. Use an Enum to Enter normal mode

Both of these use just a Decorator to allow entering a “Run Behavior” node.
The 1. node is used for debugging and does nothing at the moment.
The 2. node is the normal behaviour of the Character and it simply roams around continuously.

When I spawn the Character, I set “ManusDei” to true in the Blackboard, and then run the Behavior Tree. I can confirm that “ManusDei” is set to true using a print.

Now, the expected behaviour would be that the leftmost node (ManusDei) would take the input since it is true.
But what is happening is that the “ManusDei” node is being ignored and instead the Character Behavior is being fired.
The character then moves to a random spot, finishes and only after that is the “ManusDei” fired.

The Decorator on the Left Node is being ignored and for some reason, the rightmost Node is being given priority.
I have set the “Observer Aborts” on both of the decorators to “Both”.

I have tried to set the “Notify Observer” to “On Value Change”. But the result is the same.

The only way to get the result that I want is to put a second Decorator on the Character Behavior Node, and make it “ManosDei” (BOOL) “Is Not Set”.

I would prefer not to do this and instead actually learn what I am doing wrong.

Weirdly if I make a custom Decorator that does the Bool check then it sort of works? kinda?

This is the Decorator:

But I also don’t want to use this hacky method and would prefer to learn what is happening here.

Ok, I tried to use a “Conditional Loop” decorator but had no success.
It looked like it worked at first but then it got stuck.

You can see that the “ManusDei” is set to false but it still tries to run the Conditional Loop, while the Character Behavior should be running.

Is the character state set to relaxed in the last clip?. If not it would fail the condition on the right and go back to the top of the tree then starting off from the left => so the left node.

Yes the character state is Relaxed


Try looping it otherwise once BT_Relaxed ends it goes to the top of the tree.

Oh wow you recreated it, names and everything!
Ok here you go:

The Character Behavior is not immediately triggered (wich is what I wanted) but now it won’t leave.

It will only leave once the loop condition is not met. (I guessed the relaxed state was the driving factor). Any external change to the state, for instance to “Alerted” would make the loop fail and re-walk the tree. Perhaps you want a different variable to trigger the exit from the state?

What I want is for ManusDei to block all logic to its right. Since I want it to be able to overrule the rest of the AI logic.

That’s a litle like what I did in the OP

It’s more about understanding why the leftmost node (the one that should have priority) is being ignored.

The order always goes from

Left => Right

So for the right to be triggered the left next to it must fail.

Notice the numbers on the right of the blocks. They show the order of execution of commands.

Yes exactly, I know the numbers indicate the order, but then that means that the “ManusDei” node is failing only at the start.

Is better to use a Blackboard based condition or a Conditional loop?

Condition loops are driven by blackboard keys.
You can also expand your options with environment queries.

You only need loops if you want the tree to stay on that behavior.

Ok so I should use the Loop if I want to stay inside the that section.

It’s not working… I think I will just use the original method and avoid doing anything more than simple checks with the BT

Are you sure you want to be running other behavior trees at the bottom and not a BTTask?

Right now you have sub-behavior trees. Tasks return either Success or failure, deciding on the outcome of the node.

Yes does that matter? I only did it to make it cleaner.