Health Component
Last updated
Last updated
The health component is how we manage Player health. We can use it to keep track of the current amount of health on an actor that implements it, as well as handling whether the owner should be considered "Alive" or "Dead".
This component is already attached to blueprints that extend from BPM_M2_PlayerCharacterBase.
This component may also be added to any other Morpheus Actor that requires health tracking.
The following events can be implemented anywhere that has access to a Health Component. It is important to be aware that these events only fire for actors in the Foreground or Midground network levels.
"Triggered on a client when they take damage"
You might choose to use this for updating UI or playing a visual/audio effect.
"Triggered on a client when their health increases"
"Triggered on clients when a player dies"
The following are some of the key functions you may wish to use within the component.
"Returns true if the owner is marked as "Dead"" Value returned is valid regardless of network level.
"Returns the current amount of health" Value returned is only accurate in Foreground and Midground.
"Returns the maximum amount of health" Value returned is only accurate in Foreground and Midground.
"Increases current health. To be called by auth client" You might use this to implement health pickups or a healing ability. If you wish to have one player add health to another player, they will need to initiate this via a client RPC.
"Reduces current health. To be called by auth client." If you are using the Combat Component, you will likely use this on successful validation of a shot to apply damage to the target player.
"Restores owner to to full health and can be used to revive the owner if dead"
Can only be called from auth client. Passing true
for the Revive
param will change owner from Dead to alive, and restore all health. False will only restore health if owner is not Dead.
This is called automatically on respawn for Morpheus Characters inheriting from BPM_M2_PlayerCharacterBase
.
Events for On Damage Taken
, On Health Increased
and On Player Died
are not triggered on Morpheus Actors that are only checked out in the Background network level.
While no event is fired, we are able to check IsDead
in the Background as there is a duplicated value for death, meaning this value will be accurate across all network levels.
Does not support blocking the health from increasing, only decreasing (via bCanTakeDamage
)
The Health Component will react to respawning if attached to an actor inheriting from AJM_CharacterBase
but it does not control this behaviour.
When attached to an actor of type AJM_CharacterBase
the component will call ResetHealth_Auth
when respawned.