After some thought, I think I figured out how to get the distance using Pythagorean Theorem since I can get the x and y coordinates of any two references. I would like it if someone who is better at geometry than I am would look this over and confirm I have used it properly.

In the script below, posx1 and posy1 are the x and y positions of the first NPC, posx2 and posy2 refer to the second.

- Code: Select all
`set pya to ( posx1 - posx2 ) ;get the distance of side "a" along the x axis`

set pyb to ( posy1 - posy2 ) ;get distance of "b" along y axis

set pya to ( pya * pya ) ;square it

set pyb to ( pyb * pyb )

set ftemp to ( pya + pyb )

set pyc to GetSquareRoot ftemp

So pyc should be the distance between the two NPCs, correct?