Custom Task















A Custom Task is a Blueprint Driven Task that allows users to create their own Tasks without any C++. A Custom Task is made up of two parts:

  • The Custom Task itself - which is where you write all your logic for your Task (e.g. what you want the Task to do).
  • The Custom ScratchPad - a small data structure allocated anytime your Task is executed, this is used to store any data your Task may need.

Custom Scratch Pad

Remember, in Able, Abilities aren't allocated in memory every time you play an Ability. If you have 10 Actors all playing the same Ability, there is only ever 1 Ability object instantiated. However, a smaller structure, called a Scratch Pad is allocated per Ability execution. This is so Abilities can track any variables or states they need during their execution.

To create a Custom Scratch Pad, just create a Blueprint Object and have it inherit from UAblCustomTaskScratchPad. Other than that, you can just add variables like any normal blueprint object.

Custom Task + Hooking Up Your Custom Scratch Pad

Custom Tasks are Blueprint Objects that inherit from UAblCustomTask, it provides several overrides you can fill out that will help define your Task:

  • OnTaskStartBP - Called when the Task begins execution.
  • OnTaskTickBP - Called when the Task Ticks (this only executes if IsSingleFrameBP return false).
  • OnTaskEndBP - Called when a Task ends.
  • IsSingleFrameBP - Returns true if this Task only takes 1 frame, or false if it needs multiple frames to execute.
  • IsDoneBP - Called every frame while the Task executes to check if it's finished and should begin clean up. By Default, this simply checks the Ability execution time and sees if our Task has gone over it's window of time. However if you needed a specific event to occur before you let the Task finish up - you could put that behavior here.
  • CreateScratchPadBP - Used to instantiate your Custom Scratch Pad.
  • GetTaskRealmBP - Gets the Realm (Client, Server, or Both) for this Task.
  • GetTaskCategoryBP - Returns the Category to place this Task in within the Ability Editor (supports "Category|SubCategory" formatting).
  • GetTaskNameBP - Returns the name of the Task to display within the Ability Editor.
  • GetDescriptiveTaskNameBP - Returns a more descriptive name you can build at runtime based on parameters that will show up in the Timeline within the Ability Editor.
  • GetTaskDescriptionBP - Returns the description of the Task, displayed when creating new Tasks within the Ability Editor.
  • GetTaskColorBP - Returns the color of the Task when on the Ability Editor Timeline.

As you can see, creating a Custom Task merely involves filling those overrides out as needed and Able will handle the rest. They all have default versions, so don't worry if you forget to fill one out - at worst you'll get some unexpected behavior and you can just hop back to your blueprint and add whatever Override is missing.

Hooking up Custom Scratch Pad

Adding your Custom Scratch Pad to your Custom Task requires simply overriding CreateScratchPadBP and calling CreateCustomScratchPad with the name of your Custom Scratch Pad class.

Putting It All Together

Once you have your Custom Scratch Pad hooked up, you can simply fill out the rest of your Ability overrides and test things out in the Ability Editor, in the example below I simply override OnTaskStartBP, have it grab the Task Targets using GetActorsForTask (which is set in the Ability Editor like normal Tasks), print out all the names of the Targets, grab our Scratch Pad, and simply print out a field from that.


That's it! Super easy and very powerful.