Task Scratchpad

From Able Ability System Wiki

Task Scratchpad[edit]

Recall that Abilities, by default, are state-less and effectively "read only". However, individual Tasks may need to keep track of various information each time they execute (who am I affecting? Do I need to store any values to reset them when I'm done? etc). The Task Scratchpad is a small UObject structure that is allocated by the Task's AllocateScratchPad method every time an Ability is activated to allow Tasks to read/write information. There are a few caveats with Scratchpads:

  • Tasks may return nullptr to prevent a Scratchpad from being allocated - this saves memory, so don't allocate one if you don't need one!
  • Only the Task that created the Scratchpad can access it (no sharing scratchpads between Tasks).
  • Scratchpads aren't replicated between client/server.
  • Scratchpads are deleted at the end of an Ability's execution.
  • In the case of looping Abilities; the Scratchpad is re-used until the looping is finished. So don't leave stale data in your scratchpad!

You can see an example of a Scratchpad structure here: