Attack Ability
The UCombatAbility_Attack
ability is designed to manage both Melee and Ranged attacks.
It may play a crucial role in the Combo System page. It is integrated with the plugin's animation system, allowing for custom Animation Montages and Motion Warping Targets. For more insights, refer to the Ability Overview page.
Melee Attack
Enabled via the bIsMeleeAttack
flag, the ability reacts to Melee Scan Events (Combat.Event.MeleeScan.Start
and Combat.Event.MeleeScan.Stop
) typically initiated by the ability's animation montage.
A Melee Scan commences upon the Start event, analyzing targets based on the provided UNinjaCombatMeleeScan
settings.
Targets are affected by either the predefined MeleeDamageEffectClass
or, if applicable, an effect from the
ICombatMeleeInterface
's GetHitEffectClass
method.
For an in-depth guide, visit the Melee Combat page.
Ranged Attack
Enabled via the bIsRangedAttack
flag, the ability reacts to the Projectile Launch Event (Combat.Event.Projectile.Launch
)
typically sent by the ability's animation notify.
This event triggers the spawning of a Projectile Actor based on UNinjaCombatProjectileRequest
details.
Then, the spawned Actor, adhering to the ICombatProjectileInterface
, receives a Gameplay Effect Spec through
SetImpactEffectHandle
, enabling effect application to targets independently of the Ability or Avatar.
Projectiles must define their Gameplay Effect classes via the GetImpactEffectClass
of the ICombatProjectileInterface
,
allowing for varied projectile effects under the same Attack Ability.
For an in-depth guide, visit the Ranged Combat page.
Set By Caller values
Both Melee and Projectile effect causers, implementing the appropriate ICombatMeleeInterface
and ICombatProjectileInterface
can override damage and poise consumption values in the applied Gameplay Effect, if these interfaces will actually provide
a value from the functions GetDamage
and GetPoiseConsumption
.
In which case, these values will be set to the Gameplay Effect, via the Combat.Data.Damage
and Combat.Data.PoiseConsumption
Gameplay Tags. This might be useful if you don't want to have a centralized Damage Attribute and instead, want your weapons
or projectiles to have their own damage and poise consumption values.
Customizing Gameplay Effects
This ability allows you to set default Gameplay Effects for Melee Hits and Projectile Impacts (and also the default level used for these Gameplay Effects). You can do so in the Ability's defaults pannel.
If you need more flexibility for that, then please consider the following approaches:
-
For Melee attacks, Via the
ICombatMeleeInterface
, overriding theGetHitEffectClass
andGetHitEffectLevel
functions. In this setup your Melee Weapon (or the owner) will define the Gameplay Effect and level to be applied. -
For Projectile impacts, Via the
ICombatProjectileInterface
, overriding theGetImpactEffectClass
andGetImpactEffectLevel
functions. In this setup your Projectile will define the Gameplay Effect and level to be applied. -
Overriding the internal function that provides the Class and Level for Melee and Ranged Attacks. These are respectivelly
GetMeleeGameplayEffectClass
,GetMeleeGameplayEffectLevel
,GetProjectileGameplayEffectClass
,GetProjectileGameplayEffectLevel
.