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

[Script] Face2Face Dynamic Lighting Helper

This script is primarily designed for use with a face to face gaming group that is using Roll20 on a shared screen like a tv or large computer monitor, whether it's flat on a table or on a desk/cabinet or wall. The script will remove the controlledby setting on the character sheets specified in the script which will show vision only for the token at the top of the turn order. Unless it is an npc or other token or custom item. In that case, it will return control of all the specified character sheets so that players can see something other than a black screen as the monsters move around on their turn and make attacks. To specify which characters should have their controlledby settings toggled during combat, you need to get the character id of those characters. You can do this by selecting a token that represents that character and entering @{selected|character_id} in chat. You'll then copy and paste that information into a list at the top of the script. When done properly, it should look exactly like the following, but with your character's ids... var CharacterIDs = ["-KHWScTHo_oHinvteAqm", "-KGucJWiVEW9vZhF7_eM", "-KHWSkIxLWXyGIO5A4dJ"]; The script also adds a green dot to the token at the top of the turn order. This is required because otherwise the script won't force an update to the dynamic lighting until you click on the map or move a token. Link to Video of the Script in Action: &nbsp;<a href="https://plus.google.com/+JonathanBlack/posts/5mV2ZaNp2Pj" rel="nofollow">https://plus.google.com/+JonathanBlack/posts/5mV2ZaNp2Pj</a> on("change:campaign:turnorder", function(current, previous) { &nbsp; &nbsp; var CharacterIDs = []; &nbsp; &nbsp; var CurrentTO = JSON.parse(current.get("turnorder")); &nbsp; &nbsp; var PreviousTO = JSON.parse(previous["turnorder"]); &nbsp; &nbsp; var Token; &nbsp; &nbsp; var Character; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; // Save F2F data... &nbsp; &nbsp; if (!state.f2f) state.f2f = {}; &nbsp; &nbsp; if (_.isEmpty(state.f2f)) { &nbsp; &nbsp; &nbsp; &nbsp; _.each(CharacterIDs, function(charid) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Character = getObj("character", charid); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state.f2f[charid] = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharacterID: charid, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ControlledBy: Character.get("controlledby") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; } &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; // Process the turn order... &nbsp; &nbsp; if (CurrentTO.length &gt; 0) { &nbsp; &nbsp; &nbsp; &nbsp; _.each(state.f2f, function(a) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getObj("character", a["CharacterID"]).set("controlledby", ""); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; if (CurrentTO[0].id != -1) Token = getObj("graphic", CurrentTO[0].id); &nbsp; &nbsp; &nbsp; &nbsp; if (CurrentTO[0].id != -1 && Token.get("represents") !== "") Character = getObj("character", Token.get("represents")); &nbsp; &nbsp; &nbsp; &nbsp; if (CurrentTO[0].id != -1 && Token.get("represents") !== "" && Character.id in state.f2f) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Character.set("controlledby", state.f2f[Character.id]["ControlledBy"]); &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return control to all players during npc and custom item turns... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _.each(state.f2f, function(b) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getObj("character", b["CharacterID"]).set("controlledby", b["ControlledBy"]); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; // Turn order tracker is empty. Return control to all players... &nbsp; &nbsp; &nbsp; &nbsp; _.each(state.f2f, function(z) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getObj("character", z["CharacterID"]).set("controlledby", z["ControlledBy"]); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; state.f2f = {}; &nbsp; &nbsp; } &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; // Simple Initiative Tracker (Green Dot)... &nbsp; &nbsp; if (CurrentTO.length === 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false); &nbsp; &nbsp; if (CurrentTO.length &gt; 0 && CurrentTO[0].id != -1) getObj("graphic", CurrentTO[0].id).set("status_green", true); &nbsp; &nbsp; if (PreviousTO.length &gt; 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false); });
Interesting!! So the person at the top of the turn order will have the only vision?&nbsp;
This will work great for our face-to-face group. &nbsp;If used with turnmarker, you can disable the green dot marker. The Turnmarker symbol placement also forces the dynamic lighting update. &nbsp;I was having some aberrant behavior on turn-order start, but it seems to be working great now. If their are multiple "controlled by" settings for a character set in the state.f2f variable then it seems to have problems assigning and resetting the "controlled by" setting. I will be using this for our next session, and will post more feedback then. &nbsp;This is great. Thanks again.&nbsp;
Saevar L. "Liquid-Sonic" said: Interesting!! So the person at the top of the turn order will have the only vision?&nbsp; Essentially. What's really happening is control of character sheets are being toggled on and off in the background.
1465163688

