-
September 20th, 2024, 00:18 #1
- Join Date
- Feb 2021
- Posts
- 410
Setting visiblity of tokens with Aura
I have an invisibility effect which is a 10'R, so I have the aura extension and it adds the effect of "Invisible", is there any way to also toggle token visibility (both PC and NPC) in the same way so that the token automatically becomes visible when it exits the radius and vice versa? I know for players, you have to right click on the token, then select visibility, then it to "Visibility always off" or something. FOr NPCs it is the little eye toggle on the CT. I would like to do this in a lua function.
Thanks!
-
September 20th, 2024, 02:33 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 21,189
The token visibility is either on, off or LoS-sensitive for a token on a global basis. Those are the options that any extension has to affect token visibility.
For the ruleset code, the CoreRPG behavior is that PC/friendly tokens are always visible by default; and NPC tokens are either off or LoS-sensitive based on the visibility toggle in the combat tracker.
Regards,
JPG
-
September 20th, 2024, 05:44 #3
Only with an extension can you play the effect invisibility sets the map visibility and removing it turns it back to visible. I'd tell you which of my extensions does it but for the life of me I don't remember. And for sure its only in 5E.
[It was Combat Group Extension - I grew annoyed at visibility missing common sense functionality in FGU - these are the two recent changes I added in...
V1.65 - Update - option "Set token visibility when invisible effect added or removed from CT" defaulted to "off" will now allow "Invisible" effect conditions to automatically turn on and off token visibility when the effect is added or removed. Got tired of doing this manually - I've seen timing issues with effect add/delete data but hopefully worked around them. Any effect with a conditional invisible effect will only work properly if the IF: logic is fully supported in a non targeted dumb check - an invisible effect applied through IFT: will never work properly in setting the token visibility. Manually editing an effect to remove Invisible condition may also not process the token visible status properly. I've decided I can live with these limitations to get most things to work as I want. Anything stuck in a token visibility state that is no longer valid will need to be manually right click fixed in map.]
V1.66 - Update - option "Preserve invisible token settings on startup" defaulted to "off" will preserve any token invisible always setting when the app or image gets redisplayed. FGU does not do this as it has a set of hardcoded rules it forces visibility to be set to. You can stay up in app and the invisible token will remain - but if you restart the app it will be back to the CT logic default. This is a pain to manually reset all the invisible tokens when I restart the app so now it is as I want it. I don't want my players seeing invisible other players or NPCs they do not own.
And your free to look at my code how I did it and use that for yourself. As with all my code.Last edited by SilentRuin; September 20th, 2024 at 06:06.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 20th, 2024, 19:30 #4
- Join Date
- Feb 2021
- Posts
- 410
I actually got it to work myself by modifying the manager_effect.lua script, it's pretty simple, for the addEffect function I just added this:
local tokenCT = CombatManager.getTokenFromCT(nodeCT);
if string.find(rNewEffect.sName,"Invisible") then
bTokenVisible = false;
tokenCT.setVisible(bTokenVisible);
end
Did something similar to the removeEffect function. Works well, tokens change visibility dynamically as they move in and out of the Aura!
-
September 20th, 2024, 20:17 #5
Pretty much what I did...
Code:-- determine if Invisible effect was added function checkAddInvisible(effectNode) if OptionsManager.isOption("INVISIBLE_EFFECT", "on") then local effectNode = DB.getChild(effectNode, ".."); local sLabel = DB.getValue(effectNode, "label", ""); local aEffectComps = EffectManager.parseEffect(sLabel); local nodeCT = DB.getChild(effectNode, "..."); if InvisiblePresent(nodeCT, effectNode, aEffectComps) then local tokenCT = CombatManager.getTokenFromCT(nodeCT); tokenCT.setVisible(false); end end end -- determine if Invisible effect was removed function checkRemoveInvisible(effectNode) if OptionsManager.isOption("INVISIBLE_EFFECT", "on") then local effectNode = DB.getChild(effectNode, ".."); local sLabel = DB.getValue(effectNode, "label", ""); local aEffectComps = EffectManager.parseEffect(sLabel); local nodeCT = DB.getChild(effectNode, "..."); if InvisiblePresent(nodeCT, effectNode, aEffectComps) then local tokenCT = CombatManager.getTokenFromCT(nodeCT); if tokenCT then tokenCT.setVisible(nil); end end end end
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
Thread Information
Users Browsing this Thread
There are currently 6 users browsing this thread. (0 members and 6 guests)
Bookmarks