Thread Tools Display Modes
12-02-09, 09:21 AM   #1
romka_tv
A Murloc Raider
Join Date: Dec 2009
Posts: 4
Question Enumerate enemies

Hello WoW Interface gurus,

What's the best way of getting information about mobs engaged in a fight with a group? For example, when a party/raid is fighting with a pack of mobs, I want to know:
- Remaining health of every mob.
- Or at least percentage of health.
- Or at least the total number of mobs.

It does not have to be very precise, an approximation will do.

Thanks in advance for any ideas.
  Reply With Quote
12-02-09, 09:32 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Iterate over party/raid member's target.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-02-09, 09:40 AM   #3
romka_tv
A Murloc Raider
Join Date: Dec 2009
Posts: 4
Iterate over party/raid member's target.
It does not usually work. In 5-man instances almost in every pull all party members are targeting the same mob. Same goes for trash pulls in raids.
  Reply With Quote
12-02-09, 09:47 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
For health it's close to your only option. The other option is to scan nameplates, but no everyone plays with those. You can ofc fetch the number of mobs by tracking the combat log.

Potentially you can track the mouseover unit to see estimates of mobs HP

Sorry for the scatter mindedness in the post; busy healing a heroic in the background :P
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-02-09, 09:52 AM   #5
romka_tv
A Murloc Raider
Join Date: Dec 2009
Posts: 4
Originally Posted by haste View Post
For health it's close to your only option. The other option is to scan nameplates, but no everyone plays with those. You can ofc fetch the number of mobs by tracking the combat log.

Potentially you can track the mouseover unit to see estimates of mobs HP

Sorry for the scatter mindedness in the post; busy healing a heroic in the background :P
I was thinking about using nameplates. It seems like it's not too hard to extract health percentages of all enemies with visible nameplates, but I didn't find a good library for it. Aloft has some generic function for enumerating visible nameplates, but I'll have to extract health percentages from frames by hand. Any other options?

Any existing libraries for extracting this data from logs? I think the only thing I can get from logs is the number of mobs and their names. Is it correct?
  Reply With Quote
12-02-09, 09:59 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
There aren't any libraries for something as obscure as this. You'll have to write the code yourself.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-02-09, 10:08 AM   #7
romka_tv
A Murloc Raider
Join Date: Dec 2009
Posts: 4
Originally Posted by haste View Post
There aren't any libraries for something as obscure as this. You'll have to write the code yourself.
OK, thanks. Just wanted to be sure I'm not reinventing the wheel.

By the way, I want to extract mobs' health in order to implement the following function:

Code:
-- Approximately, how many seconds the current fight will last.
function RemainingFightDuration()
But I bet it's also too obscure to be already implemented as a library.
  Reply With Quote
12-02-09, 10:37 AM   #8
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Most libraries for WoW shouldn't exist anyway, so it's a good thing that it doesn't exist. Most of the things you've asked for so far is pretty straight forward to do, and it wouldn't surprise me if you've used more time asking if there exist a library than it would take to implement the features yourself.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-02-09, 10:44 AM   #9
Psychophan7
A Chromatic Dragonspawn
Join Date: Feb 2006
Posts: 153
I'd use the combat log, because I think you're able to pull out the GUID of the mobs from there. I'm also sure that you can grab the levels of each mob the same way. If you combine the information taken from the combat log and combined it with health data from Wowhead, then you should be able to do what you want.

The biggest hurdle with this idea is creating the mob health database using Wowhead, I think.
  Reply With Quote
12-04-09, 02:43 AM   #10
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Threat data from Omen could be another source.
  Reply With Quote
12-04-09, 02:22 PM   #11
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Omen just pulls threat data from the client now, I thought.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-05-09, 10:15 AM   #12
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Maybe. But I guess it's synchronized, isn't?
Means there could be data from others that is not visible to your client, or not?
  Reply With Quote
12-05-09, 10:43 AM   #13
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Originally Posted by Duugu View Post
Maybe. But I guess it's synchronized, isn't?
Means there could be data from others that is not visible to your client, or not?
You are only able to query threat data by unit id (aka raid/party targets)
  Reply With Quote
