So I’m trying to change the progress bar value in a widget blueprint via a character blueprint. After debugging and debugging, I found out that, by using the exact same method, I am able to set percent in Begin Play but not in Event Tick. Does anyone know what I’m doing wrong?
I have Set Percent in Tick its just the widgets Tick and not external from another blueprint. the widget gets a ref to owner in construct and use that to spy on the health values.
Have to test a few things, sorry might be redundant since we don’t know what you did during “debugging and debugging”
Break the wire on Tick and drag a wire to print string and drag a wire from HP to print string.
Do you see HP’s decrease value on screen on health loss?
If you see HP going down then you may want to add event to health bar’s graph called SetProgress add a input for float Percent. Then in your Enemy BP tick call the event on HealthBarRef passing in the percent as you have already. If that don’t work maybe a interface will.
Print or Watch (RMB the variable pin) both values during Tick - what do you get?
Hey thanks everyone for replying. So previously I made sure that my HP variable get updated as needed (e.g. enemy takeDamage()), but when I try to print out HP value in Event Tick it didn’t get updated. Very wierd! I thought it has to do with certain variable scope issues. It turns out I was trying to implement this in a parent blueprint class, and I forgot I have my child blueprint already implemented Event Tick without calling the parent function.
So problem solved, it got nothing to do with the widget, progress bar, nor variable scope, I simply forgot to call parent Event Tick in child class.
Thanks for helping! It turns out I was trying to implement this in a parent blueprint class but forgot I already have Event Tick implemented differently in my child blueprint classes. So all i have to do it just call parent function in child classes.