View Single Post
10-29-20, 11:10 AM   #4
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
You can also use C_NamePlate.GetNamePlates to get only visible nameplates. A plus to this is it gives you the nameplate.

Lua Code:
  1. function are3EnemiesInRange()
  2.     local inRange, unitID = 0
  3.     for _, plate in pairs(C_NamePlate.GetNamePlates()) do
  4.         unitID = plate.namePlateUnitToken
  5.         if UnitCanAttack("player", unitID) and IsItemInRange(63427, unitID) then
  6.             inRange = inRange + 1
  7.             if inRange >= 3 then return true end
  8.         end
  9.     end
  10. end
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote