Files
Aura/Docs/Tutos/AbilitySystem/AbilityStatusImplementation/Ability System Implementation.md
2024-03-20 16:21:19 +01:00

51 lines
1.6 KiB
Markdown

[Home](../../Home.md)
# Ability Status Implementation
An ability status is a gameplay tag assigned to the dynamic tags of an ability spec.
It can be one of the four values
Tag | Meaning
-|-
`Ability.Status.Locked` | The ability cannot be learnt
`Ability.Status.Eligible` | The ability can be learnt
`Ability.Status.Unlocked` | Ability learnt from the book but not bind
`Ability.Status.Equipped` | Ability has an input tag bind
Each character has a class information that contains an ability book
```C++
AAuraBaseCharacter *MyCharacter;
UAbilityInfo* Book = MyCharacter->GetClassInfo()->AbilitiesBook;
```
The Ability System Component has a list of ability specs.
```C++
UAuraAbilitySystemComponent *AuraASC;
TArray<FGameplayAbilitySpec> Abilities = AuraASC->GetActivatableAbilities();
```
We can fetch an ability status with ether an ability spec or an ability id tag
```C++
FGameplayAbilitySpec AbilitySpec;
FGameplayTag StatusTag = UAuraAbilitySystemComponent::GetStatusTagFromAbilitySpec(AbilitySpec);
bool StatusFound = AuraASC->GetStatusTagForAbilityIDTag(AbilityIDTag, FGameplayTag, StatusTag);
```
Status | In Active Abilities | Level > 0 | InputTag
-|-|-|-
Locked | ❌ | ❌ | ❌
Eligible | ✔️ | ❌ | ❌
Unlocked | ✔️ | ✔️ | ❌
Equipped | ✔️ | ✔️ | ✔️
To keep the status tag up to date, it is updated in the asc when
- We recieve an ability with a matching tag of `Ability.ID`. in the `OnGiveAbility`
- We assign an input tag to the ability spec. in the `AssignInputTagToAbilitySpec` and `RemoveInputTagFromAbilitySpec`
- We modify an ability spec level with the function `SetLevelForAbilitySpec` or `AddLevelForAbilitySpec`