12-05-09, 12:06 PM   #14
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Ah ... well ... that's true.
I'll take that suggestion back.
  Reply With Quote
12-05-09, 12:53 PM   #15
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
nameplates now contain actual health data (rather than some abstraction, like a percentage). i seem to remember this coming in with WoW 3.0.3 (aka WotLK).

so, just collect the "hard" numbers off the health bar (the min/max and current value of the "StatusBar"), and you will know the associated unit's exact maximum and current health.

StatusBar:GetMinMaxValues()
StatusBar:GetValue()

the nameplate health bar is the first child of the "nameplate frame" (which is, in turn, the top-level/parent element of the nameplate assembly).

a big problem remains, however: nameplates contain no information that allows them to be associated with specific units. so, for instance, with trash mobs... you won't really have any way to differentiate among several targets that could possess the same unit name and level, and you certainly won't have any way to collect a UnitGUID, figure out who is targeting what, or anything else of the kind. not just from nameplate data.

the only possible workaround i have been able to identify is through the use of raid target assignments (icons); you can detect when raid targets are assigned (via events), record which UnitGUIDs are involved, detect when groupmembers change targets (via events), record which UnitGUIDs are involved, detect the presence of icon graphics on the nameplates when they become visible, and then use all of this to connect the dots. units without raid target assignments remain anonymous (in terms of just nameplate data).

hope that helps.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
12-07-09, 09:02 AM   #16
bugshake
A Defias Bandit
Join Date: Dec 2009
Posts: 2
I'm also inventing this wheel

Hey, I just started working on something like this. Especially when playing hunter, standing safely 41 yards away from a group of mobs and melee, I thought it would be great to have a list of 'interesting' units.

It's my first wow addon and my first introduction to LUA but I managed to get something working when listening to events.

Basicly, from the moment you enter combat, I will collect every unit you mouseover in a list. If the unit is friendly or dies, it goes into the black list, if it is hostile, it goes into the white list.

Combat on off events:

this:RegisterEvent("PLAYER_REGEN_ENABLED");
this:RegisterEvent("PLAYER_REGEN_DISABLED");

Selecting or hovering units:

this:RegisterEvent("PLAYER_TARGET_CHANGED");
this:RegisterEvent("UNIT_HEALTH");

Unit health changes or units dying:

this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
  Reply With Quote
12-07-09, 02:15 PM   #17
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by bugshake View Post
Hey, I just started working on something like this. Especially when playing hunter, standing safely 41 yards away from a group of mobs and melee, I thought it would be great to have a list of 'interesting' units.

It's my first wow addon and my first introduction to LUA but I managed to get something working when listening to events.

Basicly, from the moment you enter combat, I will collect every unit you mouseover in a list. If the unit is friendly or dies, it goes into the black list, if it is hostile, it goes into the white list.

Combat on off events:

this:RegisterEvent("PLAYER_REGEN_ENABLED");
this:RegisterEvent("PLAYER_REGEN_DISABLED");

Selecting or hovering units:

this:RegisterEvent("PLAYER_TARGET_CHANGED");
this:RegisterEvent("UNIT_HEALTH");

Unit health changes or units dying:

this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
if memory serves, "UNIT_HEALTH" is primarily for friendly group members, though the player's current target might be included (unitid "target").

but, yeah, tracking UnitGUID off of mouseover/target change events ("UPDATE_MOUSEOVER_UNIT"/"UNIT_TARGET"), along with that unit's current health at the moment of the event, aggregating those GUIDs, and then watching the combat log for damage events involving those GUIDs (like a scrolling text addon does; also perhaps deleting those GUIDs from the aggregation on combat log UNIT_DIED sub-events), would probably get you close... but still, it could be difficult to generate an absolute remaining health from a running total from the combat log. it would be rather timing-dependent.

anyway, i have always believed that this is basically how MagicTargets works (though i have never dug into the code). you could take a look at that and see.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
12-08-09, 03:36 AM   #18
bugshake
A Defias Bandit
Join Date: Dec 2009
Posts: 2
Magic Target seems to be exactly what i need. I did spent some time looking for an addon like it but never managed to find it. This even looks a bit like how I would want my addon to look... definitely gonna dig into this code, thanks.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Enumerate enemies


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