Edited 1465164352
Shonder said: This will work great for our face-to-face group. &nbsp;If used with turnmarker, you can disable the green dot marker. The Turnmarker symbol placement also forces the dynamic lighting update. &nbsp;I was having some aberrant behavior on turn-order start, but it seems to be working great now. If their are multiple "controlled by" settings for a character set in the state.f2f variable then it seems to have problems assigning and resetting the "controlled by" setting. I will be using this for our next session, and will post more feedback then. &nbsp;This is great. Thanks again.&nbsp; I will check into the multiple controlled by settings. I tested that originally and then forgot after hours of frustration with the lack of lighting updates. -edit- Just finished testing this and cannot reproduce any problems. Everything was set and unset properly. What exactly is happening and does it happen every time or just sometimes?
It doesn't take into account different view ranges for characters? &nbsp;I have characters with 90ft range, some with 60ft etc...
It doesn't change any vision settings Kevin. It simply removes control of characters.
Would be good if it did (hint hint), but is still a very nice addition, thanks heaps.
It doesn't need to... ??? You set the vision settings on the tokens. The script just adds & removes control of the characters so that they only see what that character can see when it's at the top of the turn order.
Ahh, I think I worked it out, difference between emitting and seeing...
Yeah. I actually had to go this route so that light sources like torches and stuff would still be visible.&nbsp;
Thank You Thank You Thank You Thank You Thank You!!! I have been wanting exactly this for a very long time! &nbsp;I can't wait to try it out when I get home from work. &nbsp;Looking forward to using it this Wednesday for D&D Adventurer's League. One question: &nbsp;With the Adventurer's League, I'm often dealing with an unknown set of players from week to week. &nbsp;I create a new character sheet and token (using the Dungeon Buddies set) for each player's character. &nbsp;Which means while the campaign has well over 20 characters, I only use up to 7 of them at a time. &nbsp;Can I add the character IDs of all of the characters, even if they aren't going to be in the initiative, or do I only add the characters that will be used for that night? Either way works for me, I just need to know so I can add it to my setup routine.
Nevermind, answered my own question by reading through the script. It's taking the list of char_id's and comparing it to any token added to the initiative order, correct? &nbsp;So it technically doesn't matter if there are char_id's in the list that aren't in use that session. &nbsp;But I guess it'll be a good stress test of the script to have a large list of char_id's, to see if it slows down anything.
Sounds good. Just keep in mind that players will not have access to their character sheets when it is not their turn on other PC turns. They will have access during NPC turns (aka tokens in the turn order that don't have a character_id in the script list). This script really is just for face to face gaming where players use pencil, paper, and dice and Roll20 is just being used primarily for showing the map and tokens. The good thing is... that the GM will always have access regardless of the controlledby setting.
No worries, the players use their own paper or app based character sheets. &nbsp;The Roll20 character sheets are mostly so I can easily pull their tokens onto maps. &nbsp;I also track AC and a couple other things through the sheet, but as the GM that won't effect me. Good to know about the character sheet access though. &nbsp;I have run hybrid table games, where the players have laptops and are running their characters out of Roll20. &nbsp;Would it be possible to have it only remove a specific player from the controlledby setting? &nbsp;I use an extra free account to log into the screen facing the players. &nbsp;So removing access to only that player would switch the sight on the screen, without effecting any players who need to access their character's sheets.
Andrew said: No worries, the players use their own paper or app based character sheets. &nbsp;The Roll20 character sheets are mostly so I can easily pull their tokens onto maps. &nbsp;I also track AC and a couple other things through the sheet, but as the GM that won't effect me. Good to know about the character sheet access though. &nbsp;I have run hybrid table games, where the players have laptops and are running their characters out of Roll20. &nbsp;Would it be possible to have it only remove a specific player from the controlledby setting? &nbsp;I use an extra free account to log into the screen facing the players. &nbsp;So removing access to only that player would switch the sight on the screen, without effecting any players who need to access their character's sheets. Just saw this. Uh, specific removal should work. Not sure when I'll get a chance to work on it however.
No worries. &nbsp;It's not a current issue, but it could come up again in the future. &nbsp;It could also be used for livestreamed games, where the tabletop that is broadcasted automatically switches token sight for the viewers, without effecting the players in the game. &nbsp;Instead of just showing 1 player's view all the time (which I've found is most common).
1473888576

Edited 1473888617
So i created a "DM Player View" free account and gave that account control over everyone's character sheet and tokens, the players themslevs have control, but typically dont log in to roll20 as we use pen paper for most of it.. The "DM Player View" is the account i use to display the map on my TV. Will i run into issues configured like this?
Should work just fine.
sorry, i think its me, but having a couple of issues With Traker Jacker it adds "round x" to the turn order which seems to then give vision to all players, but when it jumps to the next player after a short delay, it seems to keep the vision to all. Also how do you reset control at the end of the encounter?&nbsp; i close the turn order, but this does not reset visoin? Sorry
Are you using this in a face to face game? Cause it doesn't work well if you're using it for online players.
not sure how i missed the reply, sorry. yes its for a face to face game.
Both scripts manipulate and use the turn order object... so they may not play well together. I've never used tracker jacker so I have no idea on how I could alter things to make them work.
thanks for this, i just think in today's society all api scripts should put aside their differences, hug and play nicely together.