RPTools.net

Discussion and Support

Skip to content

It is currently Mon Dec 18, 2017 3:36 pm 




Forum rules


PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)



Reply to topic  [ 14 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Sun Aug 27, 2017 7:19 pm
Posts: 9
 Post subject: Line of Sight
PostPosted: Sun Aug 27, 2017 7:27 pm 
Is it possible to have line of sight measure from the corners instead of the center is a token?

If yes how?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7969
Location: Bay Area
 Post subject: Re: Line of Sight
PostPosted: Sun Aug 27, 2017 8:16 pm 
Not really. You can move the token to the corners and check line of sight, but that's not really practical.

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Aug 27, 2017 7:19 pm
Posts: 9
 Post subject: Re: Line of Sight
PostPosted: Sun Aug 27, 2017 9:09 pm 
I would recommend this be added as some game system calculate this way.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Line of Sight
PostPosted: Mon Aug 28, 2017 2:51 am 
didn't rumble created something like that? I recall a distance function doing this, but I've never used it. You might want to have a look in the wiki.

edit: ah yes Wiki: canSeeToken() has an ability to look at corners.

anyway, Wiki: getDistance() doesn't have that ability, but you could create a macro that does this. What you require is:
Wiki: getTokenX()/Y
Wiki: getTokenWidth()
Wiki: getTokenHeight() and
[h: gridSize = json.get(json.get(getInfo("map"), "grid"), "size")]

gettokenXY gets you the upper left corner of the token. getWidth/heigth wil give you the entire boundary of the token so you can calculate the 4 coords that make up the token.
Do the same for the target and, depending on the request, you can calculate the distance between the requested corner.If you work with pixels/cell only you can use the gridSize to change this into cells and your there!

That is, I'm assuming that you are looking for a function like: getTokenCornerDistance("Dragon", "Bottom_left", "Elf", "Top_Right", 0)
where '0' stands for 'distance in cells' with the other options: '1' for 'distance per cell units' and '2' amount of pixels.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7969
Location: Bay Area
 Post subject: Re: Line of Sight
PostPosted: Mon Aug 28, 2017 4:42 am 
You can calculate distance but I think he wants line of site. For example if you have a huge creature 5ft in to a 5ft corridor they can't see up the hall just the angle from the center to the corner of wall in to the hall. What ends up happening is creatures can see you but you can't see them.

I thought I recall some discussion a LONG time ago about being able to change the vision point to the front of the token or any of the 8 cardinal places of the token but I don't think anything was done about that.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Line of Sight
PostPosted: Mon Aug 28, 2017 4:58 am 
so you're talking more about an option in maptools to change vision from centre to vision from boundary? Which I'm guessing will be a MFPITA to program/calculate as instead of one point of vision from where the calculation is done, you need four...for each token, making the calculation load thus 4 times as heavy.

That and I created a 'dependability matrix' for the devs concerning light/fow/vbl and that thing is staggeringly complex (and incomplete). The amount of permutations to test everything probably lies close to 1000 required test every time you change something. Adding another layer of complexity might lead to heads of devs that spontaneously explode...

cause changing that would impact all three: light, fow and vbl...

with functions however (like the one I described above) I think you can do quite a bit.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Line of Sight
PostPosted: Mon Aug 28, 2017 6:13 am 
pure for the fun of it, here's the function:

not fully tested:
Code:
<!-- getTokenCornerDistance("Dragon", "Bottom_left", "Elf", "Top_Right", 0) -->
[
h:'<!-- returns a json: {"dx":12,"dy":15} -->']

[
h:assert(argCount()==5, "ERROR: getTokenCornerDistance requires exactly 5 parameter, amount given: " + argCount(),0)]

[
h:token1    = arg(0)]
[
h:corner1    = lower(arg(1))]
[
h:token2    = arg(2)]
[
h:corner2    = lower(arg(3))]
[
h:dpu        = arg(4)] <!-- distance returned in:  0: cells,  1: pixels per cell, 2: distance per cell -->

[
h:gridSize    = json.get(json.get(getInfo("map"), "grid"), "size")]
[
h:upc        = json.get(json.get(getInfo("map"), "grid"), "units per cell")]

[
h:switchToken(token1)]
[
h:x1    = getTokenX(1)]
[
h:y1    = getTokenY(1)]
[
h:w1    = getTokenWidth()]
[
h:h1    = getTokenHeight()]

[
h:switchToken(token2)]
[
h:x2    = getTokenX(1)]
[
h:y2    = getTokenY(1)]
[
h:w2    = getTokenWidth()]
[
h:h2    = getTokenHeight()]

[
h,switch(corner1),code:
    case "top_left": {
        <!-- do nothing -->
    };
    case "top_right": {
        [x1    = x1 + w1]
    };
    case "bottom_right": {
        [x1    = x1 + w1]
        [y1    = y1 + h1]
    };
    case "bottom_left": {
        [y1    = y1 + h1]
    };
    default: {
        [error_message    = "ERROR in getTokenCornerDistance, unknown corner: " + corner1]
        [pause("error_message")]
    }
]

[
h,switch(corner2),code:
    case "top_left": {
        <!-- do nothing -->
    };
    case "top_right": {
        [x2    = x2 + w2]
    };
    case "bottom_right": {
        [x2    = x2 + w2]
        [y2    = y2 + h2]
    };
    case "bottom_left": {
        [y2    = y2 + h2]
    };
    default: {
        [error_message    = "ERROR in getTokenCornerDistance, unknown corner: " + corner2]
        [pause("error_message")]
    }
]

[
h:dx    = abs(x2 - x1)]
[
h:dy    = abs(y2 - y1)]

[
h,switch(dpu),code:
    case 0: {
        <!-- distance in cells -->
        [dx    = round(dx/gridSize,0)]
        [dy    = round(dy/gridSize,0)]
    };
    case 1: {
        <!-- distance in pixels -->
    };
    case 2: {
        <!-- distance in cells -->
        [dx    = round(dx/gridSize,0) * upc]
        [dy    = round(dy/gridSize,0) * upc]
    };
    default: {
        [error_message    = "ERROR in getTokenCornerDistance, unknown distance per cellunit: " + dpu]
        [pause("error_message")]
    }
]

[
h:macro.return =    json.set("{}", "dx", dx, "dy", dy)] 


this could be done much more efficient and compact, but this gives a good overview of what is happening while running the code. As I'm on a roll, here the compact version:

Code:
<!-- getTokenCornerDistance("Dragon", "Bottom_left", "Elf", "Top_Right", 0) -->
[
h:'<!-- returns a json: {"dx":12,"dy":15} -->']

[
h:assert(argCount()==5, "ERROR: getTokenCornerDistance requires exactly 5 parameter, amount given: " + argCount(),0)]
<!--
 arg(4): distance returned in:  0: cells,  1: pixels per cell, 2: distance per cell -->

[
h:gs    = json.get(json.get(getInfo("map"), "grid"), "size")]
[
h:upc    = json.get(json.get(getInfo("map"), "grid"), "units per cell")]

[
h:dx    = 
    round
(
        abs(
            getTokenX(1, arg(0)) + 
            if
(indexOf( lower(arg(1)),"right")+1, getTokenWidth(arg(0)), 0) 
                
- 
            getTokenX
(1, arg(2)) - 
            if
(indexOf( lower(arg(3)),"right")+1, getTokenWidth(arg(2)), 0)
        ) / if(arg(4)==|| arg(4)==2, gs, 1) * if(arg(4)==2, upc, 1),0
    
)
]

[
h:dy    = 
    round
(
        abs(
            getTokenY(1, arg(0)) + 
            if
(indexOf( lower(arg(1)),"bottom")+1, getTokenHeight(arg(0)), 0) 
                
- 
            getTokenY
(1, arg(2)) - 
            if
(indexOf( lower(arg(3)),"bottom")+1, getTokenHeight(arg(2)), 0)
        ) / if(arg(4)==|| arg(4)==2, gs, 1) * if(arg(4)==2, upc, 1),0
    
)
]

[
h:macro.return =    json.set("{}", "dx", dx, "dy", dy)] 


edit: I've implemented this function in the BoT as bot_getTokCDistance(), but as AM said, probly not what you're looking for :)

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Aug 27, 2017 7:19 pm
Posts: 9
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 7:32 am 
thank you I will see if I can make the functions work.

