#
API Reference
AfterPrime Systems | AP Attribute Suite | Version 1.0.0
#
Contents
#
Enums
#
EAP_ModifierType
Controls how a modifier affects an attribute's EffectiveMax.
Evaluation order:
Base MaxValue
→ sum all Additive modifiers
→ apply Multiplicative modifiers sequentially
→ Override replaces result entirely (if present)
→ clamp to >= MinValue
#
Structs
#
FAP_AttributeDefinition
One row in a UAP_AttributeSet DataAsset. Defines a single attribute's starting configuration.
#
FAP_AttributeModifier
Blueprint-facing modifier definition. Pass to AddModifier to alter an attribute's EffectiveMax.
#
FAP_AttributeModifierHandle
Blueprint-safe wrapper returned by AddModifier. Pass to RemoveModifier to remove a specific modifier.
#
FAP_AttributeSnapshot
Full state dump of one attribute. Returned by GetSnapshot.
#
UAP_AttributeSet
Type: UDataAsset
Category: AP Attribute
A data asset defining a collection of attribute definitions. Create in the Content Browser: Right-click → Miscellaneous → Data Asset → AP_AttributeSet.
#
Properties
Assign one or more UAP_AttributeSet assets to the component's AttributeSets array. Multiple sets are merged at BeginPlay.
#
UAP_AttributeSuiteComponent
Type: UActorComponent
Display Name: AP_AttributeSuite
Category: AP Attribute
Add this component to any Actor Blueprint via the Components panel. All attribute state is authoritative on the server and replicates to clients via FastArray.
Authority Model
All mutation methods require server authority. All query methods are safe to call on any machine — attribute state (CurrentValue, EffectiveMax, MinValue) replicates via FastArray.
#
Properties
#
Delegates
All delegates are BlueprintAssignable.
Multiplayer Binding
OnAttributeChanged, OnAttributeDepleted, and OnAttributeRestored fire on both server and client. Bind on both — do not gate behind HasAuthority.
OnModifierAdded and OnModifierRemoved fire on the server only. Gate these bindings inside Switch Has Authority.
#
OnAttributeChanged
Fires after any mutation to CurrentValue — on server after state mutation, on clients from FastArray replication callbacks.
Client OldValue
On clients, OldValue is derived from a client-local cached value set during the previous replication callback — it is not transmitted from the server.
#
OnAttributeDepleted
Fires when CurrentValue reaches MinValue. Edge-detected — fires only on the transition from above-minimum to at-minimum. Will not fire again until the attribute is restored and depleted again.
#
OnAttributeRestored
Fires when CurrentValue rises above MinValue after being depleted. Edge-detected — fires only on the transition from at-minimum to above-minimum.
#
OnModifierAdded
Server Only
Fires when AddModifier succeeds.
#
OnModifierRemoved
Server Only
Fires when a modifier is removed via RemoveModifier, RemoveAllModifiers, or timer expiry.
#
Query Functions
Server + Client BlueprintPure
#
GetCurrentValue
float GetCurrentValue(FGameplayTag AttributeTag) const
Returns the current replicated value. Returns 0.0 and logs a warning if the tag is not found.
#
GetBaseValue
float GetBaseValue(FGameplayTag AttributeTag) const
Returns the base unmodified value defined in the DataAsset.
#
GetMaxValue
float GetMaxValue(FGameplayTag AttributeTag) const
Returns the effective maximum after all active modifiers. Reads the replicated EffectiveMax.
#
GetMinValue
float GetMinValue(FGameplayTag AttributeTag) const
Returns the minimum value for the attribute.
#
GetNormalizedValue
float GetNormalizedValue(FGameplayTag AttributeTag) const
Returns CurrentValue / EffectiveMax clamped to [0, 1]. Returns 0.0 if EffectiveMax is zero. Use directly to drive progress bars.
#
HasAttribute
bool HasAttribute(FGameplayTag AttributeTag) const
Returns true if this component owns an attribute with the given tag.
#
GetAllAttributeTags
Returns all registered attribute tags on this component.
#
Mutation Functions
Server Only
#
ApplyDelta
void ApplyDelta(FGameplayTag AttributeTag, float Delta)
Adds Delta to CurrentValue, clamped to [MinValue, EffectiveMax]. Negative deltas restart the regen delay timer. Fires OnAttributeChanged. May fire OnAttributeDepleted or OnAttributeRestored on state transitions.
#
SetCurrentValue
void SetCurrentValue(FGameplayTag AttributeTag, float Value)
Directly sets CurrentValue, clamped to [MinValue, EffectiveMax]. Fires the same delegates as ApplyDelta.
#
SetBaseValue
void SetBaseValue(FGameplayTag AttributeTag, float Value)
Changes the base value. Recomputes EffectiveMax and clamps CurrentValue if it exceeds the new max.
#
ResetToBase
void ResetToBase(FGameplayTag AttributeTag)
Restores CurrentValue to BaseValue. Clears the regen delay timer. Fires OnAttributeChanged and may fire OnAttributeRestored if the attribute was depleted.
#
Modifier Functions
Server Only
Modifier Scope
Modifiers affect EffectiveMax — not CurrentValue directly. CurrentValue is clamped after EffectiveMax changes.
#
AddModifier
FAP_AttributeModifierHandle AddModifier(FGameplayTag AttributeTag, FAP_AttributeModifier Modifier)
Adds a modifier to the attribute's EffectiveMax. Returns a handle for later removal.
- If
Modifier.Duration > 0, the modifier auto-expires after that many seconds - If
ModifierTypeisOverrideand an existing Override is active, the old one is removed first before the new one is added - Fires
OnModifierAdded
#
RemoveModifier
void RemoveModifier(FAP_AttributeModifierHandle ModifierHandle)
Removes a modifier by its handle. Clears any associated expiry timer. Recomputes EffectiveMax. Fires OnModifierRemoved.
#
RemoveAllModifiers
void RemoveAllModifiers(FGameplayTag AttributeTag)
Removes all modifiers on the specified attribute. Fires OnModifierRemoved for each. Recomputes EffectiveMax once after all removals.
#
Regen Functions
Server Only
#
SetRegenEnabled
void SetRegenEnabled(FGameplayTag AttributeTag, bool bEnabled)
Enables or disables regeneration for a specific attribute at runtime. Overrides the DataAsset's bRegenEnabled setting.
Regen activates when:
- Regen is enabled for the attribute
- CurrentValue is below EffectiveMax
- Enough time has passed since the last negative delta (
RegenDelay)
#
Debug Functions
Server + Client
#
GetSnapshot
TArray<FAP_AttributeSnapshot> GetSnapshot() const
Returns a full state snapshot of all attributes. ActiveModifierCount is accurate on server only — always 0 on clients.
#
DebugPrint
void DebugPrint() const
Logs all attribute values, effective maxes, and modifier counts to the Output Log via UE_LOG.
#
UAP_AttributeWidgetBase
Type: UUserWidget
Category: AP Attribute | Widget
C++ base class for UMG attribute display widgets. Supports two usage patterns:
- Single-attribute bar — call
BindToAttribute(Actor, Tag)to track one attribute - Multi-attribute panel — call
InitForActor(Actor)to receive the component and all tags, then create child bar widgets
#
Properties
#
BindToAttribute
void BindToAttribute(AActor* TargetActor, FGameplayTag AttributeTag)
Binds this widget to a specific attribute on the target actor. Finds the component, subscribes to OnAttributeChanged, and populates CurrentValue, MaxValue, and NormalizedValue. Calls OnDisplayUpdated once the widget is constructed.
Panel Context
When calling from a panel's OnActorInitialized, use AttributeComponent → GetOwner for TargetActor — do not use GetBoundActor() as the actor reference may not be available on clients yet.
#
OnDisplayUpdated (BlueprintImplementableEvent)
Called after CurrentValue, MaxValue, and NormalizedValue are updated. Override in your Widget Blueprint to set progress bar percent and text values.
Fires:
- Once after
BindToAttributecompletes (deferred toNativeConstructif widget isn't ready) - On every subsequent
OnAttributeChangedcallback for the bound tag
#
InitForActor
void InitForActor(AActor* TargetActor)
Resolves the attribute component and all tags on the target actor, then calls OnActorInitialized. Use for panel widgets that dynamically create child bar widgets.
#
OnActorInitialized (BlueprintImplementableEvent)
Called after InitForActor resolves the component. Override in Blueprint to create child bar widgets, add them to a panel, and call BindToAttribute on each.
#
GetBoundActor
AActor* GetBoundActor() const
Returns the actor passed to InitForActor or BindToAttribute.
#
IAP_AttributeInterface
Type: UInterface
Optional interface for typed checking and custom component resolution. Implement on any Actor that owns a UAP_AttributeSuiteComponent.
Not required — UAP_AttributeStatics falls back to FindComponentByClass automatically if the actor doesn't implement this interface.
#
GetAttributeComponent (BlueprintNativeEvent)
UAP_AttributeSuiteComponent* GetAttributeComponent() const
Returns the attribute component owned by this actor. The default implementation uses FindComponentByClass. Override to return a specific component if the actor has multiple, or to route to a sub-actor's component.
#
UAP_AttributeStatics
Type: UBlueprintFunctionLibrary
Category: AP Attribute
Static helper functions for zero-setup attribute access. No interface implementation required — works on any actor with a UAP_AttributeSuiteComponent.
Any Machine BlueprintPure
#
GetAttributeComponent
static UAP_AttributeSuiteComponent* GetAttributeComponent(AActor* Actor)
Returns the attribute component on the actor. Checks IAP_AttributeInterface first, falls back to FindComponentByClass.
#
HasAttributeComponent
static bool HasAttributeComponent(AActor* Actor)
Returns true if the actor has an attribute component.
#
GetAttributeValue
static float GetAttributeValue(AActor* Actor, FGameplayTag AttributeTag)
Shorthand for GetAttributeComponent(Actor) → GetCurrentValue(Tag). Returns 0.0 if the component or attribute is not found.
#
GetNormalizedAttributeValue
static float GetNormalizedAttributeValue(AActor* Actor, FGameplayTag AttributeTag)
Shorthand for GetAttributeComponent(Actor) → GetNormalizedValue(Tag). Returns 0.0 if not found. Use directly for progress bars.
AfterPrime Systems — Building the Gameplay Foundation