Quantcast How many targets around me - WoWInterface
Thread Tools Display Modes
02-20-18, 03:25 PM   #1
A Warpwood Thunder Caller
Join Date: Feb 2018
Posts: 97
How many targets around me

I was wondering is there an intelligent/easy way to find how many targets are within "earshot" so as to switch my action engine addon to "AOE" ?

I was thinking of the brute force method, make a "/command" to toggle between single target and AoE, that is certainly doable. I just press a button (assigned to the macro) when I need AoE.
  Reply With Quote
02-20-18, 03:36 PM   #2
A Cliff Giant
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 74
Not quite what you want, but there may be something in this addon that sheds some light on the subject:
How Many Are Attacking Me?
I haven't looked at its code nor actually tested its performance, but seems to have an impact on my rather low-end PC - possible indicator of a brute-force-ish method...?
  Reply With Quote
02-20-18, 06:31 PM   #3
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
02-23-18, 03:00 AM   #4
A Warpwood Thunder Caller
Join Date: Feb 2018
Posts: 97
Hi guys

In the end I have just a macro/button that switches the addon to AoE on and off, it is easy to see if there are more than 2-3 mobs and where they are positioned etc, much easier than the addon trying to make judgements.

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How many targets around me

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off