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.
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)
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