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

[Snippet] Fix rotated DL walls

1521242981
Ada L.
Marketplace Creator
Sheet Author
API Scripter
This evening, I ran into a problem where the dynamic lighting doesn't handle walls very well if they are rotated. It creates shadows as though the walls are not rotated. Here's a short script I wrote up to fix this issue. Simply move the player ribbon to the page that has your rotated walls and enter "!fixPaths" in the chat. Requires Path Math. (() => {     on('chat:message', msg => {         if(msg.content === '!fixPaths') {             let pageId = Campaign().get('playerpageid');             let walls = findObjs({                 _pageid: pageId,                 _type: 'path',                 layer: 'walls'             });             _.each(walls, wall => {                let segments = PathMath.toSegments(wall);                let pathData = PathMath.segmentsToPath(segments);                _.extend(pathData, {                     stroke: wall.get('stroke'),                     _pageid: pageId,                     layer: wall.get('layer')                 });                 createObj('path', pathData);                 wall.remove();             });         }     }); })();
1521247773
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Nice! I ran into this very problem a while back.