class

AbilitySystemComponent

Module
Game
Header
#include "Gameplay/AbilitySystemComponent.h"
Namespace
Mowo

Constructors

SignatureNameDescription
AbilitySystemComponent() = defaultAbilitySystemComponent
AbilitySystemComponent(const AbilitySystemComponent&) = deleteAbilitySystemComponentMove-only: owns granted ability instances (unique_ptr).
AbilitySystemComponent(AbilitySystemComponent&&) = defaultAbilitySystemComponent

Public functions

ReturnsNameDescription
AbilitySystemComponent&operator=
AbilitySystemComponent&operator=
voidSetOwnerActorOwning actor — cues/damage report it as the cue source.
MObject*GetOwnerActor
voidInitAttributeAttributes
floatGetAttributecurrent (aggregated) value
floatGetAttributeBase
AttributeSet&Attributes
const AttributeSet&Attributes
voidAddAttributeClampClamp rules Register (or replace) a clamp for attr.
voidClearAttributeClamps
uint32_tApplyEffectEffects Apply an effect.
boolCanApplyEffectWould ApplyEffect accept this spec right now?
intRemoveEffectsWithTagsRemoves active effects whose asset or granted tags match any of tags.
intGetStackCount
const std::vector<ActiveGameplayEffect>&GetActiveEffects
const FAbilitySystemStats&GetStats
boolRemoveEffect
intRemoveEffectsWithIdreturns how many were removed
intActiveEffectCount
floatTagRemainingSecondsSeconds left on the active effect that grants tag — the LONGEST when several do, since that is when the owner actually stops having it.
intCountEffectsWithId
boolHasTagTags (hierarchical)
voidAddTagref-counted
voidRemoveTag
boolHasAllTags
boolHasAnyTags
FGameplayTagContainerGetOwnedTagsThe owned tags (count > 0) as a container, for FGameplayTagQuery.
boolIsAbilityBlockedAbility blocking (UE's BlockAbilitiesWithTag): while an active ability blocks a tag, no ability whose tag matches it can activate.
intCancelAbilitiesWithTagsEnds every active class ability whose tag matches one of tags.
voidNotifyAbilityEndedCalled by MGameplayAbility::EndAbility: drops the tags the ability blocked and owned while it ran.
voidGrantAbilityAbilities (lambda specs — the trivial path)
boolHasAbility
boolIsOnCooldown
boolCanActivateAbilityActivatable = granted, required tags present, no blocked tags, off cooldown, and the cost is affordable (no Add modifier would push an attribute < 0).
boolTryActivateAbilityChecks CanActivate, then applies cost + cooldown + runs onActivate.
MGameplayAbility*GrantAbilityObjectAbilities (class-based MGameplayAbility — the data-authored path) Grant an ability instance.
boolHasAbilityObject
MGameplayAbility*FindAbilityObject
boolCanActivateAbilityObject
boolTryActivateAbilityObjectActivate a class ability: CanActivate → CommitAbility (cost+cooldown) → ActivateAbility.
boolIsAbilityObjectActive
voidSendGameplayEventGameplay events — routed to every active class ability's live tasks (a WaitGameplayEvent task finishes on a match).
voidSendGameplayEvent
voidExecuteGameplayCueFire a cue through the dispatcher with this ASC as the source.
uint16_tPredictActivateAbilityClient-side prediction On a client the player owns no authority, but waiting a full round-trip before the cost/cooldown/cue land feels laggy.
uint16_tPredictActivateAbilityObject
voidConfirmPredictionServer confirmed the prediction: drop the retained baseline (the local result stands; replicated attributes converge it to the exact value).
voidRollbackPredictionServer rejected the prediction: restore the captured baseline and drop the record.
boolHasPendingPrediction
intPendingPredictionCount
voidTickAdvance durations, run periodic effects, expire, tick abilities, recompute.
const std::vector<GameplayAbilitySpec>&GetGrantedAbilitiesRead-only view of the granted set — the net layer resolves wire ability ids against it.

Function details

AbilitySystemComponent

C++
AbilitySystemComponent() = default

AbilitySystemComponent

C++
AbilitySystemComponent(const AbilitySystemComponent&) = delete

Move-only: owns granted ability instances (unique_ptr). Held by value on MAbilitySystemComponent, never copied.

AbilitySystemComponent

C++
AbilitySystemComponent(AbilitySystemComponent&&) = default

operator=

C++
AbilitySystemComponent& operator=(const AbilitySystemComponent&) = delete

operator=

C++
AbilitySystemComponent& operator=(AbilitySystemComponent&&) = default

SetOwnerActor

C++
void SetOwnerActor(MObject* owner)

Owning actor — cues/damage report it as the cue source. Optional.

GetOwnerActor

C++
MObject* GetOwnerActor() const

InitAttribute

C++
void InitAttribute(FName attr, float base)

Attributes

GetAttribute

C++
float GetAttribute(FName attr) const

current (aggregated) value

GetAttributeBase

C++
float GetAttributeBase(FName attr) const

Attributes

C++
AttributeSet& Attributes()

Attributes

C++
const AttributeSet& Attributes() const

AddAttributeClamp

C++
void AddAttributeClamp(FName attr, float minValue, FName maxAttr = FName())

Clamp rules Register (or replace) a clamp for attr. Applied immediately and on every subsequent base change / recompute.

ClearAttributeClamps

C++
void ClearAttributeClamps()

ApplyEffect

C++
uint32_t ApplyEffect(const GameplayEffectSpec& spec, const AbilitySystemComponent* source = nullptr)

Effects Apply an effect. Instant → modifies base now (returns 0). Duration/Infinite → adds an active effect, or a stack to an existing one (returns its handle), and recomputes current. Refused (returns 0, nothing changes) when an active effect grants immunity to its asset tags or the target fails its application tag requirements. source is the applier: its attributes back AttributeBased magnitudes and it keys by-source stacks.

CanApplyEffect

C++
bool CanApplyEffect(const GameplayEffectSpec& spec) const

Would ApplyEffect accept this spec right now?

RemoveEffectsWithTags

C++
int RemoveEffectsWithTags(const std::vector<FGameplayTag>& tags)

Removes active effects whose asset or granted tags match any of tags.

GetStackCount

C++
int GetStackCount(FGameplayTag effectId) const

GetActiveEffects

C++
const std::vector<ActiveGameplayEffect>& GetActiveEffects() const

GetStats

C++
const FAbilitySystemStats& GetStats() const

RemoveEffect

C++
bool RemoveEffect(uint32_t handle)

RemoveEffectsWithId

C++
int RemoveEffectsWithId(FGameplayTag id)

returns how many were removed

ActiveEffectCount

C++
int ActiveEffectCount() const

TagRemainingSeconds

C++
float TagRemainingSeconds(FGameplayTag tag) const

Seconds left on the active effect that grants tag — the LONGEST when several do, since that is when the owner actually stops having it. A cooldown is exactly this shape (an effect granting a cooldown tag for a duration), so it is what a client needs to grey out a button. 0 when nothing grants the tag or the granter has no duration.

CountEffectsWithId

C++
int CountEffectsWithId(FGameplayTag id) const

HasTag

C++
bool HasTag(FGameplayTag tag) const

Tags (hierarchical)

AddTag

C++
void AddTag(FGameplayTag tag)

ref-counted

RemoveTag

C++
void RemoveTag(FGameplayTag tag)

HasAllTags

C++
bool HasAllTags(const std::vector<FGameplayTag>& tags) const

HasAnyTags

C++
bool HasAnyTags(const std::vector<FGameplayTag>& tags) const

GetOwnedTags

C++
FGameplayTagContainer GetOwnedTags() const

The owned tags (count > 0) as a container, for FGameplayTagQuery.

IsAbilityBlocked

C++
bool IsAbilityBlocked(FGameplayTag abilityTag) const

Ability blocking (UE's BlockAbilitiesWithTag): while an active ability blocks a tag, no ability whose tag matches it can activate.

CancelAbilitiesWithTags

C++
int CancelAbilitiesWithTags(const std::vector<FGameplayTag>& tags)

Ends every active class ability whose tag matches one of tags.

NotifyAbilityEnded

C++
void NotifyAbilityEnded(const MGameplayAbility& ability)

Called by MGameplayAbility::EndAbility: drops the tags the ability blocked and owned while it ran.

GrantAbility

C++
void GrantAbility(const GameplayAbilitySpec& ability)

Abilities (lambda specs — the trivial path)

HasAbility

C++
bool HasAbility(FGameplayTag abilityTag) const

IsOnCooldown

C++
bool IsOnCooldown(FGameplayTag abilityTag) const

CanActivateAbility

C++
bool CanActivateAbility(FGameplayTag abilityTag) const

Activatable = granted, required tags present, no blocked tags, off cooldown, and the cost is affordable (no Add modifier would push an attribute < 0).

TryActivateAbility

C++
bool TryActivateAbility(FGameplayTag abilityTag)

Checks CanActivate, then applies cost + cooldown + runs onActivate. Returns whether it activated.

GrantAbilityObject

C++
MGameplayAbility* GrantAbilityObject(std::unique_ptr<MGameplayAbility> ability)

Abilities (class-based MGameplayAbility — the data-authored path) Grant an ability instance. Re-granting the same tag replaces it. Takes ownership.

HasAbilityObject

C++
bool HasAbilityObject(FGameplayTag abilityTag) const

FindAbilityObject

C++
MGameplayAbility* FindAbilityObject(FGameplayTag abilityTag) const

CanActivateAbilityObject

C++
bool CanActivateAbilityObject(FGameplayTag abilityTag) const

TryActivateAbilityObject

C++
bool TryActivateAbilityObject(FGameplayTag abilityTag)

Activate a class ability: CanActivate → CommitAbility (cost+cooldown) → ActivateAbility. Latent abilities stay active and tick until they end.

IsAbilityObjectActive

C++
bool IsAbilityObjectActive(FGameplayTag abilityTag) const

SendGameplayEvent

C++
void SendGameplayEvent(const FGameplayEventData& data)

Gameplay events — routed to every active class ability's live tasks (a WaitGameplayEvent task finishes on a match).

SendGameplayEvent

C++
void SendGameplayEvent(FGameplayTag eventTag, MObject* instigator = nullptr, float magnitude = 0.0f)

ExecuteGameplayCue

C++
void ExecuteGameplayCue(FGameplayTag cueTag, EGameplayCueEvent event, float magnitude = 0.0f, MObject* instigator = nullptr)

Fire a cue through the dispatcher with this ASC as the source.

PredictActivateAbility

C++
uint16_t PredictActivateAbility(FGameplayTag abilityTag)

Client-side prediction On a client the player owns no authority, but waiting a full round-trip before the cost/cooldown/cue land feels laggy. These predict an activation LOCALLY the instant the input arrives, and reconcile against the server's verdict: a confirm keeps the local result, a reject rolls every touched attribute + tag + effect back to the captured pre-activation baseline. The server stays authoritative — a predicted activation never changes anything the server does not also do. PredictActivateAbility captures the baseline, runs the local activation, and returns a non-zero prediction key when it applied (0 = the local CanActivate check failed, so nothing was predicted and there is nothing to reconcile). Works for both lambda-spec and class-based abilities.

PredictActivateAbilityObject

C++
uint16_t PredictActivateAbilityObject(FGameplayTag abilityTag)

ConfirmPrediction

C++
void ConfirmPrediction(uint16_t key)

Server confirmed the prediction: drop the retained baseline (the local result stands; replicated attributes converge it to the exact value).

RollbackPrediction

C++
void RollbackPrediction(uint16_t key)

Server rejected the prediction: restore the captured baseline and drop the record. A stale/unknown key is a no-op.

HasPendingPrediction

C++
bool HasPendingPrediction(uint16_t key) const

PendingPredictionCount

C++
int PendingPredictionCount() const

Tick

C++
void Tick(float dt)

Advance durations, run periodic effects, expire, tick abilities, recompute.

GetGrantedAbilities

C++
const std::vector<GameplayAbilitySpec>& GetGrantedAbilities() const

Read-only view of the granted set — the net layer resolves wire ability ids against it.

Generated from Gameplay/AbilitySystemComponent.h via game.json · Nov 5, 2026Version 1.0.0