I have an enemy parent class with a widget bp class. Creating multiple children of the enemy does not allow the widget to work because i have to cast to parent health bar widget in parent enemy. The child enemys are still casting to the parent health bar. I tried creating children of the widget class and setting it in class defaults. Ive tried many work arounds. The main thing im trying to accomplish is different health values for different children, along with other attributes.
Other than manually creating a seperate widget for each child enemy and adding the logic for health and health bar, i cant think of any way to get around this. I have watched too many tutorials and been through so many google searches. Cant find any help on this. There has to be a way to do this. Any help is greatly appreciated!
No i think you get it. What you describe is exactly what i want to do. The tutorial you posted is actually exactly the tutorial i used to create the widget.
There are 2 issues. The first problem is that the children do inherit the health bar (it is visibly there), but only the parent health bar updates. The child health bars do not update at all, however their health system does work because i can kill them when i hit them enough.
The second problem is that i want the children to have different max health from the parent. I do this by adding a BP structure with a health float variable that can be edited in the class defaults of each child. Again here, this works on the enemy, because if i change the health value from like 100 to 10, they die faster as expected, but the widget stays full.
I attempted to fix this by making children of the widget. The effect is still the same. I just feel like it should work and i have no idea what im missing here. Either way i appreciate your reply and any further guidance you could offer.
One more quick note. In the parent enemy, i have to cast to the healthbar widget to update it. Thats the only place where a cast occurs. I know i said it weird.
Yea it does. I just cant make it so that i could set a childs health the be different without having half-full or over filled healthbars. I made a work around by setting a variable in the parent class struct that modifies the health variable for the parent, whick i can manipulate in the children. Its not what i was hoping for but it works. Thank you for trying to help!!