Download

Trouble with Behavior Tree Decorators

Hi, I’ve been working on some basic Behavior Tree stuff in the first person template. Basically, I’m just getting two vectors as blackboard and comparing them using Compare BB Entries decorator. If they’re equal, it’s supposed to print a string. However in my case, the behavior tree passes through the condition even though the vectors are never equal.

I’ve encountered the same issue while working with the ‘Does Path Exist’ decorator even though my two blackboard vectors were clearly blocked by static meshes. I’ve checked the nav mesh collision in editor to see that nav mesh is cut out by the blocking meshes. However the behavior tree always passes through it even though both the blackboard vector values were correct.

I’m not sure if there is anything wrong with my workflow. So I’ve shared the screenshots below.

ee8e46a772a48daec4c35ccccc213374391ca0ca.jpeg

88a51f7f0e5a0b7303c03a16eb7678cf2275bc1d.jpeg

I’m unable to finish uploading the project files here, so I’m sharing the link for the same question in Unreal AnswerHub. I have attached a compressed zip file of the project over there.

https://answers.unrealengine.com/questions/197229/behavior-tree-decorators-not-working.html

this: https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/2/index.html and https://www.youtube.com/watch?v=VAAHKNoIg0w helped me big times.

ill look into your project if i get home

Allright

It would be nice to know what u are actually trying to achieve, theres things I really question in this.

You compare the vectors of 2 different things in the world, one time then they are not equal nothing happens.

In depht: At begin play, that means when u hit play and the pawn gets created it also creates an AI ACTOR - then begin play will fire once in aidirector the BP. The blackboard values get set - they dont happen to be equal, and that was it.

You should go through the 2 tutorials I posted above (the first one first). It really helped me big times.

Hi t0b4cc0, I’ll check out those tutorials. Thanks for the link.

As for the vectors, they’re not equal. I had thought that ‘compare bb entries’ would only let the behavior tree pass through the selector node if the decorator condition was satisfied. And in this case, as you noticed it’s not. But the task ‘BTTask_Test’ keeps getting executed regardless. So I was wondering why the decorator has no impact on the flow at all.

Edit: It works perfectly, if I place the decorator on the task or if I have another selector or sequence node above the one shown in the screenshot. I’m interested in knowing the reasoning behind why it doesn’t work in the situation shown in the screenshot.

ah i didnt see u wanted it to do nothing but it always was executed

well thats odd. when i have a problem like this i always do debugging with “print string”.

in this case i would print the 2 vectors before the “run behavior tree” to see myself, if they are not the same i would go on through the event chain to see where the error is.

I have been confused about this for a long time. After some testing, I found that the Decotator of the behavior tree is not kept in the tick state for execution. It is actually executed in the order of the behavior tree to select the task nodes and then wait for the notification of the return of the behavior nodes. Re-judgment the behavior tree condition after the notification is confirmed As shown in the following figure, if the move to node does not add a finish execute notification, the behavior tree will always be stuck at this step, and the judgment of is at location will not be performed. If you add a finish notification, the behavior tree thinks that this node has completed the task, and then re-evaluate the behavior tree condition
So your problem may be that when the behavior tree is initialized, the values ​​of the two variables are the same, and then enter the task execution, but the execution status is not returned, so the decorator does not re-execute
Although this is a 2015 post lol, hope it can help people who are confused by behavior tree decorator issues