Measure distance in Lua - allfoxwy/UnitXP_SP3 GitHub Wiki
/script local result = UnitXP("distanceBetween", UNIT_ID, UNIT_ID);print(result);
UNIT_ID could be "player", "target"... also GUID string "0x12345"
Return a number, or NIL for error.
The default measurement is accurate for ranged targeted attack/spells. Like bolts, heals, charge and gun shot.
/script local result = UnitXP("distanceBetween", UNIT_ID, UNIT_ID, "AoE");print(result);
The 4th parameter is a meter. The AoE
meter is specific for area of effect spells like novas and whirlwind. If you are using this meter on 2 mobs instead of 1 player 1 mob, please put the caster at 2nd parameter and the victim at 3rd parameter.
/script local result = UnitXP("distanceBetween", UNIT_ID, UNIT_ID, "meleeAutoAttack");print(result);
The meleeAutoAttack
meter would tell if we are in melee auto attack range. However by the design of the server, this meter is not really fit into melee spells. We could find a spot in the game where mobs would melee us but we out of taunt range.
/script local result = UnitXP("distanceBetween", UNIT_ID, UNIT_ID, "chains");print(result);
The chains
meter would tell if a spell would chain from one unit to another, like cleave and multishot. However this distance is not accurate. I yet to figure out a better function.