Hi,
I would like to update an image in the widget based on the health.
By trying a lot of different methods I found out that the problem is the event any damage.
The health is being passed correctly.
Can you please help me out, I’ve been stuck for 3 days now.
Thanks!
Hey @RafaLeao,
To help get the ball rolling, what are you using to set up the interaction? A blueprint interface? It’s a bit hard to see with the glare. Could you provide screenshots instead of pictures taken from a different device?
Are all PrintString() nodes hit correctly? Most importantly are the “Green”, “Yellow” and “Red” ones triggered?
Also, what is the type of the HealthColor var?
And yeah, as @Quetzalcodename said, screenshots will be much appreciated.
yes all the printstrings work perfectly and the type of Healthcolor is an image type.
I’ll send the screenshots right now.
sorry for the low quality screenshots.
This is my widget blueprint where i set the event to change the image texture based on the health.
This is my widget where you can see the image i want to update.
This is my ThirdPersonCharacter BP where I call the ‘UpdateHealthColor’ Event.
All the printstrings you see on the Widget BP are printed correctly and even the health is updating correctly.
The problem I found is that the EventAnyDamage is not letting me update the texture.
I tried making the ‘UpdateHealthColor’ Event on the ThirdPersonCharacter BP and didnt work.
I tried making the ‘UpdateHealthColor’ Event but instead of taking the health variable as input I casted to the ThirdPerson BP and checking the health but the health will not update.
The screenshot below is a test I made to check if the ‘UpdateHealthColor’ Event was the problem but it’s not, because it worked.
If you are hitting the PrintStings that means your logic is good.
That means you are going through SetBrushFromTexture and it does not work.
Are you sure that GreenTex, YellowTex and RedTex are correctly set and not overridden at any point?
Can you try replacing the SetBrushFromTexture with SetBrushTintColor and say if it works?
Still don’t work.
I’m 99% sure that GreenTex, YellowTex and RedTex are set correctly because on the last picture I sent on the last reply, the image is updating.
Could It be that EventAnyDamage is the problem?
If EventAnyDamage is the problem you wont be getting the first print of the health in the Damage comment.
That’s why I asked do you get all the print strings.
Also. in the damage event you don’t get the damage that comes with the event but you are using some local damage.
You think Local Damage could be the problem?
I don’t know. It’s just something I’ve noticed. Does the PrintString after the Set Health node fire?
yes, every print string you see is firing.
everything is working perfectly except for the set brush from texture.
That means you are going through. Which means that only your SetBrushFromTexture nodes don’t work.
You’ve replaced them with SetBrushTintColor nodes (to exclude the textures as a point of failure) and still - no success.
Check if your HealthColor is valid or PrintString its display name in the UpdateHealthColor event.