Skip to content

WIP Do you want to build a campfire

Crowguard edited this page Dec 14, 2023 · 38 revisions

Do You Want to Build a Campfire?

This page will walkthrough various levels of building a campfire, starting at extremely basic, and going well past what's actually needed.

Beginner

These first few steps are basic options you can use to configure your tile.

Base Campfire

  1. On the Setup tab, remove any existing trigger and add the Double-Click trigger.
  2. Add your images to the Images tab. In my example here, the first image is the unlit one, while the second image is the lit one.
  3. Add a Switch Tile Image, targeting the tile itself. For now, you can leave the Change to field on next.
  4. Add an Activate/Deactivate action; this example Uses Tagger to target a light that has the matching tag Light on it. Change the State dropdown to Toggle for now.

Now the tile image should be synced up with the light and your campfire has a basic on/off button.

Distance Filter

What if you don't want your players controlling the campfire from all the way across the map? Then add a Filter Tokens by Distance.

  1. Add the Filter Tokens by Distance; while you can use Current Token at this stage, it should be targeting the Triggering Token to future proof this action, and just to make it a habit. Leave the other settings of this filter on the defaults for now.

Add a "Not Close Enough" Branch

Now we're going to branch the action flow; if there isn't a triggering token close enough to the tile, it will instead send that player a notification.

  1. Change your Filter Tokens by Distance's Continue If dropdown to Always Continue.
  2. Add a Check Entity Count into the action list after the distance filter; it needs to be Current Tokens here, to tell the action flow to see if a Current Token exists that made it through the previous filter.
    • The count field should stay at > 0.
    • The Go To field should be the name of a Landing that the action list will go to if the count isn't found. Capitalization and symbols matter.
  3. Add a Landing at the end of the action thread.
    • Check the Stop When Reached in Code box on the landing; this makes the landing create an entirely new action thread, instead of being an extension of the original one above it.
  4. Add a Send Notification in the new action thread created by this landing.

Add a GM Auto-Landing

For the final beginner step, we're going to add an Auto-Landing that allows the Gamemaster to skip the distance filter so that they can toggle the fire even without controlling a token nearby.

  1. Add another Landing below the Check Entity Count.
    • Name it _gm; this auto-landing will cause any Gamemaster level users to automatically start in the action list at this point and skip the distance filter.
    • Leave Stop When Reached in Code unchecked this time; this will allow the action thread to continue from above.

Advanced

Adding Different Dialog Options

Now let's add different dialogs with options depending on the current state of the campfire.

  1. Add a Jump to Landing below the _gm auto-landing. This needs to be named {{tile.flags.monks-active-tiles.fileindex}} to make use of Handlebar Expressions. When this jump is reached in the code, the handlebar expression will be replaced with this tile's file index value, which will be either 0 (for the first, unlit image) or 1 (for the second, lit image).
    • While the images start being numbered at 1 for the purposes of Switch Tile Image, due to how arrays work in code, the first image is actually number 0 here, and the second image is 1.
  2. Add another Landing and name it 0. This will be the landing that is jumped to when the campfire is unlit.
    • It does not matter whether Stop When Reached in Code is checked in this instance, as it will never be reached by following the code normally as the jump just above it redirects the code.
  3. Place a Show Dialog in this action thread.
    • Use the Custom type in the Dialog Type dropdown.
    • Use Add Buttons to add two buttons; the "Light the fire" one should include a Landing name that matches the landing we'll be adding later. The "Do nothing" button can leave the landing name blank, as it doesn't need to go anywhere.
  4. Add another Landing and name it 0. This will be the landing that is jumped to when the "Light the fire" button is pressed in the previous dialog.
    • Stop When Reached in Code does matter here; otherwise if the dialog is closed without making a choice the action thread will continue down from the dialog and light the campfire.
  5. Move your Activate/Deactivate and Switch Tile Image to this "Light" landing.
    • Change the Switch Tile Image from next to 2 to match the images tab.
    • Change the Activate/Deactivate from Toggle to Activate,
  6. Repeat steps 2 through 5, adjusting names & settings to instead extinguish the campfire.
Clone this wiki locally