# API Reference

AfterPrime Systems | AP Attribute Suite | Version 1.0.0


# Contents

   
Enums EAP_ModifierType
Structs FAP_AttributeDefinition, FAP_AttributeModifier, FAP_AttributeModifierHandle, FAP_AttributeSnapshot
UAP_AttributeSet Data asset defining a collection of attributes
UAP_AttributeSuiteComponent Primary component — add to any replicated actor
UAP_AttributeWidgetBase UMG base class for attribute display widgets
IAP_AttributeInterface Optional interface for typed component resolution
UAP_AttributeStatics Static helper library — zero-setup attribute access

# Enums

# EAP_ModifierType

Controls how a modifier affects an attribute's EffectiveMax.

Value Description
Additive Added to the base max. +50 raises max by 50.
Multiplicative Multiplied after additive modifiers. 1.5 = 50% increase.
Override Replaces EffectiveMax entirely. Only one Override can be active per attribute — adding a second removes the first.

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.

Property Type Default Description
Tag FGameplayTag Gameplay Tag identifying this attribute.
BaseValue float 100.0 Starting and reset value.
MinValue float 0.0 Minimum value this attribute can reach.
MaxValue float 100.0 Maximum value before modifiers are applied.
bRegenEnabled bool false Whether this attribute regenerates over time.
RegenRatePerSecond float 5.0 Units per second regenerated when regen is active.
RegenDelay float 3.0 Seconds after a negative delta before regeneration begins.

# FAP_AttributeModifier

Blueprint-facing modifier definition. Pass to AddModifier to alter an attribute's EffectiveMax.

Property Type Default Description
ModifierType EAP_ModifierType Additive How this modifier combines with others.
Value float 0.0 The modifier value, applied according to ModifierType.
Duration float 0.0 Duration in seconds. 0 = permanent. Timed modifiers auto-expire.
Handle FGuid Assigned automatically by AddModifier. Do not set manually.

# FAP_AttributeModifierHandle

Blueprint-safe wrapper returned by AddModifier. Pass to RemoveModifier to remove a specific modifier.

Property Type Description
Handle FGuid Unique identifier for the modifier instance.
AttributeTag FGameplayTag The attribute this modifier is applied to.

# FAP_AttributeSnapshot

Full state dump of one attribute. Returned by GetSnapshot.

Property Type Description
Tag FGameplayTag Attribute identifier.
CurrentValue float Current replicated value.
BaseValue float Base unmodified value.
MinValue float Minimum allowed value.
EffectiveMax float Effective maximum after modifiers.
NormalizedValue float CurrentValue / EffectiveMax clamped to [0,1].
bRegenActive bool Whether regen is currently active.
ActiveModifierCount int32 Number of active modifiers. Accurate on server only — always 0 on clients.

# 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

Property Type Description
Definitions TArray<FAP_AttributeDefinition> List of attribute definitions. Tags must be unique within a set.

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.

# Properties

Property Type Description
AttributeSets TArray<UAP_AttributeSet*> One or more DataAssets defining this component's attributes. Loaded at BeginPlay.

# Delegates

All delegates are BlueprintAssignable.

# OnAttributeChanged

Fires after any mutation to CurrentValue — on server after state mutation, on clients from FastArray replication callbacks.

Parameter Type Description
AttributeTag FGameplayTag The attribute that changed
OldValue float Value before the change
NewValue float Value after the change

# 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.

Parameter Type Description
AttributeTag FGameplayTag The attribute that reached minimum

# OnAttributeRestored

Fires when CurrentValue rises above MinValue after being depleted. Edge-detected — fires only on the transition from at-minimum to above-minimum.

Parameter Type Description
AttributeTag FGameplayTag The attribute that recovered

# OnModifierAdded

Server Only

Fires when AddModifier succeeds.

Parameter Type Description
AttributeTag FGameplayTag The attribute the modifier was applied to
Handle FAP_AttributeModifierHandle Handle for the new modifier

# OnModifierRemoved

Server Only

Fires when a modifier is removed via RemoveModifier, RemoveAllModifiers, or timer expiry.

Parameter Type Description
AttributeTag FGameplayTag The attribute the modifier was on
Handle FAP_AttributeModifierHandle Handle of the removed modifier

# 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

TArray<FGameplayTag> GetAllAttributeTags() const

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

# 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 ModifierType is Override and 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:

  1. Regen is enabled for the attribute
  2. CurrentValue is below EffectiveMax
  3. 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

Property Type Description
CurrentValue float Current value of the bound attribute. Updated automatically.
MaxValue float Effective maximum of the bound attribute. Updated automatically.
NormalizedValue float CurrentValue / MaxValue clamped to [0,1]. Use for progress bars.

# 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.


# 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 BindToAttribute completes (deferred to NativeConstruct if widget isn't ready)
  • On every subsequent OnAttributeChanged callback 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.

Parameter Type Description
AttributeComponent UAP_AttributeSuiteComponent* The resolved component
AttributeTags TArray<FGameplayTag> All attribute tags on the component

# 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