text
stringlengths
0
17.2k
Other classes bind to this delegate to receive out of health notifications, like the ULyraHealthComponent, which is responsible for handling death and exposing the Health value to the game.
The Lyra Combat Set (ULyraCombatSet) provides support for damage and healing. Gameplay Effects deal with modifying either one of these attributes or relying on Lyra's custom executions to adjust the Health total.
By default, the Health attribute is hidden from modifiers, so it cannot be changed directly by Gameplay Effects like regular attributes. Instead, its value is set indirectly through the Healing attribute, and through the Custom Executions ULyraHealExecution and ULyraDamageExecution.
Treating damage and healing as attributes has the benefit of decoupling individual damage instances from the modified attribute, and makes working with damage values easier. It helps prevent accidental modification of important attributes. Because the Health value is hidden from Gameplay Effect modifiers, there's no risk of applying timed or infinite effects on top of its base value, which could cause issues in the long run.
ULyraHealExecution snapshots the BaseHeal attribute on the source, then it clamps to zero to prevent negative healing. Finally, it modifies the Health attribute on the Target. Because this is done in source, the Health value can be modified without issue.
ULyraDamageExecution tallies the BaseDamage and Health attribute values. BaseDamage is captured on the Source and snapshotted, while Health is captured on the Target. Then it checks for the impact location (so it knows where to spawn the damage numbers effect).
It checks with the target's Team for friendly fire and applies attenuations based on distance and Physical Material. Finally, it modifies the Health attribute on the Target. Because this is done in source code, the Health value can be modified without issue.
The damage numbers Gameplay Cue is set to receive the change in the Health attribute as its magnitude and derives the display from its raw (not normalized) value.
When a damaging Ability is activated, it runs a test to determine what it has hit, then the Ability applies a damage Gameplay Effect to the target Actor.
The GameplayEffectParent_Damage_Basic(or any children that inherit from it), are applied by weapon casts and grenades. Damage is then applied through Execution which converts BaseDamage to Health and filters friendly fire, then the Gameplay Cue GameplayCue.Character.DamageTaken is applied on magnitude to the LyraHealthSet.Health cue.
GCN_Character_DamageTaken is invoked on clients. It is only displayed if the effect instigator is a local player. Damage is determined by the Gameplay Cue's raw magnitude. Location is determined by the hit result's location values, which are passed to the local Controller's ULyraNumberPopComponent. This component handles the display and the pooling, and spawns and configures a Niagara Emitter at the hit location to display the actual damage.
Because of the interaction between the Pawn's possession flow, Game Feature registration, and the various replicated game framework values, a playable character's initialization flow is not always predictable: events can happen out of order, while the client is still waiting for server data.
Lyra solves this by implementing a UPawnExtensionComponent. Its main job is to ensure all relevant initialization conditions for the pawn are met before granting the pawn's AbilitySets and activating any On Spawn Lyra Abilities.
The Pawn Extension Component also keeps track of any abilities granted due to the Pawn and removes them from the possessor's Player State when the character is destroyed or unpossessed.
You can assign Ability Sets to a Pawn through the ULyraPawnData asset. These can be created from the Content Browser, and the default Pawn Data is determined by the Experience Definition.
To initialize the Pawn and assign its abilities, the following conditions must be met:
The default Pawn Data is valid.
The Pawn is possessed by a valid local Controller or has server authority.
What is the Gameplay Ability System and Why Use It?
ULyraAbilitySystemComponent
ULyraGlobalAbilitySystem
ULyraAbilitySet
ULyraGameplayAbility
FLyraGameplayEffectContext
ULyraAttributeSet
Additional Information
Blueprint Asset Naming Conventions
ALyraPlayerState
ALyraGameState
Game Phase Abilities
Input Tag Activation Support
Expanded Tag Relationship System
Activation Group
Activation Policy
K2_CanActivateAbility
Additional Costs
Added and Removed Events
Camera Modes
Type Tags
Native Ability Subclasses
Blueprint Ability Subclasses
ULyraHealthSet
ULyraCombatSet
How Healing and Damage Work
How do Damage Numbers Work?
How are Lyra Characters initialized?
UAbilitySystemComponent
An Ability System Component (ASC) can be added to any Actor to provide it with GAS functionality. This keeps track of the state for that specific Actor, and handles replication.
UAttributeSet
A collection of Attributes, or numeric values with a specific meaning within your game mechanics. Attributes can represent game resources such as 'Health', reference values that can affect other game rules, such as 'Base Attack Power', or even stateless quantities such as 'Applied Damage'. Attribute Sets are responsible for defining, managing and replicating one or more Attribute properties.