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"

Help creating a health widget that ticks down when damage is taken.

Hi,

I'm trying to create a health widget that ticks down past each integer of health when damage is taken. For example 100-90 health would display a quick flash of 99 then 98 then 97 e.t.c. I was just wondering if there is any way to do this solely in UMG or would I have to create a function to tag on when taking damage that runs the health down through each number?

Many Thanks!

Product Version: UE 4.17
Tags:
more ▼

asked Aug 19 '17 at 03:22 PM in Blueprint Scripting

avatar image

JMaestro
1 1 4

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

2 answers: sort voted first

If I understand, you want to display every point lost when damage is taken. Try something like this in your widget :alt text

Just set "currentHealth" with the health before damage, "HealthAfterDamage" with... the health after damage and set All Point Was Lost to false. you can set up the display speed with the "speed" variable.

more ▼

answered Aug 21 '17 at 05:52 PM

avatar image

Lunder
88 2 4 4

avatar image JMaestro Aug 22 '17 at 03:18 PM

Thanks! I didn't use your template exactly but it game me inspiration on how to do it so much appreciated! I ended up using an if Health and New Health are not the same, run a loop with the difference in health as the last index, added a delay and set Health -1 for the loop body. My health widget is already bound Health so it shows the ticking down health as it tuns through the loop. Can adjust the speed of ticking health by either changing the delay time of setting the Health to minus a higher number.

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

In the widget displaying your health bar or wherever you want the number to display add a text widget with the properties for font and size set to what you want. Set the visibility to collapsed or hidden.

When you update the health value set the hidden widgets text to the same value and set to visible and start an elapsed time variable. During Tick check to see if the elapsed time has expired and set the text widget back to collapsed. This will display the value for the elapsed time then hide it until you need it.

more ▼

answered Aug 21 '17 at 06:52 PM

avatar image

cmarston74
296 6 7 10

(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