1 Attachment(s)
Token Height Indicator for FGU (all rulesets)
With the FG Ruleset Updates 2023-02, token heights are now part of the base FGU. I've delisted this extension to avoid any conflicts or confusion. Thanks for all the support the last couple of years. If anyone is interested in code and/or wants to steal any part of it, you can find it on GitHub.
This extension allows the height of each token to be set / displayed by holding down the alt key and using the scroll wheel. The token orientation is changed with shift and scroll wheel and the token scale is changed with control and scroll wheel. The height can only be set by tokens in the combat tracker.
Ranges (both the range arrow and via the getDistanceBetweenTokens call for use by other extensions) are updated accordingly.
This is available on the Forge.
Screenshot
Attachment 45758
License
This work is Public Domain - feel free to distribute / copy / modify / incorporate as you wish.
Methods for range
My goal is to the mirror the spirit of each style in the rulesets, not necessarily to provide the most accurate result (which will always be raw). As such:
5E Standard: 2D formula is max(x delta, y delta). My formula is max(x delta, y delta, z delta)
5E Variant / most other rulesets: "Variant Diagonal Style" option to account for two schools of thought on whether the distance between a token at 0,0,0 and one at 5,5,5 is 5ft or 10ft. The only difference between the two options is when all three deltas are the same.
"Long": 2D formula is longer delta + 1/2 shorter delta. My formula is longest delta + 1/2 other two deltas.
"Short": 2D formula is longer delta + 1/2 shorter delta. My formula is longest delta + 1/2 middle delta (ignoring smallest delta).
5E Raw Variant / "Raw Distance" option on maps for other rulesets: 2D formula is sqrt(x2+y2). My formula is sqrt(x2+y2+z2).
There are lots of ways to make 5E Standard / variant measurements more "accurate", but that goes against the spirit of those rulesets. If you want to be entirely accurate, then you should use the raw measurements.
Note that Token Height changes squares into cubes and the bottom of the cube is what the height value represents. So a Medium creature with height 0 is assumed to extend from 0' to 5'. As with FGU's distance equations, the starting point for the calculation is in the middle of the square closest to the target, so the distance between a Medium creature and one directly above it will start at 2.5' and a Huge creature (15') with height 0 will start at 12.5' (assuming 5' cubes). If they were moved 10' into the air, the calculation would start at 12.5' and 22.5', respectively.
Shape support (for use by other extensions)
Code:
TokenHeight.getTokensWithinShape(originToken, shape, distance, height, width, azimuthalAngle, polarAngle)
Image.getTokensWithinShapeFromToken(originItem, shape, distance, height, width, azimuthalAngle, polarAngle)
Image.getTokensWithinShape(originX, originY, originZ, shape, distance, height, width, azimuthalAngle, polarAngle)
Get all tokens within a shape (including the origin token, if any). Any token with any part of its containing cube will be returned. I know there is a lot of debate and variations on how much of a token needs to overlap for a given shape type. As such, I'm returning all, as it's easier to remove tokens you don't want than to add...
The parameters for each type of shape are:
- All:
- originX, originY, originZ - the coordinates of the center / origin of the shape
- shape - "sphere", "cube", "cylinder", "line", "cone"
- sphere:
- distance = radius of the sphere
- cube:
- distance = length of each side of the cube
- cylinder:
- distance = radius of the sphere
- height = height of the cylinder
- line:
- distance = length of the line
- width = width of the line (half on each side of the line in all directions)
- azimuthalAngle = angle of the line leaving the origin in the X/Y plane in degrees. 0 = north, 90 = east
- polarAngle = angle of the line leaving the origin in the X/Z plane in degrees. 0 = flat, 90 = straight up
- cone:
- distance = length of the cone
- width = angle of the cone aperture (53 in 5E, 90 in 3.5/PFRPG)
- azimuthalAngle = angle of the center of the cone leaving the origin in the X/Y plane in degrees. 0 = north, 90 = east
- polarAngle = angle of the center of the cone leaving the origin in the X/Z plane in degrees. 0 = flat, 90 = straight up
Known Bugs / Future plans
- This is for FGU only; it will not work with FGC
- Tested with 5E / 4E / 3.5E / Pathfinder 1&2 / Starfinder / MoreCore; others should work but have not been tested
- Height of an NPC will get reset when taking / removing control of that NPC with GM Assistant
- You will see a slight shift in the token as you change heights. This is to work around a change in FGU 4.3.1 and will not impact the distance calculations.
Version History (most recent)
6.0: Major performance improvements by moving logic from combat tracker nodes to image tokens with help from silentruin, MeAndUnique, and Saagael
6.1: Re-added the code accidentally deleted that made AuraEffects recalculate the auras on a height change
6.2: Removed warning for tokens on map that aren't in combat tracker or are in combat tracker but have no associated space
6.3: Fixed error in Token.getTokensWithinDistance
6.4: Fixed error when changing options
6.5: Fixed issues with D&D 4E
6.6: Workaround for sometimes tokens losing their names, causing them to always share the same height value