# How to play Sound when all Booleans are true

**URL:** <https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992>\
**Category:** Blueprint\
**Tags:** target, boolean, Variable, set, add-variable, reference-blueprint, Blueprints-Programming, unreal-engine, level-blueprint, Widget, question, Blueprint, CPP\
**Created:** [May 22, 2024, 5:29pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992 "2024-05-22T17:29:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 5:29pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/1 "2024-05-22T17:29:25Z")

</div>

Hey, I’ve already added `SET` and at the moment I don’t know how to check all the variables to see if they are true so that another event can be executed?

Thanks.

Get  
**Level Blueprint**

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/c/5bc2a2495619f76567f7bb235422f34a32487dda.png)

* * *

Set  
**First 1 - Widget Blueprint**

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/8/028edb7fbc1d9f911c0ffe8ddd8be530b151303b.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 5:42pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/2 "2024-05-22T17:42:38Z")

</div>

Hi @avdain,

You could use the `AND` boolean node with a `Branch` node to handle the condition check.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/a/c4a1598b0c70454cb63e467edf3a4f6814c58b42.png)

On the boolean `AND` node you can add extra pins to have more than 2 values.

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [May 22, 2024, 5:43pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/3 "2024-05-22T17:43:34Z")

</div>

Yeah try the AND boolean and after that branch DO ONCE node. Find a way to reset it.

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 7:39pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/4 "2024-05-22T19:39:34Z")

</div>

Thanks, I’ve done this before but I didn’t know which node to connect to the `Branch` node as I got an error message when connecting as a `Target` is expected.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/b/53b46ff36d8c5eeb6e4027f3c047dfa08a3de4fa.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 7:43pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/5 "2024-05-22T19:43:22Z")

</div>

> [@avdain](#):
>
> `Branch`

I looks like those variables aren’t local to that blueprint. I’m guessing they are all inside of your WBP\_SM\_Terminal? You would need to get a reference to that to access those variables.

Alternatively, you could have them store “globally” such as inside of your game mode.

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 7:59pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/6 "2024-05-22T19:59:43Z")

</div>

@usa423 @SylarAtomic

Each widget blueprint with the name `WBP_SM_Terminal_1`, starting with the numbers **1** to **5** , has its own variable.

**WBP\_SM\_Terminal\_2 - Example**

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/3/e1358f08f9c57a4ffc56df2e6b7a20f39c1601c6.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 8:15pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/7 "2024-05-22T20:15:18Z")

</div>

Ah right, in that case you will need to plug the references of each of those variables into each of the `Terminal Finished` booleans to be able to access the boolean inside of them.

Do you have access to all of them from inside of you Blueprint with the above mentioned code?

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 8:23pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/8 "2024-05-22T20:23:02Z")

</div>

Hey, do you mean this?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/6/3d6096c328a47e8621eff675bf54dd4992e212e3.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 8:25pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/9 "2024-05-22T20:25:40Z")

</div>

When you create each of those widgets, promote the output to a variable and then add them to the viewport. That way you will have a reference to each of them to connect to your Boolean values.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/0/8c041b47f7f8b65021368bfd1f912a4c421abc4d.png)

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 8:42pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/10 "2024-05-22T20:42:34Z")

</div>

I’m really sorry, but I don’t know how to do it with this WBP.

Full WBP Screenshot of `WBP_SM_Terminal_4`

 ![WBP_SM_Terminal_4_EventGraph_00004](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/8/f58f244950e8dfdff9cf053f5ec0781a228d5ab7.jpeg)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 8:52pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/11 "2024-05-22T20:52:26Z")

</div>

> [@avdain](#):
>
> Full WBP Screenshot

No problem.

This isn’t done inside the WBP but outside of it when its created and added to the screen.

Where in your code are you creating these Widgets to be added to the viewport to see them at runtime?

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 8:59pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/12 "2024-05-22T20:59:19Z")

</div>

This **WBP** is placed in the world.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/4/38416981bb17ff82e8368ea9aa092b7795703a71.jpeg)

* * *

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/f/bdf92504cfe556e81e61cc212a01e8c9062069aa.jpeg)

* * *

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/5/f1506053459080861592e3ad534984927b81d49a.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 9:09pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/13 "2024-05-22T21:09:38Z")

</div>

Hmmm, Alright. I see now.

The blueprint that you are wanting to do the check in, which one is that? Is is also placed in the world?

There are a few ways of doing this. You will need to look at a more re-usable approach later on. I don’t see any need to have 5 Widgets with similar names (and I’m guessing the same code) like this but lets address the other functionality first.

You will get to first get each of them from the world, then cast to each of them and then check their values. This is an expensive approach.

Can you first check something for me, open your widgets and tell me what the parent class is? Open the widget, top right under the close button.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/8/c18621df132604bad6bc65882377949a5c9a766f.png)

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 9:13pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/14 "2024-05-22T21:13:00Z")

</div>

Sure, here it is.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/3/9c35f63db6b29f2f1f790ff9ae1f58b67c0bd147.png)

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 9:19pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/15 "2024-05-22T21:19:43Z")

</div>

Ah right.

So that’s not a Widget and you should change the name of it to `BP_` (Blueprint) instead of `WBP_` (Widget Blueprint) as that will cause confusion when talking to people.

You can use the `Get Actor of Class` node and then set the Actor Class to `WBP_SM_Terminal_1` and then drag off the return and type `Cast to WBP_SM_Terminal_1`. The return from that (As `WBP_SM_Terminal_1`, you should allow you to to access your boolean value.

You will need to do it for each one of them.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/6/cd6e70050d56f07e7624fce5aea489426d6b7593.png)

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [May 22, 2024, 9:57pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/16 "2024-05-22T21:57:29Z")

</div>

I said AND boolean but think I probably should have said OR boolean. That way if any of those are true it will make the branch true.

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 10:28pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/17 "2024-05-22T22:28:21Z")

</div>

Hey, the sound still doesn’t seem to be playing, or am I messing something up?

 ![LandscapePreview_EventGraph_00000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/4/fb4ad99c3a0c67cb5d8b94362f1f8b4e20584991.png)

---

<div class="post-metadata">

**Author:** ![avdain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/avdain/32/1041823_2.png) [@avdain](https://forums.unrealengine.com/u/avdain)\
**Post date:** [May 22, 2024, 10:41pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/18 "2024-05-22T22:41:06Z")

</div>

Seems like I am experiencing brain fog, I should just connect it to `Event Tick` and add a `Do Once` after the `Branch` node. Now it’s working!

@SylarAtomic I will mark your answer as the solution since you helped me through!

---

<div class="post-metadata">

**Author:** ![SylarAtomic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sylaratomic/32/1194543_2.png) [@SylarAtomic](https://forums.unrealengine.com/u/SylarAtomic)\
**Post date:** [May 22, 2024, 10:48pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/19 "2024-05-22T22:48:42Z")

</div>

Thank you! Glad to hear you figured it out.

You can probably remove the cast, I think it’s redundant since you are doing get actor of a specific class. That’s my mistake.

Happy coding!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [June 21, 2024, 10:49pm UTC](https://forums.unrealengine.com/t/how-to-play-sound-when-all-booleans-are-true/1867992/20 "2024-06-21T22:49:08Z")

</div>

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