Attributes
Module PulseAttributes (Gameplay Ability System). Health, shield and stamina as attribute sets with regeneration and view models, usable on their own: food that restores health, a potion, falling damage or a survival game without weapons need no combat system. The combat system (PulseCombat) builds on these sets.
Attribute sets
| Set | Attributes | Notes |
|---|---|---|
UPulseHealthAttributeSet | Health, MaxHealth, Shield, MaxShield, HealthRegenRate, meta IncomingDamage, IncomingHealing | Damage takes the shield first, then health. Values are clamped (health 0..MaxHealth, MaxHealth at least 1); a lower maximum pulls the current value down. Health 0 is never healed. The rules are pure functions on FPulseHealthPools (see below). |
UPulseStaminaAttributeSet | Stamina, MaxStamina, StaminaRegenRate | For costs (normal GAS cost effects). Native event OnOutOfStamina. |
Give a set to an ability system like any attribute set: a default subobject of the owner, AddAttributeSetSubobject, a PulseSkill grant, or Default Attribute Sets of the combat component (PulseCombat). Default Starting Data of the ability system component only creates sets that also have a data table. Both sets replicate to every client.
Damage and healing without combat
- Damage: any instant effect that adds to
IncomingDamage. The set reports what happened withOnDamageReceived(FPulseHealthChange: amount, shield part, health lost, shield broken, depleted, instigator, causer, location) andOnOutOfHealthonce when health reaches 0. A system on top can attach own data withSetPendingPayloadright before the damage is applied; it arrives asFPulseHealthChange::Payload(PulseCombat sends itsFPulseDamageResultthis way). - Healing:
Pulse::Attributes::ApplyHealing(Blueprint Restore Health) or own effects that add toIncomingHealing.UPulseHealEffecttakes the amount from the set-by-caller tagPulse.Attribute.SetByCaller.Healing. - Regeneration:
UPulseHealthRegenEffect(every 0.5 sHealthRegenRate) andUPulseStaminaRegenEffect(every 0.25 sStaminaRegenRate) are infinite effects; apply them once. The tagsPulse.Attribute.State.RegenBlockedandPulse.Attribute.State.StaminaRegenBlockedpause them (the combat component pauses health regeneration after damage and stamina regeneration while dead).
Health rules without an ability system
FPulseHealthPools (Attributes/PulseHealthPools.h, no GAS include) holds health, maximum health, shield and maximum shield as plain values. The rules of the health set are functions in Pulse::Attributes: ClampHealth, ClampMaxHealth, ClampShield, ClampMaxShield, ClampPools, ApplyDamageToPools (shield first, never below 0, the dead take nothing; fills an FPulseHealthChange), ApplyHealingToPools (up to the maximum, the dead are not healed) and DescribeAppliedDamage. Targets without an ability system (build pieces, resource nodes) use them for the same behavior. The set plans with them and reports the values it reads back, so duration and infinite modifiers count (a temporary shield that stays above 0 is not broken). Specs: PulseAttributes.Pools.
Replication: the sets replicate with the push model. Ability system writes, base value changes (PostAttributeBaseChange) and InitFromMetaDataTable (Init Stats) mark the attributes; code that calls an Init<Attribute> accessor after the first replication must mark the attribute itself (MARK_PROPERTY_DIRTY), or set it through the ability system instead.
View models
UMVVMPulseAttribute shows one attribute of any set (Attribute, optional MaxAttribute): Value, MaxValue, Percent. With the Pulse Player View Model Resolver it follows the player’s pawn, also after respawns; SetSource shows any actor. When an actor gets its ability system later, call Pulse::Attributes::NotifyAbilitySystemReady so view models bind (the combat component does it by itself). HasAttribute (field notify) tells whether the source has an attribute set with Attribute, so a bar can hide without it; the Pulse Attribute Bar of Status effects and attribute bars is built on this view model.