PDA

View Full Version : Changing map targeting scale/units and getting targeted range



ianmward
January 10th, 2015, 06:38
Hi all,

I give up, I've searched for ages and I can't for the life of me see how this is done.

For my update to the Shadowrun ruleset, I'm not layered on CoreRPG and can target on the map and in the Combat Tracker but the range displayed on the map is simply the number of squares (e.g. 3). I'd like to to be a number of meters (e.g. 3m).
I saw that the 3.5e ruleset displays 5' for each square but I can't see where it is set up in the code.

I also need to get the range to the target when calculating the attack roll as different weapons have different ranges and all suffer penalties for medium, long and extreme range. What do I call to get the range as displayed on the map?

Thanks

Ian

damned
January 10th, 2015, 10:37
https://www.fantasygrounds.com/forums/showthread.php?22561-Map-units

How are the long white clouds?

ianmward
January 11th, 2015, 05:25
That was a damned useful link there Damian, it answers part 1, thanks!

Anyone know the answer to part 2?

Andraax
January 11th, 2015, 13:07
Anyone know the answer to part 2?

If you have the grid size set properly, and the grid turned on, targeting a token will calculate and display the range automatically (and draw a targeting arrow) on all CoreRPG derived rulesets, along with many others.

Trenloe
January 11th, 2015, 14:53
Anyone know the answer to part 2?
I'm not aware of any direct way in the API of doing this.

However, you should be able to write some code to do it:

Use <imagecontrol>.getGridSize to return the pixel-per-square size set on the map in question.
Use <tokeninstance>.getPosition to get the position of your source token.
<tokeninstance>.getTargets to get a table to token instances that are targeted by your source <tokeninstance>
Step through the token instances returned from getTargets, use <tokeninstance>.getPosition to get the position of the target token.
Work out the difference in distance using the difference in pixels and the pixels-per-gride size returned in #1.


<tokeninstance> API info here: https://www.fantasygrounds.com/refdoc/tokeninstance.xcp