Skip to content

Adding System Support

otigon edited this page Oct 16, 2021 · 10 revisions

Automated Animations access to a few key pieces of information for the module to work.

  1. Item: The Item instance that is being used
  2. Source Token: The Token that is using the Item
  3. Target(s): The current targets when the Item is used/rolled

For MOST systems, this data is obtained using the createChatMessage hook. Other systems, such as Warhammer, provide system specific hooks that can be used to grab the information.

Furthermore, many systems roll separately for Attack and Damage. The Chat Message needs to be evaluated in these cases to determine if the player is rolling an Attack or Damage, OR in some cases the item has neither an Attack OR Damage roll, so that would need to be evaluated as well.

Some systems, such as Pathfinder 1, do not separate these rolls and instead put all the information to the chat card at once. These types of systems are much easier to parse.

NOTE: NOT ALL SYSTEMS CAN BE ADDED INTO AUTOMATED ANIMATIONS.
What this means is that many systems do not pass the required data to allow Automated Animations to work. Feature requests can be added for those systems to add this data to either the createChatMessage hook OR by way of their own system hooks.

Let's look at an easy example using the Pathfinder 1 system:

Pathfinder 1 example

First, let's start by logging the hooks to the browser Console by entering this in the console:
CONFIG.debug.hooks = true
I'll target a token and roll an item, in this instance a Shortsword.
In the Console, you will see the createChatMessage hook after you roll the item:

Here you will see that the PF1 system logs the Item used in the chat message under itemSource. We can grab the Item ID from here!
Under data you will find speaker.token which gives us the Token ID that used the item.
Under user you will find a list of targets as a Set.
Given the information above, we now have enough data to get Automated Animations up and running

Clone this wiki locally