Thread: 5E - Token Height Indicator
-
April 30th, 2021, 16:40 #121
- Join Date
- Apr 2020
- Posts
- 231
You can do it via cloud, just put your GM Name in the "Join by GM Name" box and hit start. I do it all the time without changing anything else from how I run my normal sessions.
-
April 30th, 2021, 17:37 #122
I have a laptop I use as the client for testing. I log into the host using local IP. Unfortunately I only see this issue when I have the group all logged in thus I said I would have to wait
-
May 2nd, 2021, 20:54 #123
- Join Date
- Mar 2016
- Location
- Bergen
- Posts
- 313
Thank you for checking, yes I see that this extension gets the correct lenght when measuring (like your attached screenshot), I get the same results.
But as I already have reported the combat modifier gets another range when it tries to get a distance between two tokens:
https://www.fantasygrounds.com/forum...l=1#post596881
And the same problem is in the Aura effects, see this thread for screenshot of the problem. Wrong range when it tries to get distance between two tokens.
https://www.fantasygrounds.com/forum...l=1#post597800
Now I am only speculating by looking into the code in "aura", "combat modifier" and this extension. I did not really understand it since I only have started looking into the FG code yesterday, but let me speculate and somebody will probably correct me
I think both extensions gets their range between two tokens by calling: "Token.getDistanceBetween( ) function. Which I think your code modifies. So "aura" and "combat modifier" calls Token.getDistanceBetween(), and your code returns "nDistance.
This nDistance is not the same distance as you get when in your screenshot you see on the map. So maybe "aura" and "combat modifier" sends the wrong functions when it calls Token.getDistanceBetween()?
Here is what I think "aura" extension sends when calling Token.getDistanceBetween: (really short version, code does not look like this, but I "simplified" it)
ctEntries = CombatManager.getSortedCombatantList()
for _, node in pairs(ctEntries) do
Token.getDistanceBetween( CombatManager.getTokenFromCT(node) , "and the other token")
I hope this is some help for somebody, I would love to get this working
-
May 2nd, 2021, 21:49 #124
What you see on the screen is exactly what gets returned in getDistanceBetween - both get the result from calling the same function (distanceBetween). It looks like both of the other extensions are for 3.5/Pathfinder, so maybe something is up there? I do have different code for larger creatures for 5E than for other rulesets and all of that depends upon "standard" sizes. It looks like the size in your example is 35'. Is that correct? Does it work correctly if the size is 10, 15, 20, or 30 (those should map to large, huge, gargantuan, and colossal, respectively)? Either way, the distance should match what's on the screen, but that'd be a good place to start looking.
-
May 3rd, 2021, 08:19 #125
- Join Date
- Aug 2016
- Posts
- 42
Hey, I really like the extension. But for some reason, in 5e, it changes the measurements of square markers to be the same as circles. So what should be a 20ft square says its a 10ft square instead.
-
May 3rd, 2021, 20:44 #126
- Join Date
- Mar 2016
- Location
- Bergen
- Posts
- 313
This is with fantasy grounds unity latest live version. + Token height extension v3.0 and combat modifier extension.
First off I have a question which might help me find out what the problem is.
First off when measuring distance between tokens by selecting a target (where the arrow with a distance shows between tokens), where is your function distanceBetween called? Because it is not called from function getDistanceBetween?
Second question. It does not look like your extension uses the local function "getDistanceBetween" to anything? Have you just added that to your code to be compatible with other extensions?
Third: If that is the case it might be a cause of the problem. Because in the local function getDistanceBetween you are calling the "distanceBetween" function and sending them coordinates. What I am guessing now is that the coordinates you are sending the "distanceBetween" function is the coordinates for the tokens at the center. And since your function "distanceBetween" does not take into account the size of the tokens the lenght will be wrong.
I have not found out how to get the size of the tokens, that is probobly the trick. To send the x,y,z coordinates to the points that are closest to the two tokens instead of the center of it.
Fourth: I also think your math is wrong. As you see in the screenshot (bottom of screenshot where the range is shown) the distance between the two medium sized tokens are 20 measured to 20 feet. 10 feet in x direction, 10 feet in y direction 10 feet in z direction. I think you should be able to do this: From the token on the ground (the hero named "ffdsfsad"), the square that is 1 step in the x,y and z direction is directly towards the alchemical golem, that is one step. And now I only have one more step to go, 1 step in the x,y and z direction directly towards the golem. That is 2 steps. In pathfinder first step i 5 feet, second step i 10 feet. That is 15 feet total.
Can we just use this to calculate it, I think that should be correct: (I modified your code slightly in the function distanceBetween where have your "elseif diagMult == 0 then"
Code:local hyp = math.sqrt((dx^2)+(dy^2)+(dz^2)) totalDistance = math.floor(hyp / gridsize)* units
-
May 4th, 2021, 01:17 #127
I think I tracked down Svandal's problem with his very large dragon, he was using a non standard Pathfinder size of 35 ft. I've updated the non-5E sizeMultiplier calculation to be more generic.
Code:local distancePerGrid = GameSystem.getDistanceUnitsPerGrid() local nSpace = DB.getValue(ctNode, "space"); sizeMultiplier = ((nSpace / distancePerGrid ) - 1) * 0.5 if nSpace > distancePerGrid * 2 and nSpace % (distancePerGrid * 2) > 0 then bExact = false end
Last edited by SoxMax; May 4th, 2021 at 03:19.
-
May 4th, 2021, 01:58 #128bmos' extensions
he/them
-
May 4th, 2021, 03:38 #129
Since I was in the the code too I was tinkering with the distance calculation since I tend to agree with Svandal about the current result being too long. I've been experimenting with this for the calculation of distance when the diagMult > 1
Code:local diagMultIncrease = diagMult - 1 local distances = {dx, dy, dz} table.sort(distances) local first = distances[1] * diagMultIncrease / 2 local second = distances[2] * diagMultIncrease local third = distances[3] totalDistance = math.floor((first + second + third) / gridsize) * units
-
May 4th, 2021, 03:41 #130
Version 3.1 upload to account for the arbitrary sizes and to fix StarDrifter's finding on the squares.
@SoxMax - thanks, I was thinking that may have been the issue. I think your code also works for 5E, so now I have a common determination. I appreciate that.
@Svandal - does that fix your primary concern? As for the other questions, just for information:
First off when measuring distance between tokens by selecting a target (where the arrow with a distance shows between tokens), where is your function distanceBetween called? Because it is not called from function getDistanceBetween?
Second question. It does not look like your extension uses the local function "getDistanceBetween" to anything? Have you just added that to your code to be compatible with other extensions?
Third: ...
Fourth: I also think your math is wrong.
Thanks for bringing up the issue - hopefully it works to your satisfaction now.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks