Ability System Component (ASC)
Last updated
Last updated
This is the container that holds all the "gears" of the GameplayAbilitySystem. It represents a single character/entity with its Attributes/Abilities and Effects/Tags currently applied to it. It is also the origin of most things that are executed by the GAS.
The Attributes in this ASC and their current values. Attributes are numeric representations of any mechanic/parameter you are modelling.
You can create as many different attributes as you want to represent any numeric mechanic. The only limit is your imagination. This is not constrained to your player, or combat related values, you can create mechanics for other objects aswell, including crafting, vehicles, basebuilding.
(e.g. Health, MaxHealth, MovementSpeed, CriticalChance, CriticalBonus, Ammo, Dungeon.SpawnRate, Building.MaxRooms, Vehicle.Acceleration, Monster.HitChance, Enemy.AimSpeed)
Check Attributes to create more attributes.
Subscribe to this event to update your variables whenever an attribute changes.
Use this to grab an attribute value immediately. Needs to be called every frame if you need to keep the variable always up to data. Prefer OnAttributeChanged.
Current GameplayTags applied on this ASC. GameplayTags are names used to classify and describe the state of an object. They are useful for categorizing and identifying the properties or status of an entity (ASC).
(e.g. Status.Debuff.Stun, Status.Debuff.Poisoned, Movement.Crouching, Movement.Sprinting, Environment.Underwater)
This event is triggered everytime the ASC's tags are changed.
List of abilities (GA) the ASC can use/activate.
Attempts to activate a specific GameplayAbility by its name, index or reference. It searches for the ability in the list of grantedGameplayAbilities and then attempts to activate it on a specified target.
Granting an ability instantiates a new copy of the GameplayAbility and add that copy to grantedGameplayAbilities. Also triggers OnGameplayAbilityGranted event. Ungranting deactivates the ability and then remove it from grantedGameplayAbilities. Also triggers OnGameplayAbilityUngranted event.
Current GameplayEffects applied on this ASC.
The ApplyGameplayEffect method is called by Abilities (GA). It applies a GameplayEffect (GE) to an AbilitySystemComponent (ASC). It sets the source and target for the effect, then checks if the effect meets the tag requirements. If the requirements are met, it applies the effect and triggers OnGameplayEffectApplied. ApplyGameplayEffect can also be called 'manually' if you want to apply an effect (GE) without an ability.
The RemoveGameplayEffect method removes a gameplay effect from the ASC. It first checks if the effect is present in the ASC. If found, it removes the effect, refreshes attribute modifiers, applies attribute modifier values, and triggers OnGameplayEffectRemoved.
There are events that you can listen for and react to changes on the ASC.
OnGameplayEffectApplied, OnGameplayEffectRemoved Triggered when GameplayEffects are applied or removed.
OnTagsChanged Triggered when the applied tag list of the ASC changes.
OnGameplayAbilityGranted, OnGameplayAbilityUngranted Triggered when an ability is granted or ungranted. OnGameplayAbilityPreActivate, OnGameplayAbilityActivated, OnGameplayAbilityTryActivate, OnGameplayAbilityDeactivated, OnGameplayAbilityFailedActivation Triggered when activating/deactivating abilities. OnAttributeChanged, OnPreAttributeChange Triggered from changes in attributes.