The Ability Context is the setup for the Ability's runtime. Tasks and other segments of the Ability reference various actors within the Context using Context Target Types. On this page we'll be exploring the various Target Types and what they mean, as well as the various Blueprint methods you can use to get information about the Ability from the Context. This knowledge is important due to when you are interacting with an Ability through Blueprints, you will generally be accessing data through the Ability Context.


Self

The Self Target Type refers to the Actor that is currently executing the Ability. If Player A is executing a Fireball Ability, the Self Actor would be Player A. The Self Actor is automatically set by C++ once the Ability Context is created.

Instigator

The Instigator Target Type references the Actor that caused this Ability to occur. If you had a Trap that played some Ability when a Player stepped on a button or some other device, the Player who stepped on the device would be the Instigator. The Instigator is an optional parameter so you should always use IsValid checks (in C++ or Blueprints) to verify that the Actor exists.

Owner

The Owner Target Type is a way to specify an optional Owner of the Ability (rather than the Self Target Type). For example, if you had a character who could summon pets (i.e. a Golem) and that Golem cast their own Abilities, you could set the Owner to summoner of the Golem and use that knowledge to help scale damage, query stats, apply aggro, etc to the Owner rather than the Golem itself. Like Instigator, this Target Type is optional so it should always be checked via the IsValid methods in C++ and Blueprints.

Target Actor

The Target Actor Target Type is an array of the Target Actors of an Ability. This Target Type can be populated in a number of ways, the most common is using the Targeting logic in the Ability. However, you can also populate it during Ability execution using the Collision Query / Sweep / Raycast tasks and selecting the "Copy to Context" option. That information is then available to the Context the frame after the Task completes and is Async safe. If the Ability doesn't require targets, then this array is simply empty.

Camera

The Camera Target Type references the current camera of the Self target type. It is mainly used to by location based Task properties to get the Camera transform. Setting the Target of a Task (for example, Apply Damage) to Camera will simply return the Self Actor.



Blueprint Library Methods

Return TypeNameParametersDescription
UAblAbilityContextCreateAbilityContext
  • (UAblAbility) Ability - The Ability to execute.
  • (UAblAbilityComponent) Ability Component - The Ability Component that will be executing this Ability.
  • (AActor) Owner - The Actor to set as the Owner of this Ability (optional).
  • (AActor) Instigator - The Actor to set as the Instigator of this Ability (optional).
Creates and returns an Ability Context.


Context Methods

Return TypeNameParameters Description
AActorGetSelfActor
Returns the Self Target Type Actor
UAblAbilityComponentGetSelfAbilityComponent
Returns the Ability Component of the Self Actor
AActorGetOwner
Returns the Owner Target Type Actor
AActorGetInstigator
Returns the Instigator Target Type Actor
Array<AActor>GetTargetActors
Returns the Target Actor Target Type Array of Actors
IntegerGetCurrentStackCount
Returns the current stack count of the Ability. Default = 1.
None (Void)SetStackCountIntegerSets the current stack count of the Ability. This is normally automatically done through the stacking system, but you can override it using this method.
FloatGetCurrentTime
Retrieves the current time of the Ability.
FloatGetLastDeltaTime
Retrieves the last delta time used when updating the Ability.