View Single Post
07/27/17, 12:41 PM   #1
code65536
AddOn Author - Click to view addons
Join Date: Mar 2016
Posts: 21
Determining distance between two players

Let's say I have two players in a group together. I would like to calculate the distance between these two players in units that are compatible with ability ranges and radii.

For example, the Circle of Protection ability has an ability radius of 500 (5 meters).

I've tried using the GetMapPlayerPosition function (calling it on "groupX" unit tags) to try to determine the distance between players (I get the x and y coordinates of two players and then sqrt the squared sums), and I end up getting something like 8.3 meters as the distance between two players who are approximately 5 meters apart (as measured using the CoP ability above).

Obviously, I am doing something wrong and this is not the correct way to calculate distances between players. At least, not in a unit that is compatible with the distance units used for ability ranges/radii.

What's the correct way to do this? Or is this even possible?
  Reply With Quote