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

A Macro or API idea for Line of sight

So I have been looking around for this and I have yet to find anything that does what I am looking for. So for d&d 5e there are the following combat rules My concept is something that allows you to click on two tokens and it will draw the lines between them as shown in the image, so that way the dm/players will not have to draw each line themselves. They could just use the API or Macro click on the two tokens and then the lines will be drawn.
1615590424
The Aaron
Roll20 Production Team
API Scripter
That would be possible with the API.  The complications would come in picking which source corner to use and which destination square to target.
1615612137

Edited 1615612182
David M.
Pro
API Scripter
Seems like you would have to test every combination of source token corner and target token corner, check for intersection with DL paths and the bounding box of every other token on the map object layer, then pick the most favorable to the attacker. That's a whole lot of processing for something that the human brain can do in a couple seconds.
Well I don't know much about scripting it was just an idea
I'll +1 Flame's idea. In normal use, I would love the ability to pick the corner of the attacker token, and then pick an entire target token. So ideally, the API would draw lines from the attacker's corner to all four target corners, and at that point, I can human brain it to determine how much cover there is, if any. If it seemed like a good idea to try a different attacker corner, maybe the API would let me select a new corner without "losing" the target, so the lines would redraw upon the new corner click. Drawing measuring lines from one corner to all four other corners by hand is a real drag (no pun intended), and in my game, we are pretty strict about that cover rule from the DMG.
1615674227
David M.
Pro
API Scripter
Well, I suppose my comment is really only valid if you wanted the script to determine the final result (no cover, half cover, etc). If you just wanted to draw the lines after picking a corner it would be a lot more manageable. Which, as I re-read your original post, was all you were asking for to begin with :) Now if you wanted color-coded lines (blocked/unblocked), it goes back to checking against everything else on the map.
I find it an interesting idea. +1
I'd be perfectly happy with non-color-coded lines. Something that just fires straight lines from all four corners of a target token back to one selected corner of an attacker/source token would be fantastic. And just to be greedy about this potential API that I'm secretly hoping The Aaron is coding right now, a "show/hide" option for the GM would be super useful. I'd love to be able to check if an NPC can hit a PC w/wo cover... but without my players knowing. Similarly, I often need to show my players why an NPC has cover from their attacks.
1615748092
David M.
Pro
API Scripter
AFAIK, drawing elements are always visible to all players
1615752546
The Aaron
Roll20 Production Team
API Scripter
I actually started writing it, but life kicked me in the teeth and I had to do some other things.  I'll give it a shot at some point, I have some ideas for the interface. Lines themselves can't be hidden from specific people, but they could be moved between the GM Layer and Token Layer without difficulty.
I am excited for whenever that some point occurs! And sorry about your teeth. The Aaron said: I actually started writing it, but life kicked me in the teeth and I had to do some other things.  I'll give it a shot at some point, I have some ideas for the interface. Lines themselves can't be hidden from specific people, but they could be moved between the GM Layer and Token Layer without difficulty.