Ability


Ability is a base class for all abilities such as Fireball, Vortex etc.
It only contains definitions of functions that should be appropriately overwritten in its children blueprints.


There are bunch of variables that we can tweak to customize ability.

  • IsUsingCrosshair - whether crosshair should be visible when ability is pressed, usefull for projectiel abilities like Fireball
  • CrosshairTexture - texture of crosshair if it's visible
  • Damage - damage applied to hit actor
  • IncludeOwnerDamage - whether damage of the owner should be included to hit actor
  • OwnerDamageScalar - if owner damage is being included, it will be multiplied by this value
  • ImpulsePower - impulse power value applied to hit actor
  • LeftHandSocket - socket name of left hand ablity spawn spot
  • RightHandSocket - socket name of right hand ablity spawn spot
  • BeamSocket - socket name of between hands ablity spawn spot
  • IndicatorRadius - radius of indicator
  • IndicatorMaterial - indicator material
  • AbilityMontages - array of montages used by ability
  • CanBeCancelled - whether ability can be canceled by owner when it already started casting
  • RotateOnPressed - whether owner should rotate towards camera when ability input is being pressed
  • ManaCost - mana cost of ability
  • EffectTransform - place where ability is being used, e.g vortex transform, fireball spawn transform etc.


There are 2 available children blueprints of Ability that new abilities should be created from

  • Ability_Player - Base class for abilities used by Player
  • Ability_AI - Base class for abilities used by AI

They have implemented usefull functions which helps getting ability effect transforms e.g SurfaceTransform for abilities using indicators, CrosshairTransform for ability using crosshair etc.


As an example lets take a look at Ability_Player_InstantHeal.

It doesn't override event Pressed, so it doesn't care whether ability input is being pressed or not.
But when ability input is released, it tries to start ability using function from AbilityComponent, if return value was true, then it plays ability montage.

Heal Montage has ANS_AbilityEffect notify in it.

When this notify Begin event is triggered, it calls AbilityEffect function from AbilityComponent.

AbilityEffect function in turn is calling Effect function from ability, which heals the owner, spawns particle, plays sound and consumes mana.

And when End event of notify is triggered, it calls EndAbility function from AbilityComponent.


A bit more complex ability is Ability_Player_DrainHealth.

Whenever ability is Pressed, it tries to cast it, but if it fails then sets a timer which will continue to attempt, until ability is Released or Ends.
This way if ability was pressed for example during Rolling, it will start casting automatically without need to press input again right after it ends rolling.

Montage used by this ability is divided into few sections

  • Start
  • Loop
  • End

On ability Pressed it is played from Start and remain in Loop section.
On ability Released or End montage is played from section End.

During the montage, notify AbilityEffect is calling function with same name from AbilityComponent which in turn is calling Effect function from ability.

Event Effect is setting EffectEnabled variable to true, then spawning beam particle and sound.

Then Event Tick updates effect (its transform), consumes mana, and checks whether there are any enemies hit by this ability.