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 .
×

Line to Link Tokens

Hi, Is anyone aware of a method or script or a scriptcard that will create a coloured line connected to 2 tokens that will move to stay linked when the tokens move. I'm trying to visually represent something for spells like witch bolt or other situations where 1 token has an impact or affect on another token. Thanks
1784397041
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That sounds like a great idea for a small script. Let me see what I can come up with.
1784402281

Edited 1784403132
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Try this code . I'll want to clean it up, and add a help function before committing this to one click, but I'd appreciate someone kicking the tires first. Here is the documentation: Tether Tether creates a persistent line between two tokens. As either token moves, the line automatically updates to remain connected. A tether remains until it is removed with !untether, or until one of the connected tokens is deleted. Usage Select exactly two tokens, then run: !tether Optional Parameters Parameters may be supplied in any order. Default values if no parameter are given are shown in bold. width|# Line width. Default is  5. Example: width|10 color|value Line color. Accepts hexadecimal colors with or without a leading #. Default is #00ffff (blue) Examples: color|#00ff00 color|00ff00 layer|layer Layer to place the path on. Valid values are: objects . gmlayer. map, walls, foreground type|type Dynamic Lighting barrier type. Tansparent is the default type, since II thought a dotted line woud be easier to read as a "link". Valid values are: wall, transparent , oneWay Examples !tether !tether width|10 !tether color|00ff00 !tether color|00ff00 width|3 !tether layer|foreground !tether layer|walls type|wall color|ffffff width|2 Removing a Tether Select the same two tokens and run: !untether This script also appears on my Patreon page .
1784402961
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Tips: In this image, the blue line is on the token layer. If you want the line behind all tokens, and not accidentally selectable, add the layer|map parameter, and it will display like the green lin. Also, if you specify layer|walls  , this becomes a dynamic lighting line. A GM could tether two invisible tokens and quickly move a movable wall, or a farce field, etc. without going to the lighting layer.
1784403855
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Animation:
1784405759

Edited 1784406071
I just tried this in one of my games and it worked without a hitch. I created two macros called -Tether (   !tether width|10 color|00ffff layer|map ) and -Untether. The dashes are to keep them at the top of the list under collections for now. The first time I use the -Tether macro the dashed line did not appear until I moved one of the tokens. All other times that I tried it the line appeared immediately. I could not repeat the condition that caused the line not to appear even when I cleared cache or restarted the game - It was probably a glitch on my PC. With the tether on the object layer, I could delete the line but it reappeared as soon as I moved one of the tokens - I kind of like that feature since it's an easy fix if the line gets deleted by mistake. Putting the line on the Map layer of course helps prevent accidental deletion. I currently have a player whose PC has the Witch Bolt spell. He's gonna love this!
This looks great! One possible feature suggestion would be to use /fx commands, which might be a little more immersive for things like Witch Bolt.  But I have no idea how easy that would be to incorporate. 
"Let me see what I can up with !!" Keith, Amazing as always. Thank you so much for this.
1784407681
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Jarren said: This looks great! One possible feature suggestion would be to use /fx commands, which might be a little more immersive for things like Witch Bolt.  But I have no idea how easy that would be to incorporate.  I thought about fx, but they tend to be expensive performance-wise. I have also expanded commands for: Remove: !untether - remove selected pair !untether selected - remove all tethers involving selected tokens, leaving other tethers unaffected !untether all - remove all tethers on current page
Keith, Just wondering if a distance can be applied without creating to much work so for example when 1 token ends it's move more than 60 feet away from the other the link is automatically removed. This is easily solved with the untether command anyway so not an issue if this is to much of a feature creep.
1784473681

Edited 1784473763
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Already done. I was going to announce it when I made the formal post, but I added threshold and exceeds to the list of arguments: threshold |<distance in the page's scale units> exceeds |<option> — Only applies if a threshold has been set off — becomes transparent until in range again (the default behavior) delete — becomes untethered attenuate — Becomes more transparent as threshold is approached, more opaque as tokens get nearer stretch — Becomes thinner as threshold is approached, thicker as tokens get nearer (like a rubber band) hex color — Switches to different color past threshold Threshold respects page scale, units, grid scale, and diagonal type.
1784474158
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here is a possible macro for witchbolt: !tether threshold|30 exceeds|delete color|00ccff width|5 layer|map I'd personally set exceeds to "off", to prevent accidental deletion, but this models the behavior. One note, since this redraws the line on the VTT with every move, it is possible that arrow-key movement may lose the token selection.
1784517244
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Official script plus documentation is  here  or  here .
It does for me. When I try moving either token using the arrow keys, the line stays visible but I lose control of the token after moving one grid square. This is still a great tool! I'll just need to tell my players using Witch Bolt or the like to not use arrow-key movement (even though I personally prefer that they do). keithcurtis said:  One note, since this redraws the line on the VTT with every move, it is possible that arrow-key movement may lose the token selection.