View Single Post
02-20-18, 06:31 PM   #3
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Have enemy nameplates enabled, go through the list of nameplates on screen with C_NamePlates.GetNamePlates, in a loop.
Get namePlateUnitToken from each nameplate (nameplate.namePlateUnitToken)
Use IsSpellInRange on namePlateUnitToken in the loop, using a melee-range ability. When it returns true you increment total of melee-range present enemies.

Just an idea, that I haven't tested. Also there could still be a simpler/more efficient way.
If I remember what namePlateUnitToken is correctly, that is.

Only issue is this would only apply to melee, for obvious reasons (though you did specify "around me", so eh.) Not sure if something like this would be possible for ranged (or at least, not via this method.)

Also, I figured. You may want to add a check to see whether the units are hostile and/or attackable, in case some non-attackable NPCs were in the way who still have a nameplate showing with friendly nameplates disabled (happens for some neutral NPCs.) Or if you just wanted to have friendly nameplates enabled, even.

Last edited by Ammako : 02-20-18 at 09:30 PM.
  Reply With Quote