I want to implement a floating health bar system across many actors, such as other players, NPCS and destroyable static objects, but I’m not sure how to go about doing it.
I’ve already got player health in my HUD, but I’m trying to figure out how I can implement a system so that other players or objects only show health to the player who applies damage to them (If I can do so with the InstigatorController in the ReceiveDamage() function even better)
Does anyone have a solution? I’m guessing the client who does the damage would have to create the widget, but I have no idea how I would go about anchoring that widget to the actor who the health belongs to and I feel like I’m travelling through quite a few layers (I have to get the other clients health information to the client who owns the widget so they can build it on their screen).
Any pointers, videos or resources welcome. Thanks
Edit: Just showing the implementation of player health
When damage is received on a client, if the instigator is a locally controlled player controller, then set the visibility of the widget component to true.
I still don’t fully understand why, I think I missed a intermediary function in my C++? Not sure but I’ve spent around 6 hours on getting this little health bar to work so I’m v happy.
edit: Still wondering how I get it to show for the attacking player, but not the player being attacked. I already have a HUD health bar and it clogs up the screen a bit for the victim
edit2: nevermind I managed to do this with a client RPC to hide after multicasting the visibility