> For the complete documentation index, see [llms.txt](https://creationartstudios.gitbook.io/gcc-2.6/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://creationartstudios.gitbook.io/gcc-2.6/api/gameplaytasks.md).

# GameplayTasks

Ability Tasks (C++ class UAbilityTask) are a specialized form of the more general Gameplay Task class intended to work with Gameplay Abilities. Games that use the Gameplay Ability System usually include a variety of custom Ability Tasks which implement their unique gameplay features. They perform asynchronous work during a Gameplay Ability's execution, and have the capability to affect execution flow by calling Delegates (in native C++ code) or moving through one or more output execution pins (in Blueprints). This enables Abilities to execute across multiple frames, and to perform several distinct functions in the same frame. Most Ability Tasks have an execution pin that fires immediately, enabling Blueprint execution to continue after starting a Task. In addition, there are often task-specific pins that will fire after a delay, or following a certain event that may or may not happen.

Ability Tasks can self-terminate by calling the EndTask function, or it can wait to be terminated automatically when the Gameplay Ability that ran it ends. This prevents phantom Ability Tasks from running, effectively leaking CPU cycles and memory. For example, one Ability Task might play a spell-casting animation while another places a targeting reticule at the player's aim point. The Gameplay Ability could end if the player either hits the Confirm input to cast the spell, or waits for the animation to finish without confirming the spell. Although they can self-terminate at any time, the Ability Tasks are guaranteed to end, at latest, when the main Ability ends.

NOTE:

`Ability Tasks are designed to be used in both networked and non-networked environments, although they do not directly update themselves across the network. They generally stay in sync indirectly, since they are created by Gameplay Abilities (which do replicate), and use replicated information, such as player input or networked variables, to determine their execution flow.`

Taken from : [Official Documentation](https://docs.unrealengine.com/5.1/en-US/gameplay-ability-tasks-in-unreal-engine/)

## PlayMontageAndWaitForEvent

![Image](https://khxisaki.github.io/CommonGASDocs/img/playmontageandwaitforevent.png)

| Name                                       | Types                |
| ------------------------------------------ | -------------------- |
| Task Instance Name (Input)                 | FName                |
| Montage To Play (Input)                    | UAnimMontage         |
| Event Tags (Input)                         | GameplayTagContainer |
| Rate (Input)                               | Float                |
| Start Section (Input)                      | FName                |
| Stop when Ability Ends (Input)             | Boolean              |
| Anim Root Motion Translation Scale (Input) | Float                |

| Name                    | Types                                                        |
| ----------------------- | ------------------------------------------------------------ |
| Async Task (Output)     |                                                              |
| On Completed (Output)   | The montage completely finished playing                      |
| On Blend Out (Output)   | The montage started blending out                             |
| On Interrupted (Output) | The montage was interrupted                                  |
| On Cancelled (Output)   | The ability task was explicitly cancelled by another ability |
| Event Received (Output) | One of the triggering gameplay events happened               |
| Event Tags (Output)     | GameplayTag                                                  |
| Event Data (Output)     | GameplayEventData                                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://creationartstudios.gitbook.io/gcc-2.6/api/gameplaytasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
