Generic, extendable and easy to use health system for any game.
Health Component is part of Game Dev Tools Plugin.
Features
- Before dying state, (eg Like in Doom when you need to do finisher)
- Health recovery by dealing damage (eg like in Dead Cells. You can recover some HP when dealing damage)
- Health draining,
- Health regeneration,
- Keep track of last damage,
- Damage multiplier,
- Helper functions: GetHealthRatio, ConfigureHealth, RefillHealth, IsDead, SetRegen, SetDrain, GetRecoverHealthRatio, AddRecoveryHealth, IsInrecovery, IsInBeforeDyingState, GetOutBeforeDyingState, GetLastDamageData, GetTimeAfterReceivingLastDamage,
- Works with Damage System
Documentation
Example Map
Example map can be found here:
\Plugins\GDMegaPack\Content\Health\Maps\Showcase_GDHealthAndDamage.umap
Adding Health Component
Just add Health Component in your Actor Blueprint:
Health Events
Apply Damage to Health
Just use TakeDamage function:
Should Regenerate
Should health regenerate by time. Can be triggered in game using function SetEnableRegeneration.
Regeneration Speed
How fast health will regenerate if using regeneration.
Regeneration Threshold
Holding threshold of Max Health to regenerate to. Value from 0 to 1.
Regenerate when in Before Dying State
Should regenerate event when in before dying state. By default set to false.
Should Drain
Should health drain by time. Can be triggered in game using function SetEnableDraining.
Drain Speed
How fast health will drain if using draining.
Drain Threshold
Holding threshold of Max Health to drain to. Value from 0 to 1.
Drain Activate Before Dying State
Should drain activate before dying state (if using before dying state) By default set to false.
Use Health Recovery by Damage
Should use health recovery by dealing damage. Part of health can be recovered after health change. For example Dead Cells is using such feature.
Health Recovery Decrease Speed
How fast recovery will decrease.
Health Recovery Damage Ratio
How much health we will add when dealing damage while in recovery. It is using damage amount ratio. (for example if you hit someone by 15 damage you can regenerate X of the damage while being in recovery)
Use Before Dying State
Should use before dying state which can be used for finishers like in Doom. Basically health component will trigger dispatcher when activated. You can react to it as you want.
Before Dying State Threshold
When before dying state should trigger. Using Max Health ratio from 0 to 1.
Max Before Dying Count
How many times can go to Before Dying State. If 0 means infinite.
Health to Add After Before Dying State
How much health should be added when going back to normal state. Going back to normal state can be triggered by calling DisableBeforeDyingState. Example can be found in ShowcaseActorWithHealth.
Can Health be Changed During Before Dying State
Holds if health can be changed (eg takedamage) during before dying state. By default set to true.