Command Palette

Search for a command to run...

Назад к скиллам
скилл № 54264

unreal-gameplay-ability-system

Use when working with Unreal's Gameplay Ability System - when GAS is worth it, where the AbilitySystemComponent lives and how it is initialised on server and…

БесплатноБез исполняемых скриптов
makifbaysalот makifbaysal★ 123 звезды на GitHub

Установить unreal-gameplay-ability-system в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Unreal Gameplay Ability System

Overview

GAS is Unreal's framework for abilities, attributes, buffs, cooldowns and costs, with network prediction built in. It pays off in games with many abilities and stacking effects, especially multiplayer ones; it is heavy machinery for a platformer with one jump. Most GAS bugs are setup bugs: the component initialised on one side only, clamping in the wrong callback, abilities that never end.

Core principle: Abilities are code, numbers are GameplayEffects (data), state is gameplay tags, and every attribute change goes through an effect so it replicates and predicts correctly.

When to use it

  • Use when: many abilities with cooldowns/costs, buffs and debuffs that stack and expire, attributes modified by many sources, multiplayer with predicted abilities. If the project already uses GAS, new abilities go through it.
  • Skip when: a handful of actions with simple cooldowns in a single-player game — a component with a few functions is clearer.

Setup

Owner of the ASC Use for
APlayerState Player characters — attributes and effects survive pawn death and respawn
The ACharacter itself AI and simple pawns

Replication mode: Full (single-player), Mixed (player-controlled, multiplayer), Minimal (AI in multiplayer).

// Server: when the controller possesses the pawn
void AHeroCharacter::PossessedBy(AController* NewController) {
    Super::PossessedBy(NewController);
    InitAbilitySystem();
}
// Client: when the PlayerState replicates
void AHeroCharacter::OnRep_PlayerState() {
    Super::OnRep_PlayerState();
    InitAbilitySystem();
}
void AHeroCharacter::InitAbilitySystem() {
    auto* PS = GetPlayerState<AHeroPlayerState>();
    if (!PS) return;
    AbilitySystem = PS->GetAbilitySystemComponent();
    AbilitySystem->InitAbilityActorInfo(PS, this);       // owner = PlayerState, avatar = this pawn
    if (HasAuthority()) GrantStartupAbilitiesAndEffects();
}

Missing the client-side InitAbilityActorInfo is the classic "works on the server, abilities do nothing on the client" bug. Implement IAbilitySystemInterface on the actors that own or carry the ASC.

AttributeSets

UCLASS()
class UHealthSet : public UAttributeSet {
    GENERATED_BODY()
public:
    UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Health) FGameplayAttributeData Health;
    ATTRIBUTE_ACCESSORS(UHealthSet, Health)
    UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_MaxHealth) FGameplayAttributeData MaxHealth;
    ATTRIBUTE_ACCESSORS(UHealthSet, MaxHealth)
    UPROPERTY(BlueprintReadOnly) FGameplayAttributeData IncomingDamage;   // meta attribute, server only
    ATTRIBUTE_ACCESSORS(UHealthSet, IncomingDamage)

    virtual void PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) override;
    virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
    virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Out) const override;
    UFUNCTION() void OnRep_Health(const FGameplayAttributeData& Old) { GAMEPLAYATTRIBUTE_REPNOTIFY(UHealthSet, Health, Old); }
    UFUNCTION() void OnRep_MaxHealth(const FGameplayAttributeData& Old) { GAMEPLAYATTRIBUTE_REPNOTIFY(UHealthSet, MaxHealth, Old); }
};

void UHealthSet::PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) {
    if (Data.EvaluatedData.Attribute == GetIncomingDamageAttribute()) {
        const float Damage = GetIncomingDamage();
        SetIncomingDamage(0.f);
        SetHealth(FMath::Clamp(GetHealth() - Damage, 0.f, GetMaxHealth()));   // the real clamp
    }
}
  • ATTRIBUTE_ACCESSORS is the project's helper macro wrapping the GAMEPLAYATTRIBUTE_* getters/setters/initter — use the one the project defines.
  • PreAttributeChange only clamps the value being queried (current value from modifiers); it does not permanently change the base value. Clamp for real in PostGameplayEffectExecute.
  • Damage goes through a meta attribute (IncomingDamage) so armour, shields and death are handled in one place.
  • Replicate with DOREPLIFETIME_CONDITION_NOTIFY(UHealthSet, Health, COND_None, REPNOTIFY_Always).

GameplayEffects: numbers as data

  • Instant (damage, heal), Duration (a 5 s slow), Infinite (an equipped item's bonus, removed explicitly).
  • Magnitudes come from scalable floats with curve tables, SetByCaller (tagged values set by the ability), Modifier Magnitude Calculations, or an Execution Calculation for formulas that read several attributes (damage vs armour).
  • Cooldowns and costs are GameplayEffects referenced by the ability, applied by CommitAbility.
  • Keep the formula in a pure static function called by the execution calculation, so it can be unit-tested without a world.

Abilities

void UGA_Fireball::ActivateAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* Info,
                                   const FGameplayAbilityActivationInfo
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл unreal-gameplay-ability-system?

Use when working with Unreal's Gameplay Ability System - when GAS is worth it, where the AbilitySystemComponent lives and how it is initialised on server and client, AttributeSets with correct clamping and replication, GameplayEffects and execution calculations as data, abilities with commit/end, gameplay tags, prediction, and testing.

Как установить скилл unreal-gameplay-ability-system?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл unreal-gameplay-ability-system запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить unreal-gameplay-ability-system с