ue-gameplay-abilities

Use this skill when working with GAS, Gameplay Ability System, GameplayAbility, GameplayEffect, AttributeSet, GameplayTags, ability system, buffs, debuffs, cooldowns, or attribute modification. See references/ for detailed setup patterns, effect configuration, and ability task usage.

By quodsoler · 848 installs

npx skills add quodsoler/unreal-engine-skills --skill ue-gameplay-abilities

Source repository · Upstream listing

Gameplay Ability System (GAS) You are an expert in Unreal Engine's Gameplay Ability System (GAS). Context Check Before proceeding, read .agents/ue project context.md to determine: Whether the GameplayAbilities plugin is enabled Which actors own the AbilitySystemComponent (PlayerState vs Character) The replication mode in use (Minimal, Mixed, Full) Any existing AttributeSets or ability base classes Information Gathering Ask the developer: 1. What type of abilities are needed? (active, passive, triggered, instant) 2. What attributes are required? (health, mana, stamina, custom stats) 3. Is this multiplayer? If so, which actors carry the ASC? 4. Are cooldowns and costs required, or is this a passive/trigger system? 5. Do abilities need prediction (local only feedback before server confirms)? GAS Architecture Overview GAS has three pillars that live on UAbilitySystemComponent (ASC): Pillar Class Purpose Abilities UGameplayAbility Logic for what happens when activated Effects UGameplayEffect Data driven stat mutations (instant, duration, infinite) Attributes UAttributeSet Float properties representing character stats GameplayTags thread through all three as requirements, grants, and blockers. GAS Setup 1. Enable the Plugin Enable GameplayAbilities in .uproject Plugins array, then in [ProjectName].Build.cs : 2. AbilitySystemComponent Ownership PlayerState (recommended for multiplayer): ASC persists across respawns because PlayerState is not destroyed on death. Use this for player characters in networked games. Character/Pawn: Simpler. Use for AI characters or single player games where persistence across respawns is not required. See references/gas setup patterns.md for full initialization sequences for both patterns. 3. IAbilitySystemInterface Every actor that owns or exposes an ASC must implement IAbilitySystemInterface : 4. Replication Modes Set on the ASC after creation (server side only): Mode When to Use Minimal AI or non player actors; no GE replication to simulated proxies Mixed Player controlled characters (owner gets full info, others get minimal) Full Non player games or debugging; all GEs replicate to all clients 5. InitAbilityActorInfo Must be called on both server and client after possession. Call in PossessedBy (server) and OnRep PlayerState (client): ASC InitAbilityActorInfo(OwnerActor, AvatarActor) . See references/gas setup patterns.md for full dual path code with respawn handling. GameplayAbilities Subclass UGameplayAbility ActivateAbility Pattern CommitAbility is shorthand for CommitAbilityCost + CommitAbilityCooldown . Call them separately when needed e.g., commit cost without starting cooldown for a channeled ability, or commit cooldown without cost for a free ability. Instancing and Net Execution Policy Set in the ability constructor: Granting and Activating Abilities Ability Tags Configure in the ability CDO constructor: GameplayEffects Duration Policies Policy Behavior Instant Executes once; modifies attribute base value permanently HasDuration Active for set duration; uses DurationMagnitude (seconds) Infinite Active until RemoveActiveGameplayEffect is called Applying Effects See references/gameplay effect reference.md for stacking (AggregateBySource/AggregateByTarget), periodic effects (damage over time), UGameplayEffectExecutionCalculation (complex modifier logic), conditional effects, and immunity. AttributeSet Define Attributes In the .cpp , implement replication and callbacks: Register AttributeSet on ASC Multiple AttributeSets : An ASC can host multiple UAttributeSet subclasses (e.g., UHealthSet + UOffenseSet ), each auto discovered via subobject enumeration. Never register two instances of the same class the second is silently ignored. GameplayTags Defining Tags In Config/DefaultGameplayTags.ini or via native tags (preferred for code references): Tag Matching "A.1".MatchesTag("A") == true (hierarchical); MatchesTagExact requires exact match. Loose Tags (Manual, No GE) GameplayCues Cosmetic only (particles, sounds, decals). Never affect gameplay state. Tag prefix: GameplayCue. In the GE asset, add FGameplayEffectCue entries with GameplayCueTags and level range. Cue Notify classes: AGameplayCueNotify Actor : Persistent/looping. Overrides OnActive , WhileActive , OnRemove . AGameplayCueNotify Static : Burst/one shot. Overrides OnExecute . Place cue notify assets in /Game/GAS/GameplayCues/ for UGameplayCueManager auto discovery. Common Mistakes and Anti Patterns ASC ownership confusion: Implement IAbilitySystemInterface on the class that owns the ASC (PlayerState), not just on the Pawn. Otherwise UAbilitySystemBlueprintLibrary lookups fail. InitAbilityActorInfo only on server: Clients need it too. Call in OnRep PlayerState (client) and PossessedBy (server). Skipping client side init breaks attribute replication on the owning client. GEs applied before InitAbilityActorInfo: The ASC is not ready; attributes are not registered. Always complete init before granting abilities or applying effects. PreAttributeChange vs PostGameplayEffectExecute: PreAttributeChange fires on every current value change (aggregator updates, buff adds/removes). Use it only to clamp. Use PostGameplayEffectExecute to react to instant GE base value execution (damage, death). Never send game events from PreAttributeChange . Forgetting CommitAbility: Without it, the ability runs but consumes no mana and starts no cooldown. Loose tags not replicated: AddLooseGameplayTag does not replicate by default. Pass EGameplayTagReplicationState::TagOnly as the third argument to replicate the tag, or grant via a GE for fully replicated effect driven tags. Effect stacking overflow: Stacks beyond LimitCount are silently rejected. Use GetCurrentStackCount to inspect the current level before attempting further stack applications. GAS with AI: AI has no PlayerState. Place the ASC on the AICharacter, call InitAbilityActorInfo(AICharacter, AICharacter) , set replication mode to Minimal . Hot joining : Late joining clients receive active effects via FActiveGameplayEffectsContainer replication after InitAbilityActorInfo . Never apply startup GEs in BeginPlay unconditionally server only, or late joiners double apply. Reference Files references/gas setup patterns.md — Full ASC ownership patterns and initialization sequences for PlayerState and Character owners, multiplayer and single player references/gameplay effect reference.md — Effect configuration, stacking rules, modifier types, execution calculations, periodic effects, conditional effects references/ability task reference.md — Common built in ability tasks and custom task patterns Related Skills ue actor component architecture — Component setup and subobject registration ue networking replication — Replication modes, RPCs, prediction keys ue animation system — Montage ability tasks (PlayMontageAndWait) ue gameplay framework — PlayerState ownership pattern, Pawn/Controller lifecycle ue cpp foundations — Delegate binding, UPROPERTY macros, TSubclassOf patterns