and set the intent is to work with all 3.

I am playing a game what you can see and attack if you have a direct line from any corner of your square to any corner of there square. common method in games I find.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 8:39 am 
Raknor wrote:
thank you I will see if I can make the functions work.

and set the intent is to work with all 3.

I am playing a game what you can see and attack if you have a direct line from any corner of your square to any corner of there square. common method in games I find.


what do you mean with 'all 3' ?

as for the 'canSee' function, I *think* it works from 'centre of token' to 'any corner of other token', so its not entirely what you're looking for.
The function I created simply calculates *distance* between two corners of two token.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1724
Location: Chicagoland
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 1:49 pm 
Yea, I would actually like to include that and will look at it when the time comes...

FWIW, Pathfinder (and probably other DnD grid based games) do count all squares for LOS. Say a large (2x2) creature is standing with 1 square exposed around a corner, he can see down the hall. Furthermore, he can "attack" from any of those squares. You also can calculate "flanking" from any of those squares...

Now, does that mean a token can "see" from the center of any of those 4 squares or from ANY point in those squares? The later may be correct but the former is probably the closest solution attainable...

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Aug 27, 2017 7:19 pm
Posts: 9
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 9:15 pm 
all 3 meaning fog of war, light, and line of site

if this is added I still would like to see it count from the corners of the token as an option. as this would work no mater the size of the token and some games describe it working from corner to corner.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Mon Oct 26, 2009 4:51 am
Posts: 306
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 9:36 pm 
JamzTheMan wrote:
Yea, I would actually like to include that and will look at it when the time comes...

