Skip to content

3. Health Resource

Cutter Hodnett edited this page Nov 9, 2024 · 1 revision

Health Resource (child of Resource Component Base)

#include "Components/Health/HealthResource.h"


Dispatchers

  • OnGenericDamageTaken
    • Called on ApplyDamage when Point or Radial is not used.
  • OnPointDamageTaken
    • Called on Point damage taken.
    • HitLocation and BoneName were removed due to the max number of variables, but these are in the FHitResult.
  • OnRadialDamageTaken
    • Called on Radial damage taken.
  • OnModificationDataAdded
    • Called when a modification data is added.
  • OnModificationAdded
    • Called when a modification is added
  • OnModificationRemoved
    • Called when a modification is removed

Variables

  • Default Modification Data DamageModificationData
    • A data asset that will be added on BeginPlay.
    • If any were added to the initial ModificationRules array, these will be added afterwards.
  • Modification Rules FIncomingDamageModification<array>
    • Modifications that will be considered when receiving damage.
    • These modifications will be executed in array order.
    • If the method Override_Health is used, then all other modifications are skipped.
  • Last Damage Causer Actor
    • Last Actor that damaged the owning actor.
  • Last Location Hit From Vector
    • Location where the last damage was taken from.

Functions

  • FIncomingDamageModifications GetCurrentModifications()
    • Returns all current modifiers.
  • Bool HasModifications()
    • Returns true if this has any of the listed modifications.
  • float GetDirection (Vector Direction,Rotator BaseRotation)
    • Returns a float that dictates direction. This functionality was ripped from the Get Direction node seen in Animation Blueprints.
  • float GetDirectionToLocation(Vector Location, Rotator BaseRotation)
    • Alternative to GetDirection if you want to check against a location rather than a direction.
  • float ModifyDamage(float damageReceived, EIncomingDamageChannel damageChannel, DamageType DamageType, Name boneName, Vector damageOrigin)
    • Modifies the incoming damage based on current modifiers. If overridden without a parent node then functionality must be manually implemented.
  • bool ModificationAcceptsDamageType(FIncomingDamageModification modification, DamageType damageType)
    • Returns true if the damage type is utilized by the modifier. If no damage types are whitelisted, the modifier accepts all.
  • GiveModifier(FIncomingDamageModification newModifier,int insertAt)
    • Adds a modifier at the given index. If the index is -1 the modifier is added at the end.
  • GiveModificationData(DamageModificationData modificationData, int beginInsertAt)
    • Adds all modifiers from the data at the given index. If the index is -1 the modifiers are added at the end.
  • RemoveModifier(Name modifierName)
    • Removes all modifiers with this name
  • BindDamageDelegates
    • Used to override Bindings for OnGenericDamageTaken, OnPointDamageTaken, and OnRadialDamageTaken. Called at Beginplay.

Notes

  • If BindDamageDelegates is overridden without binding the 3 core dispatchers, the original functionality with modifications may be broken. OnGenericDamageTaken, OnPointDamageTaken, and OnRadialDamageTaken each are bound to a function that calculates damage based on the modifications.

Clone this wiki locally