Gameplay Ability
I have no ability to explain this
The Gameplay Abilities is a plugin to handle gameplay mechanics in C++ or Blueprints. It also handles the replication.
Setup
To use the Gameplay Ability System attach the AbilitySystemComponent to any actor that implements the IAbilitySystemInterface.
Easy way is to CreateDefaultSubObject<UAbilitySystemComponent>(TEXT("AbilitySystem"));
The Component will activate abilities, store attributes, update effects, and handle interactions between actors.
GiveAbility
For pawns after possession call AbilitySystem->InitAbilityActorInfo().
Owner - The actor responsible for the abilitysystem.
Avatar- The actor through witch the ability system use abilities from.
RefreshAbilityActorInfo, BindAbilityActivationToInputComponent
AttributeSet
The float values of an actors game state.
Each FGameplayAttribue is described with UPROPERTY.
Functions to supervise any attemts to modify them, they are modified using GameplayEffects.
PreAttributeBaseChange / PreAttributeChange - Use to clamp values.
PreGameplayEffectExecute - Use to trigger actions from attribute change.
PostGameplayEffectExecute - Use to modify or discard the values passed into an effect execution.
AttributeSet needs to register with the ability system component. Set it as a subobject of the component owning actor or use the components GetOrCreateAttributeSubobject.
Use AbilitySystem::InitStats to init with a datatable.
GameplayTags
The 'bool' flags of a actors game state.
RegisterGamePlayTagEvent
GameplayEffects (GE_)
Implemented as data-only Blueprints (of base class UGameplayEffect).
Gameplay Effects are designed to be configured purely through variables.
'Buffs' / 'Debuffs'.
ApplyGamePlayEffectToTarget, ApplyGameplayEffectoToOwner
Have tags
Modify attributes.
Add/remove tags.
Blocked by tags on owner or target.
Handle stacking of effects and overflow the stack
Trigger events
Can be instant, duration or infinite.
Instant: Direct changes to the Attribute's base value, like taking away health points from an Actor that has received damage.
Infinite: Persistent changes that are applied over time, like regenerating a certain amount of magic points per second over a period of several seconds (or indefinitely).
Had Duration: Temporary changes, like granting a boost to movement speed for a few seconds.
GameplayEffectSpecs
GameplayCues (GC_)
Gameplay Abilities (GA_)
C++ or Blueprint children of something with GameplayAbility as a ancestor.
GameplayAbility - Basic ability.
GameplayAbility_Montage - Ability that play a montage.
WaitTargetData node at the beginning to allow the player to visualize aiming.
Cooldown and cost will be applied when CommitAbility is used.
Before an Actor can use an Ability, its Ability System Component must be granted that Ability.
GiveAbility
GiveAbilityAndActivateOnce
Revoke access to an Ability from an Ability System Component,
ClearAbility
SetRemoveAbilityOnEnd
ClearAllAbilities
Other
CanActivateAbility
Use ability
CallActivateAbility
TryActivateAbility
Other 2
CommitAbility
ActivateAbility
Stop Ability
CancelAbility
CanBeCanceled
EndAbility - All path must lead to Endability to clean up.
Tags
This section can use tags to cancel abilities, block abilities, set tags and require/block the ability based on the activating, source or target actor/component (*).
Cancel Abilities With Tag Abilities with these tags are canceled when this ability is executed.
Block Abilities With Tag Abilities with these tags are blocked while this ability is activated.
Activation Owned Tags Tags to apply to activating owner while this ability is activated.
* Required Tags Ability can only be activated if the * actor/component has all of these tags.
* Blocked Tags The activation is blocked if the * actor/component has any of these tags.
Instancing Policy
Non-Instanced
Instanced per Actor
Instanced per Execution
Replication
Local Predicted - Most players
Local Only:
Server Initiated
Server Only
Other
Triggers: Makes it possible to execute the ability when a event is received, when a tag is added or activated/deactivated when a tag is added/removed.
Cost gameplay effect class: When the ability is commited this can be used to drain the (mana, stamine, etc) cost of the ability.
Colldown gameplay effect class: Applied when the ability is commited. The ability can not be used again until this has expired.
FGameplayAbilitySpec
FGameplayAbilitySpecHandle
Ability Tasks
They perform asynchronous work during a Gameplay Ability's execution, and have the capability to affect execution flow by calling Delegates (in native C++ code) or moving through one or more output execution pins (in Blueprints)
Ability Tasks can self-terminate by calling the EndTask function, or it can wait to be terminated automatically when the Gameplay Ability that ran it ends.
Gameplay Events
References
Unreal Engine 5 - The truth of the Gameplay Ability System