Focused reference · Unreal Engine 5.8
Calculations and action patterns
Direct damage with a meta-attribute
- Source ability creates an Instant damage effect spec.
- Supply raw damage through a configured modifier or SetByCaller tag.
- Execution calculation captures required source/target values and computes mitigated damage on authority.
- Write the result to transient
IncomingDamage. - In
PostGameplayEffectExecute, consume IncomingDamage, set it back to zero, subtract from Health, clamp, and signal death only on the valid transition.
The meta-attribute keeps transient inputs separate from persistent Health and centralizes post-damage rules.
Healing
- Create an Instant effect with a positive health change or IncomingHealing meta value.
- Apply on authority with source context.
- Clamp final Health to MaxHealth.
- Emit UI/gameplay reactions after final value is known.
Timed buff
- Create a Has Duration effect.
- Add a modifier to the target Attribute.
- Configure duration and stacking explicitly.
- Add owned/status tags through the current Gameplay Effect component model where needed.
- Apply and retain the active effect handle only if a later targeted removal needs it.
- Verify attribute returns exactly when the effect expires/removes.
Equipment or passive modifier
- Create an Infinite effect per coherent source or bundle.
- Apply when equipped/granted.
- Store
FActiveGameplayEffectHandlewith the runtime equipment/passive instance. - Remove by that handle on unequip/revoke.
- Test duplicate equip, load restore, owner change, and removal order.
Regeneration
Choose one model:
- periodic Gameplay Effect for discrete authoritative ticks;
- continuous modifier if the Attribute semantics support it;
- server-owned timer/system applying instant effects.
Define delay after damage, period, first tick timing, max clamp, stacking, and pause/block tags. Do not add per-character Tick without a measured need.
Max-value change
Pick and document one policy:
- preserve absolute current value, then clamp;
- preserve percentage:
NewCurrent = OldCurrent / OldMax * NewMax; - apply the same delta to current and max;
- refill on increase.
Implement deliberately; no policy is universally correct.