Cooldown progressbar

Hey there!

So we’re making a game (student project), and we’re a bit stuck at the visuals of cooldowns.

The way we want to set it up is quite simple. We have a UI that shows the spells (triggered by buttons, not clicked), and we want to put a progressbar with opacity on top of each spell, so that when you use a spell, it shows a progress bar that lets you know when the spell is ready again.

The questions is, how do we make the progress bar “count down” (or fill up, whichever) when we i.e. press the button: 1 ?

We need the possibility to adjust the cooldowns when playtesting, so a variable (integer or float?) with the value of the cooldown should be possible?

I added a picture of what we were working on in the UI widget, inside the bound function.

UI screen:

190380-2.jpg

And the part where it resets, so that it’s ready to show the visual for the cooldown again is important.

Hope someone knows the logic for this!

Best regards,
Mats J

  1. Create 2 Float variables and 1 Boolean for each of your spells (AbilityCooldown & AbilityCooldownMax & IsSpellReady) and set
    AbilityCooldown = AbilityCooldownMax.

  2. Choose an initial value for AbilityCooldown & AbilityCooldownMax (in seconds), like 60.

  3. Follow my sample graphs.

Widget > bound function

Widget > event graph

When the countdown finishes, wait for the next cast and set the
AbilityCooldown = AbilityCooldownMax & SpellIsReady to False. Follow this loop. To have a text to show cool-down, all you need is to; bind the text to a function > get the ‘AbilityCooldown’ float variable inside the text function > convert it to text (float to text) > and plug it into the return node and you are done.

Note that in my graph, after ‘SpellIsReady’ is set to true, I have set the AbilityCooldown = AbilityCooldownMax. But you should first wait for the cast after the boolean and if the character cast the spell, then you should set the AbilityCooldown = AbilityCooldownMax. Which means there must be some nodes in between the last two nodes, although you can follow the same setup and instead of checking if the player has cast the spell, just make the cool-down invisible and make it visible again as the character cast that spell.

You can store spell cool-down variables inside other BPs (like game stat) if you like then by casting to those BPs, get the values and follow the graph.

Regards,

Hey Jacobs,

I share screenshot for your. Progresbar percent is must 0 to 1. Then map range function is usefull.