# Compare Blackboard entries in Behavior Trees

**URL:** <https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841>\
**Category:** AI\
**Tags:** Behavior-Tree, compare, blackboard, decorator, unreal-engine, question\
**Created:** [February 3, 2015, 12:24pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841 "2015-02-03T12:24:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 3, 2015, 12:24pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/1 "2015-02-03T12:24:06Z")

</div>

Hi, I’m working on Behavior Trees for unit movement in my game. I used the ‘Compare Blackboard Entries’ with ‘Is Equal To’ operator for deciding whether a task should be run or not. Initially I tried with bool values. One of the bool variables is set as true from the beginning, and the other one at a later stage. However, the compare decorator refuses to acknowledge that. It runs the task, when I set it to ‘Not Equal to’. So the one other condition that I’m using a bit higher in the BT is running fine. I printed out both these bool values, just before running the task, and both print out ‘true’. So next time I tried it out with integer values. One integer set to ‘1’ by default and the other set to ‘1’ at a particular point for running the task. Again printing it out gives ‘1’ in both cases. However the decorator refuses to run the task in my BT. Is there a known bug for ‘Compare Blackboard entries’? If not, I’ll try a bit more and see if there is any issue with my logic.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [February 3, 2015, 12:39pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/2 "2015-02-03T12:39:35Z")

</div>

There’s no known bug in said mechanics. If you double-check your logic and it proves to be correct please share more details. A stripped-down version of your project would be awesome.

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 3, 2015, 3:44pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/3 "2015-02-03T15:44:58Z")

</div>

Thanks. I will keep trying again, after some time. So far, I haven’t got past the issue. I’ll try to post a stripped down version by tomorrow, currently the project size is kind of big compared to my upload speed here. For now, I can post the screenshots of what I’m doing:

 ![28810-aicontroller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/a/72a29af1f6d4ddb2e113f4214a2da8bf4e404d69.png)

 ![28821-setblackboard.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/c/17c16f5c9e210ec7d685d77206389c7a273f8da0.png)

 ![28822-btcompare.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/2/672d3d2cfb32c3c88f924ccacafa807d7f6a536a.png)

In the Behavior Tree, it is not entering the ‘CalculateCurrentState’ task. I’ve highlighted the ‘Compare BB’ decorator so that you can see the details. As soon as I remove that condition, the behavior tree runs again.

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 23, 2015, 6:23pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/4 "2015-02-23T18:23:35Z")

</div>

Hi Mieszko, sorry for the delay in reply. My project was kind of unstructured and big back then. Stripping it down seemed like a lot of work. And I was occupied with some other design changes and UMG stuff. I just got back into Behavior Trees today and after converting my project to 4.7 P8, this issue still seems to be there. I just checked for other similar cases online, and I came across this link:

[compare blackboard entries between vectors](https://answers.unrealengine.com/questions/169345/compare-blackboard-entries-between-vectors.html)

It seems two other people went through the same issue while working on BT. So I’m guessing that this is a bug. I will try it out on a new project some time this week.

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 23, 2015, 7:24pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/5 "2015-02-23T19:24:10Z")

</div>

Hi, I’ve checked it out in a new Top Down template. It still produces the error related to ‘Compare BB Entries’. I’ve created a zip file of the project and pasted the link below. All the logical stuff are inside the blueprints folder. I’ve also written a detailed comment in the AIController blueprint to describe the situation.

[BTTest](https://www.dropbox.com/s/y5l3si4f1pbw6fk/BTTest.zip?dl=0)

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [February 24, 2015, 2:50pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/6 "2015-02-24T14:50:28Z")

</div>

Cool, thanks! I’ll have a look today.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [February 25, 2015, 12:11pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/7 "2015-02-25T12:11:33Z")

</div>

Um… I had a look at the project you’ve supplied and everything works as expected. The compared BB entries are different so BB comparing decorator fails. Call me dumb, but I wasn’t able to find where you set the `AITurnOn?` value (though I wasn’t looking too hard :P)

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 25, 2015, 1:07pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/8 "2015-02-25T13:07:36Z")

</div>

You can find an event **Call AITask** inside the _TopDownAIController_ where I set the **AITurnOn?** blackboard value to true. It is being called from the _TopDownPlayerController_ when the user presses **Right Mouse Button**. By default, you might see that the game is printing out false, which happens to be the default value of **AITurnOn?**. If you click the **Right mouse button** , it starts printing out true, but does not go through the **Compare BB entries** decorator. If it goes passes the decorator comparison check, it will print out **Passed through BT**

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [February 25, 2015, 2:45pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/9 "2015-02-25T14:45:16Z")

</div>

Roger.

It’s a bug 🙂 Got it fixed and hopefully it will make it to 4.7.1 (I’m pushing for it really hard). Thanks!!!

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [February 25, 2015, 2:47pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/10 "2015-02-25T14:47:13Z")

</div>

Cool! Glad to see that’s taken care of. 🙂

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [March 20, 2015, 3:37pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/11 "2015-03-20T15:37:01Z")

</div>

Hi Mieszko, do you know if this bug has been fixed in the 4.7.3 release? I still seem to be getting the same bug.

---

<div class="post-metadata">

**Author:** ![Stormrage256](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stormrage256/32/1008648_2.png) [@Stormrage256](https://forums.unrealengine.com/u/Stormrage256)\
**Post date:** [March 20, 2015, 5:54pm UTC](https://forums.unrealengine.com/t/compare-blackboard-entries-in-behavior-trees/305841/12 "2015-03-20T17:54:50Z")

</div>

I’ve checked it for the opposite condition as well. It always lets the BT flow through it no matter what the condition. If you guys don’t have this issue at your side, I can provide a code sample.
