Health Component

Experimental - Usable, but you must talk to us to understand the implications

Overview

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".

Integration

If you extend BPM_M2_PlayerCharacterBase or create a new blueprint instance from the AJM_CharacterBase class, this component will already be attached.

This component may also be added to any other Morpheus Actor that requires health tracking.

Usage

Events

The following events can be implemented anywhere that has access to a Health Component. It is important to be aware that these events currently only fire for actors in the Foreground or Midground network levels.

Event - On Damage Taken

"Triggered on a client when they take damage"

You might choose to use this for updating UI or playing a visual/audio effect.

Event - On Health Increased

"Triggered on a client when their health increases"

Event - On Player Died

"Triggered on clients when a player dies"

Functions

The following are some of the key functions you may wish to use within the component.

Function - IsDead

"Returns true if the owner is marked as "Dead"" Value returned is valid regardless of network level.

Function - GetCurrentHealth

"Returns the current amount of health" Value returned is only accurate in Foreground and Midground.

Function - GetMaxHealth

"Returns the maximum amount of health" Value returned is only accurate in Foreground and Midground.

Function - AddHealth_Auth

"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.

Function - TakeDamage_Auth

"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.

Function - ResetHealth_Auth

"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 AJM_CharacterBase.

Limitations

  • 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.

    • To understand more about respawning characters please go to Respawning - Characters

Last updated