Countdown Timer

This was fun so I thought I’d add a lame debug countdown with this little abomination.


Changing the time to one second in the debug made this display perfect.

Obviously, this was not a scalable solution so I wanted to use a loop.

Unfortunately, this is infinite. What did I do wrong?

This is due to a limitation in how the Delay node works. It isn’t meant to be used within function or loop bodies. I’ll spare you the details here but I encourage you to do a little research into why that’s the case.

You actually don’t need a loop at all - what you want to use in this case is a Custom Event. For example, this bit of BP code will print your “Restarting in x seconds…” message, delay for a second, and then call the event again unless the timer has reached zero (in which case the level is restarted):

To trigger the delay initially, you can just call the same event after the “Out of ammo!” message like so:

image

Hope that helps. =]

Edit: Updated the first image - the Make Literal String function was redundant.

1 Like

This worked great and makes perfect sense. Thanks for the clarification on the Delay node. That does make me curious.

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

Privacy & Terms