Registering Custom Dynamic Token Rings in Foundry VTT

PSA time! I doubt there are many people out there who want to engage with custom Foundry work, and fewer still who specifically have a bee in their bonnet about the dynamic token rings that were added as core functionality since Foundry V12. However, for those three people, I have figured out how to make and register your own dynamic token rings. You’re welcome.

Spritesheet

Dynamic token rings use a spritesheet in .webp format divided into frames demarcated by an accompanying JSON file. The Foundry documentation is actually useful here, showing you where the default spritesheets and json are located. As of V12, it’s /public/canvas/tokens/rings-steel.webp. and /public/canvas/tokens/rings-steel.json.

One of the default Foundry dynamic ring spritesheets, overlaid with the areas described by the json file

Ring vs. Background

The dynamic ring has a background frame that can have effects applied to it in-game, such as a color overlay or wave effects. It also has a separate “ring” area (I know, your ring has a ring) that can take a separate color and some additional effects. While the background frame is pretty obvious, setting the portion of the dynamic token that counts as the “ring” can be tricky.

"config": {
  "defaultColorBand": {
    "startRadius": 0.59,
    "endRadius": 0.7225
  }
}

The ring area must be circular, because it’s defined by the inner and outer radius from the token center. It’s a donut (or a full circle if you set startRadius to zero I suppose). The two radius attributes are the percentage from the token center to the frame edge:

In this example, the purple overlay would be startRadius 0.5 and endRadius 1.0. The “ring” area begins 50% from the center and extends the full width of the token.

Module/System Initialization

You have to register the spritesheet in your code, which is glossed over in the official documentation, much to my chagrin. The answer to this was buried within a feature request on github.

In my case, I’m working on a custom game system so I’m putting this in my systems/CUSTOM-SYSTEM-NAME/module/CUSTOM-SYSTEM-NAME.js file, but I imagine if you are building a module or something instead, wherever you initiate your custom code will work for this.

Hooks.on("initializeDynamicTokenRingConfig", ringConfig => {
  const myCustomRings = new foundry.canvas.tokens.DynamicRingData({
    label: "Your Custom Rings",
    effects: {
      RING_PULSE: "TOKEN.RING.EFFECTS.RING_PULSE",
      RING_GRADIENT: "TOKEN.RING.EFFECTS.RING_GRADIENT",
      BKG_WAVE: "TOKEN.RING.EFFECTS.BKG_WAVE"
    },
    spritesheet: "PATH/TO/YOUR/FILES/rings-custom.json"
  });
  ringConfig.addConfig("myCustomRings", myCustomRings);
});

Once you’ve done all that, your dynamic token rings should be selectable in Game Settings alongside the default Steel and Bronze rings.


More From: , ,

3dprinting 5e 24XX 28mm art bladesinthedark boardgames carchases cortex cortexprime Crafting design dnd fitd forgedinthedark foundryvtt g+ Gaming heartbreaker heroforge insomniacsrpg itch.io junkd miniatures minis monsteroftheweek motw outlawcountry pbta playtest roll20 rpg save scifi shapeways space spaceships starwars terrain thunderroad tightrope ttrpg wargaming whitelinenightmare xmas

One response to “Registering Custom Dynamic Token Rings in Foundry VTT”

  1. Tokens for VTTs, Part 2 – Don't Roll a One Avatar

    […] Foundry VTT, I also set the token scaling to 1.3. I use custom dynamic rings to add a drop shadow, and those I leave scaled to […]

    Like

Leave a comment