Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

[Script] Darkness - Darkness and Fog effects for Roll20

1792528746
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Darkness is a new script for modeling the Darkness and Fog Cloud spells, and similar magical darkness or obscuring clouds, with dynamic lighting. The usual approaches each have a drawback. Dynamic lighting walls block movement. Turning vision on and off means tracking which tokens had vision to begin with. This script places an opaque image on the foreground layer and changes only the settings it needs to, saving and restoring each one. [ Demo video ] [ Code - until One-Click ] What a field does Tokens inside a field cannot see. Their field of vision and night vision are set to 0 degrees, so darkvision does not help. Inside darkness, light sources on any layer are put out. Fog does not affect light. Where the two overlap, darkness wins. Nameplates, bars and auras of tokens inside a field are hidden from players. Everything is restored when the token leaves, or when the field is turned off or deleted. Tokens move in and out freely, and so does the field. Moving or resizing the field rechecks every token on the page. How to use it Type !darkness in chat to open the menu. Select a token (or a group, or nothing) and click Place Darkness Token. It is placed beside the token, at the center of the group, or in the middle of the page with your view pulled there. Click Darkness (15 ft), Fog Cloud (20 ft), Custom (any effect and radius) or Emanation. Each effect gets its own panel in the menu with buttons to switch type, manage immunity, locate it, turn it off or delete it. Effects are labeled (Darkness A, Fog B) with a nameplate only the GM sees, so several at once stay easy to tell apart. The bottom of the menu has All Off, Delete All and Refresh. Emanation Emanation centers the field on a creature and measures the radius from the edge of its space. The field follows the creature as it moves and is deleted when the creature is deleted. This covers Darkness cast on an object a creature carries, or a creature with a darkness aura. Immunity Creatures with Devil's Sight, blindsight or truesight can be added to a darkness list or a fog list. Click + Immune in the menu, then click the creature. Immune creatures keep their sight in that type of field. Their lights and nameplates are still affected. Setup There is none beyond installing. The first placement creates a GM-only character named Darkness Effect. Its token actions repeat the menu's controls, and its GM Notes hold the immunity lists. !darkness --setup repairs it if needed. Works with Token changes made through TokenMod, ScriptCards and SmartAoE are detected. If anything else moves a token without notice, the Refresh button corrects it. Questions, bug reports and suggestions are welcome in this thread. Type !darkness --help in game, or click the ? on any menu, for the in-game help. An earlier version of this appeared on my Patreon .
1792528759
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Reserved
Keith, Looks amazing as always. I recently ran a drow campaign and used Nick Olivo's darkness script but your version works better in my opinion and also has the fog function. Have you though about blindsight with specific ranges ?. One of my players has the blind fighting feat which gives blindsight for 10ft and based on the video I'm not sure if there's a way to set this up. Was waiting for the script to appear in 1 clock before installing
1792678039
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The biggest drawback to using the Foreground Layer for a darkness field is that it's all or nothing. I could add in player-specific visible auras and nameplates, but that gets very complicated very quickly. I'll have to give it some thought.
If the Roll20 devs ever figure out how to assign specific visibility tokens it will make a lot of things possible. I'm referring to allowing certain tokens to be visible to only certain players, similar to how the visibility of specific handouts and character sheets can be designated.
1792682985
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Rick A. said: If the Roll20 devs ever figure out how to assign specific visibility tokens it will make a lot of things possible. I'm referring to allowing certain tokens to be visible to only certain players, similar to how the visibility of specific handouts and character sheets can be designated. That would be handy. There's a lot of cool things you could do with that. It also could make some instances of troubleshooting very difficult.
Increasing the number of things that can be done always increases the number of things that can be done incorrectly :D keithcurtis said: That would be handy. There's a lot of cool things you could do with that. It also could make some instances of troubleshooting very difficult.
1792697356
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Rick A. said: Increasing the number of things that can be done always increases the number of things that can be done incorrectly. I am dubbing this "Rick's Law".
1792828517

Edited 1792830532
Hiya Keith, I have just finished my own API for this that automates the immunity for truesight, devil's sight and the shadow magic sorc subclass (on cast they can spend points to see in their own spell) .  I like your use of the foreground layer since it sidesteps the dynamic lighting requirement, is there any way to customise the effect (I have one I particularly like -see pics)? Never mind - that wouldn't work (I've just loaded your API).  I am having some trouble - I can spawn in the initial generic token, move it to desired place and then click darkness, with Sae previously selected as immune, but Sae still can't see within the area?  GM view to left, Player View to Right (ie NOT CTRL+L).  Tested with a full dummy account login too
1792854711
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I mention that either above or in the video. This technique is not perfect when using Truesight, Devil's Sight, etc. Roll20 does not allow for that level of granularity for the foreground Layer, unfortunately.
Thanks Keith.  I hadn't thought of the foreground layer and really like the option to tag a token as being able to see.  Love your structure for APIs, always so clean as a UI
1792872078
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thank you!