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"

progress bar isn't filling properly

I have a progress bar that serves as an enemy's health bar, but the bar won't move until the enemy gets to 1/3 health, at which point the bar will completely white out.I used print strings to figure out that the variable that I set my fill percent is the right value. at 100% health, the variable is 1, at 2/3 health, the variable is 0.666666, at 1/3 health, the variable is 0.333333, and at 0% health, the variable is at 0. The health bar's color is being properly set after being damaged too. I have no idea what's going wrong. Here's some screenshots.

alt text

alt text

alt text

Product Version: UE 4.21
screenshot-10.png (332.0 kB)
screenshot-11.png (479.5 kB)
screenshot-12.png (410.2 kB)
screenshot-13.png (550.4 kB)
screenshot-14.png (619.8 kB)
more ▼

asked Dec 02 '18 at 12:18 AM in Using UE4

avatar image

1 1 2

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

1 answer: sort voted first

instead of being redundant and complex why not just go for a simpler solution of passing a character reference to the widget and let that do the work. im assuming here that your aim is to have the healthbar update to reflect the characters health and have the bar change color depending on the health level. if thats the case then you can really boil it down to two functions in the widget, one function will provide info to the other so its pretty simple.

as you can see in the picture below i have a healthbar widget (HHHHHH) with two variables CharRef which will be a reference to the character and HealthNorm which is the normalized health value. first we create a binding for the progress bar (GetPercent0). this binding takes the character reference variable and gets the health and max health variable, then normalizes them to range which gives us a 0-1 value, then we set the HealthNorm variable and we are done. do note i set the char ref variables type to the class of my character (thirdPersonCharacter) so i didnt need to cast. the next objective to tackle is the color changing which is done through the second binding function. here i just took the health norm variable and used it as the alpha for a linearColor lerp. the only other step is the setting of the character reference variable but i didnt show that since you seem to know how to set a variable in a widget (drag off the return pin of the create widget ans search for the set variable)

alt text

capture.png (274.8 kB)
more ▼

answered Dec 02 '18 at 12:54 AM

avatar image

10.1k 33 10 25

avatar image TheANSER-42 Dec 08 '18 at 03:46 AM

Thank you for the response. It turns out, though, that this method does work (I did end up cleaning it up a bit). The real issue is that the widget was cutting off most of the progress bar

(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