
Here is a little script I wrote to make flickering torches in D&D 5E
It affects tokens with the name of TORCH, you must set the torches token attributes in the advanced tab to all players see light and the emits light boxes 20,20,360.
To turn the lighting fx on type !LIGHTFX ON.
To turn lighting fx off type !LIGHTFX OFF
It updates every 1/5 of a second. I am not sure if this update rate is too fast. I also thought it would be very easy to adapt the script to make rotating beams of light and to simulate other objects such as candles. One of my players had problems though when I used the script below, it seemed to send his browser into a tail spin. Note the script only animates lights on the page the players are on.
It affects tokens with the name of TORCH, you must set the torches token attributes in the advanced tab to all players see light and the emits light boxes 20,20,360.
To turn the lighting fx on type !LIGHTFX ON.
To turn lighting fx off type !LIGHTFX OFF
It updates every 1/5 of a second. I am not sure if this update rate is too fast. I also thought it would be very easy to adapt the script to make rotating beams of light and to simulate other objects such as candles. One of my players had problems though when I used the script below, it seemed to send his browser into a tail spin. Note the script only animates lights on the page the players are on.
//FLICKER SCRIPT CAUSES OBJECTS WITH A TORCH TOKEN NAME TO FLICKER //WRITTEN BY JACK TAYLOR NOV 2014 FOR THE ROLL20 SCRIPT ENGINE var MyTimer; var light_fx = false; function flicker() { var i,c,r; var Torches = findObjs({ _pageid: Campaign().get("playerpageid"), _type: "graphic", _subtype: "token", name:"TORCH" }); c = Torches.length; for(i=0;i<c;i++) { r = Math.round((0.9 + 0.1 * Math.random()) * 2000) / 100; Torches[i].set("light_radius",r); } }; on("chat:message", function(msg) { try { if(msg.type == "api") { var S = ""; if( msg.content.indexOf("!LIGHTFX ") != -1) { S = msg.content.replace("!LIGHTFX ", ""); if(S=="ON" && !light_fx) { MyTimer=setInterval(function() {flicker()}, 200); light_fx = true; log("LIGHT FX ON"); } if(S=="OFF" && light_fx) { clearInterval(MyTimer); light_fx = false; log("LIGHT FX OFF"); } } } } catch(err) { sendChat("LIGHT FX SCRIPT EXCEPTION",err.message); } //} });