# Set Branch to true when x out of y conditions are met

**URL:** <https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732>\
**Category:** Community & Industry Discussion\
**Tags:** boolean, bool, random, multiple, condition, unreal-engine, question\
**Created:** [June 6, 2017, 10:08am UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732 "2017-06-06T10:08:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_8842144f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8842144f](https://forums.unrealengine.com/u/anonymous_user_8842144f)\
**Post date:** [June 6, 2017, 10:08am UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732/1 "2017-06-06T10:08:42Z")

</div>

Hey all!

I have 10 booleans that I check with a Branch node.  
I need the Branch to execute as True when 4 out of 10 booleans are true. It does not matter which booleans are true, as long as there are 4.  
When using the AND node, I can only connect specific booleans, which is not what I’m looking for.

Anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![Reuben\_Ward](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Reuben\_Ward](https://forums.unrealengine.com/u/Reuben_Ward)\
**Post date:** [June 6, 2017, 10:52am UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732/2 "2017-06-06T10:52:45Z")

</div>

If you get your boolean and drag out a pin from it, you’ll be able to convert it to an integer by typing ToInt. Convert all your booleans to integers, and then add them together. You can then check if this number is above 4 using a branch.

Hope this helps 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8842144f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8842144f](https://forums.unrealengine.com/u/anonymous_user_8842144f)\
**Post date:** [June 6, 2017, 11:16am UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732/3 "2017-06-06T11:16:51Z")

</div>

I tried your solution, but I think I might have done something wrong… because it’s not firing True.  
Could you maybe see what I did wrong?

 ![150282-multibool.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/d/d/add17839fffc737c07bbb7710cbeb81a6ed0b09b.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f3196e371](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f3196e371](https://forums.unrealengine.com/u/anonymous_user_f3196e371)\
**Post date:** [June 6, 2017, 12:07pm UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732/4 "2017-06-06T12:07:52Z")

</div>

You are not adding the integers together. Replace the “&”-Node with a “+”.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8842144f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8842144f](https://forums.unrealengine.com/u/anonymous_user_8842144f)\
**Post date:** [June 6, 2017, 12:13pm UTC](https://forums.unrealengine.com/t/set-branch-to-true-when-x-out-of-y-conditions-are-met/395732/5 "2017-06-06T12:13:01Z")

</div>

Perfect, thank you!
