How do I make a health widget that is shared between multiple playable characters?

I want to make a health widget for the view port that is shared between multiple characters at the same time, but I don’t know how to make them share the health. Also, I would appreciate if you could include how to make them not take damage when unpossessed, but the shared health is what I really need help with.

Hello @Turts.p ,

If you want to make the health is shared between multiple char, you can save the Health related variable in the class that still the same even tough you are switching between char like Game Mode class, player controller also doable (might not work if you use different player controller possessing), or maybe game instance. When you take the damage, just reduce the health from the class that stored your health variable.

Also for your second question, you can prevent the not possessed or uncontrolled character by checking it first on the TakeDamage. Is this class is the possessed character or not, if it is then damage, if it is not just ignore. You can do that by also store the possessed character pointer in the game mode / the same class you store the health, and check it whether its matching or not in take damage.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.