DICE PACKS BUNDLE
  1. #1

    Join Date
    May 2014
    Location
    Sydney, Australia
    Posts
    811

    Changing map targeting scale/units and getting targeted range

    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

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1

  3. #3

    Join Date
    May 2014
    Location
    Sydney, Australia
    Posts
    811
    That was a damned useful link there Damian, it answers part 1, thanks!

    Anyone know the answer to part 2?

  4. #4

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    Quote Originally Posted by ianmward View Post
    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.

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by ianmward View Post
    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:
    1. Use <imagecontrol>.getGridSize to return the pixel-per-square size set on the map in question.
    2. Use <tokeninstance>.getPosition to get the position of your source token.
    3. <tokeninstance>.getTargets to get a table to token instances that are targeted by your source <tokeninstance>
    4. Step through the token instances returned from getTargets, use <tokeninstance>.getPosition to get the position of the target token.
    5. 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
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in