How to play Sound when all Booleans are true

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


Set
First 1 - Widget Blueprint

image

Hi @avdain,

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

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

1 Like

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

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.

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.

@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

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?

Hey, do you mean this?

image

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.

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

Full WBP Screenshot of WBP_SM_Terminal_4

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?

This WBP is placed in the world.


image


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

Sure, here it is.

image

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.

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.

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

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!

1 Like

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!

1 Like

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