From Wait Delays to Play Montage: 10 useful GAS Ability Tasks

Today you are going to learn some useful Ability Tasks that you can use in you Gameplay Abilities to speed up your development process.

As a refresher, the Gameplay Ability System in Unreal Engine has a kind of object called Ability Task.

Ability Tasks allow you to condense complex behavior into a single node that you can use multiple times to make your work easier.

In the future I will show you how to create them, but today, let’s get right into some useful already existing Ability Tasks.

Wait Delay

This is one of the simplest task of all. The same way that the delay node in blueprint waits for a certain time in seconds, this is the Ability Task version of the delay node.

Why would you want to use this instead of a normal delay node you ask?

That is because the delay node will run no matter what, but this, being an ability task, will abort it’s execution if the ability ends.

So you will not have weird behavior of an ended ability suddenly executing code.

Wait for Attribute Change

Select a GAS Attribute, and this task will fire its On Change delegate once that attribute fires. You can set it to fire only one time and that’s it, or to continue firing every time the attribute changes.

Useful if you have abilities that react to attribute changes, but need to do complex calculations with it.

Wait for Attribute Change Ratio Threshold

Similar to the previous node this reacts to attribute changes, but it allows us to do complex logic that is quite common. Given two attributes, you can compare their ratios using a float, and decide what you are looking for.

This is the task you want to use if you have abilities that do cool stuff when the player is on low health for instance.

You could set the Numerator to Health, Denominator to MaxHealth, Comparison Type to Less Than and Comparison Value to 0.3. Suddenly you have a task that will fire once the player reaches below 30% health, and you can grant a buff to the player, or decide that this is an ability that is only active when player health is above or equal 30%.

As you can see, this is a quite powerful task.

Wait for Ability Activate

This task will fire when an ability with a tag filter provided is Activated.

It is useful if you have abilities that need to do stuff when other Gameplay Ability System abilities activate.

Like, if Dodge ability is activated, a passive ability with this tasks triggers this and spawns a bomb at the player location.

Wait Gameplay Effect Applied to Self

Useful when you want to execute behavior once certain effects are applied to us.

This could be used in a passive ability that has a 10s cooldown that clears any poison that is applied to us. So when a poison effect is applied, if you are not on cooldown, you react and remove the effect.

Wait Gameplay Tag Add to Actor

A simple task that allows us to know when a tag has been applied to an actor. Tags can be a useful way to communicate the Gameplay Ability System with other systems in our project.

So you can have an ability that reacts to the Immune tag is added to us, and spawns a widget on top of the player for instance.

Wait Gameplay Tag Remove from Actor

The same way you can wait for a tag to be added, you can listen for a tag to be removed. Following the previous example you  could also listen to the Immune tag being removed and then destroy the widget you created.

But this is also useful for other kind of behavior, you could have an ability that on activation applies a gameplay effect stack of 5 volatile tags, that can be refreshed via gameplay actions, and listen to when does are removed to cause damage to the player, creating an ability that buffs the player, but if they do not keep up gaining stacks will damage the player.

As you can see we can easily create interesting behavior using Unreal Gameplay Ability System using a simple combination of Abilities, Effects and Tags.

Wait Gameplay Tag Query on Actor

If you need complex queries, instead of asking for multiple tags, you can directly create a Query Task that will trigger once a certain Tag Query is true or false.

This allows you to check for complex situations, like having a player attack hit the enemy with a debuff that once the enemy is Poisoned, Burning and Electrified at the same time, the enemy is instantly killed.

Wait Movement Mode Change

Movement is an important part of a character controller, so being able to react to movement mode changes is very useful.

With this you can make your abilities react to the character starting to fall, or the character actually landing on ground again.

You could have a ground slam ability that propels the character up and then wait for the movement mode to change to not be walking on ground again to spawn an area of damage on the ground.

Play Montage and Wait

Finally, last but not least, you have one of the most useful tasks if you are creating melee combat.

This tasks allows you to play any montage you want on the character that is running the ability, and this will be Gameplay Ability System montage so it will be replicated over network by default.

If you want to create any kind of Combo Attack Ability, a Powerful Attack, a Hit Reaction Ability…. this is the task to use.

You can also wait to the montage being interrupted or finished to trigger other behaviors.

As you can see, Ability Task are and incredibly powerful Unreal Gameplay Ability System tool, and  they allow you to reuse existing behavior to create new complex behavior.

There are more Ability Tasks than this, and if you create your own project I advise you to create the ones you need as well as you go on.

But with these tasks you will be already able to create complex behaviors in your abilities.