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.
asked Jun 10 '17 at 04:45 PM in Blueprint Scripting
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.
I share screenshot for your. Progresbar percent is must 0 to 1. Then map range function is usefull.
answered Jun 10 '17 at 04:55 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here