Unfortunately, UnitDistanceSquared only works on group members (party and raid). It does exactly what you would expect - returns the square of the distance to the unit in yards. Its second return is false if the unit cannot be checked.
UnitPosition has the same restrictions. It returns exact x, y, z, mapID coordinates for any group members (and yourself). For example, right now in Ashran I'm getting (4000.6, -4066.8, 1047687, 1191) as the return values.
These do have quite the interesting implications, even if they don't work on hostiles, pets, or ungrouped players.
|