-
Notifications
You must be signed in to change notification settings - Fork 2
Example: Pit
This zone introduces a pit into the map which is triggered by token movement using the Aura trigger. The idea behind this zone is that the area has random sinkholes that open up when body weight is applied to it. The danger creates the entangle visual effect and 4 walls around the target area and adds an active effect that implements the prone condition. It then triggers a macro to force saving throws by all tokens targeted within the pit, dealing full damage to those that fail and moving their elevation to the bottom of the pit.
Note that the wall bottom and top are set to the zone's depth, which requires the module Wall Height in order to make it appear to those not in the pit that the pit is in the ground. To achieve this effect, the zone is also set to 'Descend from top', making it so that the depth will always have at the top a 0 elevation but at bottom a random depth up to the zone's bottom and accounting for the danger depth. Note also that the zone's top is set to 1, because the target area extends up to, but not including, the zone top. Setting a top of 1 indicates that the maximum top elevation would be 0.


- JB2A Patreon webm: Entangle_01_Yellow_400x400.webm
- Game-icons.net: earth-split.svg
- Forgotten Adventures: token
- Advanced Macros (for passing the arguments from Danger Zone into the macro)
- MidiQol (not required, but made writing the macro easier)
- Wall Height (for applying a top and bottom to the walls created, effectively making them have a top of 0 and a bottom randomly set by the zone between -50 and -1.
- Tagger (for adding a zone exclusion to the lasting effect tile, so that the zone isn't retriggered when the token's depth is changed by the macro on failed saves.
- DFred's Convenient Effects: not essential, but simplifies adding the prone effect within the danger's active effect.
With Foundry VTT 9 using Danger Zone 1.0.4 or higher, the below can now be replaced by directly using the Token Interaction danger part which includes tabs for saving throws and token damage.
/* Requires midiQol. For DND5e this macro executes a dexterity saving throw (DC16) on targeted tokens and, if those fail, applies damage of 1d6 bludgeoning for each 10 feet of elevation they fall (assumes from depth 0). For those that fail, also sets their elevation equal to the bottom of the target area (i.e the pit bottom).
Because this macro is updating the token's elevation and because the zone is triggered by movement (using Aura trigger), it is important that the zone exclusion tag is included on the lasting effect tile (this can be configured in the danger). If you don't mark the area with an exclusion tag the zone will continue to trigger in a loop as the token's elevation is updated by the macro (because this reads as movement). */
let tokens = args[0].targets, failed = [], updates= []; const floor = args[0].targetBoundary.bottom; const depth = Math.abs(floor); if(!tokens?.length) {return}
let damageRoll = await new Roll(${Math.floor(depth/10)}d6).evaluate()
for(let token of tokens){ let save = await token.actor.rollAbilitySave("dex"); if(save.total <= 16) { failed.push(token); } updates.push({"_id":token.id, "elevation": floor}) ; }
if(failed.length){
//game.dice3d?.showForRoll(damageRoll);
await new MidiQOL.DamageOnlyWorkflow(null, null, damageRoll.total, "bludgeoning", failed, damageRoll, {flavor: Targets fall ${depth} feet into a pit, taking ${damageRoll.result} bludgeoning damage and are prone.});
}
canvas.scene.updateEmbeddedDocuments("Token",updates);