Access to variables in a widget blueprint

Hello everyone,

I’ve run into a problem that I can’t get my head around. Base is the top down game template and the topic is about UMG widget blueprints.
I’m currently trying to do the following: Whenever I hover my mouse cursor over a test-NPC, the NPC shall become highlighted (via an emissive fresnel material) and a very big, easy to see healthbar (a progress bar) right on top of the screen, exactly like in Diablo or Sacred.
Now here’s the problem: The highlighting itself works just fine - there’s a nice emissive glow around my dummy character and his healthbar is popping up on the top middle of the screen, right where I want it to be.
But I can’t get the progress bar to be bound to the characters health. It appears always to be completely empty, as if the NPCs health was 0.
The health of the NPC is specified in it’s blueprint via two float variables: MaxCharHealth and CurrentCharHealth, both of which are currently set to 100. I’m pretty sure the problem lies somewhere here:

What startles me the most is the fact that I used a similar setup for my player character, and that’s working just absolutely fine - full healthbar, updates (gets empty when the player takes damage, etc), everything exactly as it should be.
I think there has to be some astoundingly dumb failure right in front of me that I managed to miss somehow.^^

Thank you very much in advance and sorry for my English.

The problem here is that you are casting nothing to your TEST_NPC. So it will always fail. Do you have one widget for each NPC? Where is this widget created? If you are spawning your widget into your NPC blueprint, you can add a variable in your widget. Let’s call it, for example, “Owner”. Expose it on spawn and it will be visible in your “Create Widget” node. So you can set this variable to the NPC that is spawning this widget. Then your “GetPercent” function will take the “Owner” and retrieve his current health, without need of the cast.