Download

Widget for Enemy Health does not work

Hey, I have been struggling with this for a few days.
So I have an enemy blueprint to which I added a widget component, and selected my EnemyHealth widget blueprint as a class.
My max health variable is stored in a map within a data table row. Maybe this is causing some problems?
Within the widget blueprint I look for this max and current health then return them like this:

Here the progress bar is bind to this function. I tried many other ways. Creating a separate variable for health percentage, updating it and that didn’t change anything.
Do you have any ideas?

note: I am using the free jRPG template from the Unreal Marketplace

How are you setting “BP Enemy Base”?

I am referencing the BP Enemy Base in the widget blueprint to get the stats. But the widget blueprint is attached to BP Enemy base

Have you try locating where the error may be?
What happens if you use inject a float value directly into the return node?
What happens if you use inject a float value directly into the division node (first in the numerator, then in the denominator)?

Seems like the error comes from Get Data Table Row DT_jRPG_Enemies, when I inject floats into the return or division node it is displays the correct value. I am new to Unreal Engine and can’t figure out what is wrong with Getting the Data Table row.

edit: I am getting an accessed none error for Get Data Table Row

And if you manually select the “Row Name”?

Same, when I manually select the row name, gives me the accessed none error

Can you provide us with a screenshoot with the problem?

Yes. So this is the Error:


This is BP Enemy Base, that is referenced to access AC JRPG Character stats:

to this Blueprint I added a widget component, its class is this Widget blueprint:

This is AC JRPG Character stats component it is inherited by all characters, I try to use this to access a characters name which is used to find a row in the Data Table:

I don’t see how you’re setting the “BP Enemy Base” value in the widget. The problem is not with the table but with that reference.
In the Enemy Base, you must set that variable.
Here is an example:

Consider the “Owner” var as the your “BP Enemy Base” var in the widget:

You have to set that var it in the BP, like this:

Thank you for your response, I tried to follow your guide but I have the same result as earlier.
Enemy BP:


Widget BP:

Did I miss something?

Hi there,
I’m not sure if that cast is actually working. Can you attach a print string to Cast Failed and see if you get Hello?

Hi I connected a print string to Cast failed and I didn’t get the Hello string in the logs.

However, when I add a print string to Get Data Table Row, in the widget blueprint I do get the Hello message. It seems the problem is still there

Just to be sure, check if BP Enemy Base reference in the HUD is valid:

It managed to get it done!
Thank you for everyone who replied. I am not exactly sure what the problem was. I basically restarted from the beginning, created widget component, and then the blueprint and now it works as intended. I followed @EvilCleric’s instructions. I might have made a mistake somewhere and did not notice it!