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 .
×
Create a free account

Map assets all have vision... Any way to turn all of them off?

So I thought that UDL was completely borked for me, until I noticed that all the map assets on my maps have vision. I've now turned off that tokens automatically have vision, since I've found out that was the culprit. Now I have the issue that all my (very elaborate, multi-layer) maps have still have vision, and I need to change that. I tried a quick script fix from The Aaron from a previous post, but that was 3 years old and didn't work, so now I'm a little bit lost. Does anyone have a way to turn off vision from everything on a map? Since it's map assets, the "token" assets aren't tied to a sheet or anything, so it has to work with that. I don't mind if I have to move all the assets to Token Layer first, just that I can do them all at once, one map at a time.
1633763785
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you have some js ability, you might be able to adapt this script by the Aaron to UDL.
1633794164

Edited 1633794876
Unfortunately I have no scripting abilities at all... I don't mind if everything loses vision, since that is easier (and far less time-consuming) to rectify than the map situation, but will it work for graphic on a map that isn't tied to a sheet? EDIT: I've just tried to make a copy of the game, adding that script, and it didn't work on the map assets unfortunately...
1633915273
The Aaron
Roll20 Production Team
API Scripter
Here's a version of that script that works with UDL: on('ready',()=>{ const playerCanControl = (obj, playerid='any') => { const playerInControlledByList = (list, playerid) => list.includes('all') || list.includes(playerid) || ('any'===playerid && list.length); let players = obj.get('controlledby') .split(/,/) .filter(s=>s.length); if(playerInControlledByList(players,playerid)){ return true; } if('' !== obj.get('represents') ) { players = (getObj('character',obj.get('represents')) || {get: function(){return '';} } ) .get('controlledby').split(/,/) .filter(s=>s.length); return playerInControlledByList(players,playerid); } return false; }; const setHasSightByClass = (args) => { let filter = () => true; switch(args.type.toLowerCase()){ default: case 'npcs': filter=(t)=> ! playerCanControl(t); break; case 'players': filter=(t)=> playerCanControl(t); break; case 'all': break; } let opts = { type: 'graphic', subtype: 'token' }; let setOpts = {}; let msgs = []; if(args.hasOwnProperty("value")){ setOpts.has_bright_light_vision = args.value; msgs.push(args.value?'Has Sight':'No Sight'); } if(args.hasOwnProperty("light") && false === args.light){ setOpts.light_radius = ""; setOpts.light_dimradius = ""; msgs.push("no light"); } if(setOpts.hasOwnProperty("has_bright_light_vision")) { opts.has_bright_light_vision = !setOpts.has_bright_light_vision; // only need to look at ones we would be changing =D } let tokens = findObjs(opts).filter(filter); let tokenCount = tokens.length; const burndown = () => { if(tokens.length) { let t = tokens.shift(); if(t) { t.set(setOpts); } setTimeout(burndown,0); } else { sendChat('',`/w gm Set ${tokenCount} token(s) to ${msgs.join(", ")}`); } }; burndown(); }; on('chat:message',(msg)=>{ if('api' === msg.type && /!set-has-sight\b/i.test(msg.content) && playerIsGM(msg.playerid)){ let args = msg.content.split(/\s+/).map(s=>s.toLowerCase()); let opts = { type: "npcs" }; if(args.includes('--npcs') || args.includes('--npc')){ opts.type = 'npcs'; } else if(args.includes('--pcs') || args.includes('--pc') || args.includes('--players') || args.includes('--player') ){ opts.type = 'players'; } else if(args.includes('--all') ){ opts.type = 'all'; } if(args.includes('--sight') || args.includes('--true') ) { opts.value = true; } else if( args.includes('--blind') || args.includes('--false') ) { opts.value = false; } if(args.includes('--no-light') ) { opts.light=false; } if(Object.keys(opts).length > 1){ setHasSightByClass(opts); } else { sendChat('',`/w gm Please specify one or more of --sight or --blind, and --no-light`); } } }); });
*Cries tears of joy* Aaron you're a godsent! This worked like a charm and has saved me countless hours of grief and frustration... Thank you so much! I've just subscribed to your Patreon, and will be doing so for the forseable future ;)
1633957089
The Aaron
Roll20 Production Team
API Scripter
No problem!  Thank you!