Create If Statement with Text as a Condition

Want to make a game completion scene for when the player makes it to the end of the game timer. I have the game over screen widget and the timer widget. This is the timer code which works fine


This is the start to my if statement but I don’t know how to connect these two code blocks.

I want the level to be considered “completed” when the timer reaches a certain number, so I am trying to make the game completion screen trigger when the timer displays a specific number as text. Can I even do that?

To communicate between two blueprints, you can use one of three methods: casting, interfaces, and event dispatchers.

The simplest way would be to cast:

  • Create a custom event on BP_NightsPlayer and connect it to your if statement
  • On your timer, when you want the event to trigger, add a Cast to BP_NightsPlayer node. Connect Get Player Character to the Object pin.
  • Pulling out from the As BP_NightsPlayer pin, connect to the custom event you created earlier.

Sorry, I misunderstood the question.

Yes, you can do this with if statements and text.

Are you looking to trigger the event at the end of the timer, or at some point while the timer is running?

Technically, whilst the timer is running since I don’t currently have a cap to the timer. So what I want specifically is for the event to trigger when the timer counts up to “7”.

I don’t think you actually need to communicate with Nights Player unless you have to for some other reason. This is what I would do:

2 Likes

For owning player I think you can just connect “Get Player Character”

1 Like

That worked perfectly. I initially thought it would be done in the timer blueprint but I overcomplicated everything for no reason and confused myself. Thank you for the help!

1 Like

No problem! I’d definitely check out Ryan Laley on YouTube. He has a video about just about every Unreal problem you can think of.

Then this other guy Matthew Wadstein (I think?) has a series that just explains what any given node does in blueprints. His videos are for unreal 4 but they mostly apply to 5 as well.

1 Like