FWIW, Pathfinder (and probably other DnD grid based games) do count all squares for LOS. Say a large (2x2) creature is standing with 1 square exposed around a corner, he can see down the hall. Furthermore, he can "attack" from any of those squares. You also can calculate "flanking" from any of those squares...

Now, does that mean a token can "see" from the center of any of those 4 squares or from ANY point in those squares? The later may be correct but the former is probably the closest solution attainable...


3.5 and possibly 4th, line of sight is determined from a token's corners. If an unobstructed line can be drawn from one token's corner to another token's corner they can be "seen", that doesn't mean they don't have cover. I didn't notice those rules in 5th and I don't know about Pathfinder.

Personally though, I don't think we should be getting so hung up on grid mechanics when the visual presentation of Maptool is far superior. I think WotC and other game companies need to step up and embrace the present world of computer based gaming instead of living in the 70s.


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Aug 27, 2017 7:19 pm
Posts: 9
 Post subject: Re: Line of Sight
PostPosted: Tue Aug 29, 2017 11:42 pm 
pathfinder generally goes by the game mechanics of 3.5 and 5th edition leaves much of the "small stuff" up to the DM (DM decision if it is center or corner)
I think corner makes more since and you are not standing still in your square.

one of the benefits on using the line of site options afforded by a digital tabletop is to answer the question can I see the target quickly and accurately. by no means is this a make or break point.

my group just likes to be tactical when in combat and little things count.

PS. many companies have embraced the digital gaming trend and some even have there on digital options if you want to pay for them


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1724
Location: Chicagoland
 Post subject: Re: Line of Sight
PostPosted: Wed Aug 30, 2017 9:18 am 
Raknor wrote:
all 3 meaning fog of war, light, and line of site

if this is added I still would like to see it count from the corners of the token as an option. as this would work no mater the size of the token and some games describe it working from corner to corner.


Well, you would *still* want center as well, so draw from 5 points basically. It could probably be done but performance is going to take a hit until I can rewrite the fow engine, hopefully with libgdx to take advantage of the video card...

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 14 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman