AI Behavior Tree not doing what it is supposed to do

I created my first behavior tree and thought it was going well until this happened. A boolean is the tree is being ignored by an is set decorator value. If the bool value changes, it is ignored. Does anyone know how to fix this? I have remade the behavior tree multiple times, but it hasn’t worked once because of this.

Images Below:


This branch of the tree should not be running, but it is.

The code in the AI Controller.

More of the code.

This sentence really confuses me. Don’t you want it to be not-executed when it is set to false? The blackboard key is a variable for setting up the condition or storing values. Would you kindly elaborate more on what you want it to be? Like, how does it change? Which nodes are being ignored? and etc. Thank you.

Sorry for being so confusing. When WasActorSensed? is set to false, I want the first branch to stop executing and go to the next one. I was under the impression that using a blackboard decorator would work, but it does not and the branch of the tree continues executing even when the boolean is set to false.

Alright, did you use the “Finish Execute” node? It is vital to use this node to cut the ties of the execution whenever you are done. We usually do it at the end of the script/logic.

Your screenshot is not in full scale covering the whole script, so I can only make a guess that you have missed this step.

My screenshot is of the AI Controller, so I cannot add a finish execute node. The weird thing is, I did add a finish execute to all of the tasks. My guess is it is a problem with the decorator itself, I will look into it further. I have attached pictures of the AI Controller in full and all of the tasks, as well as another picture of the Behavior Tree and Blackboard.






It’s still tough to help with this info unless I could get my hands on it. Anyway, could you use enum instead? I didn’t mean that boolean doesn’t work, but in this case, it is best to use enum. It will be cleaner and easier to control.

Also, you will be just dealing with one variable instead of 3.

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