NOTE: If you are a javascript developer and not a typescript developer, you can just use the javascript files under the dist folder
Author: Greg Ludington
Invisible Stalkers should only be seen by players that have cast See Invisibility. Stealthy Goblins should only be seen by players with high perception. And when that Drow casts Darkness, players should need Devil's Sight to see any tokens inside.
Conditional Visibility allows you to set conditions on tokens that will display them only to players whose senses meet the conditions necessary to see the token.
It's always easiest to install modules from the in game add-on browser.
To install this module manually:
- Inside the Foundry "Configuration and Setup" screen, click "Add-on Modules"
- Click "Install Module"
- In the "Manifest URL" field, paste the following url:
https://raw.githubusercontent.com/p4535992/conditional-visibility/master/src/module.json
- Click 'Install' and wait for installation to complete
- Don't forget to enable the module in game using the "Manage Module" button
This module uses the libWrapper library for wrapping core methods. It is a hard dependency and it is recommended for the best experience and compatibility with other modules.
This module uses the socketlib library for wrapping core methods. It is a hard dependency and it is recommended for the best experience and compatibility with other modules.
Conditional Visibility works by adding new conditions to the conditions panel, for Invisible, Obscured, In Magical Darkness, and Hidden (currently 5e Only). It does not work for game systems that use their own condition systems, though discussion (and pull requests!) are certainly welcomed from those more familiar with those systems. Pathfinder 2e has partial support now, using the system's default Invisible condition.
When a token has one of these conditions, it can only be seen by a token with the proper senses configured in their Vision panel.
Put it together, it looks like this (click to play on YouTube):
Hidden (currently 5e only)
When the hidden condition is selected, a stealth roll is automatically made, which can be customized before closing. The token will only be seen by a token whose passive perception exceeds that stealth roll. (click to play on YouTube):
New to version 0.0.8, script entry points are created for macro and script authors. The following methods are supported:
ConditionalVisibility.help()
(GM only) pops up a dialog showing the current system, available conditions, and configuration status.
ConditionalVisibility.setCondition(tokens, condition, value)
- tokens - an array of tokens to affect
- condition - the name of the condition, e.g. invisible or indarkness. You can check the available names for your system in the
help()
dialog. - value true to turn the condition on, false to turn it off
For example, if you want to set all the selected tokens invisible:
ConditionalVisibility.setCondition(canvas.tokens.controlled, 'invisible', true)
The hidden condition requires system specific rules, and so uses a different set of methods. Note this is only available on systems that have these rules developed, currently only D&D 5e. Issues or contributions for other issues are welcome.
ConditionalVisibility.hide(tokens, value)
- tokens - a list of tokens to affect
- value - optional; a flat value to apply to all tokens. If not specified, each token will make system-specific roll.
ConditionalVisibility.unHide(tokens)
- tokens - a list of tokens from which to remove the hidden condition.
Conditional Visibility contains an setting to auto-apply the hidden condition based on a stealth roll. Currently only 5e; again, contributions for other systems are welcomed.
When this setting is true, then rolling stealth from that token's character sheet will apply the hidden condition based on the value of that roll.
- Navigate to the Foundry Setup screen and click on the Modules tab
- Click Install Module and paste the module.json link from the latest release into the box. (Currently, https://github.com/p4535992/conditional-visibility/releases/download/v0.0.6/module.json )
- Once the conditional-visibility module is installed, open your desired world and navigate to the
Game Settings
>Configure Settings
>Module Settings
and enable the module
If you use Combat Utility Belt and check "Remove Default Status Effects," it will remove those Status Effects necessary for this module to function. They can be re-added using Combat Utility Belt's Condition Lab:
If each condition is added to the CUB set, Conditional Visibility will again function, even if CUB has removed the default set. The pairs would be:
Invisible
- modules/conditional-visibility/icons/unknown.svg
Obscured
- modules/conditional-visibility/icons/foggy.svg
In Darkness
- modules/conditional-visibility/icons/moon.svg
Hidden (5e only)
- modules/conditional-visibility/icons/newspaper.svg
- Pathfinder 2e supports only the "Invisible" condition.
- Will not work if the hide regular conditions options of Combat Utility Belt is checked, as it hides the required Conditional Visibility conditions
Any issues, bugs, or feature requests are always welcome to be reported directly to the Issue Tracker, or using the Bug Reporter Module.
This package is under an MIT license and the Foundry Virtual Tabletop Limited License Agreement for module development.
Bootstrapped with League of Extraordinary FoundryVTT Developers foundry-vtt-types.
Icons by
- unknown.svg, newspaper.svg, and foggy.svg icons made by Freepik, from www.flaticon.com
- moon.svg icon made by iconixar from www.flaticon.com
Thanks to anyone who helps me with this code! I appreciate the user community's feedback on this project!
Very special ty to Szefo09 for make a full operational patch for Dnd5e with FoundryVtt 0.8.6
Very special ty to Teshynil for make many and many test with bug fix