x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

UI screen:

alt text

Product Version: UE 4.14
Tags:
1.jpg (62.6 kB)
2.jpg (25.2 kB)
more ▼

asked Jun 10 '17 at 04:45 PM in Blueprint Scripting

avatar image

Jacobs89
12 6 8 8

avatar image Jacobs89 Jun 10 '17 at 04:48 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first
  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 alt text

Widget > event graph alt text

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,

more ▼

answered Jun 10 '17 at 08:52 PM

avatar image

navid100
991 29 14 46

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey Jacobs,

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

alt text

cooldown.png (67.6 kB)
more ▼

answered Jun 10 '17 at 04:55 PM

avatar image

Sertac Ogan
1.5k 30 10 46

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question