checkLightLevel v0.4.2 GitHub repo This script requires Path Math (available from the one-click library) Description: A simple script to check the current light level of the selected token ( originally from Craig M's thread ). The script will process all relevant light emitters on the map, determine their light level if in range, and whether or not the light is blocked. Usage: Select a token and type: !checkLight Example output: Limitations: The blocking check for walls is currently a simple center-to-center
check. If the center of a token has unblocked LOS to the center of a
light-emitting token, it is considered to be lit by that emitter. The light radius check is also center-to-center. The bigger a token is, the more of it could be visible inside a dim light source even though it's considered to be out of that light source's range, due to its center being outside the light's radius. This is difficult to address, as (at least in 5e) a token doesn't actually fill the grid squares the token is in, it only controls that space. Any kind of calculation on a token with an edge lit would need to make a heap of assumptions, and probably isn't worth doing. For those reasons I'd recommend keeping a light source as a full grid size where possible, as the calculations will be more accurate External Usage: The total illumination on a target can be called from Plugger , part of the Meta Toolbox. Details in the v0.4.1 post. checkLightLevel can also be called from other scripts: checkLightLevel.isLitBy(tokenOrTokenId) Example return: { bright: false, dim: [<token>, <token>], daylight: 0.3, total: 0.75 } This would indicate a token lit by 2 dim sources, with a map daylight setting of 30%, with a total illumination of 75%. Changes: v0.3.0: Added support for one way walls Added public method to call the script from other scripts v0.4.1: dim light falloff calculations additive light sources minor metamancy tokens on gmLayer no longer included in light calcs see post for details