-
Posted by GMan on Mon, 26 Apr 2010 20:39:33
First ... I hope all is well with your health issues.
Secondly ... bare with me as I am new to all this.
I am creating a addon that reports information about the units in the surrounding area. I am using
COMBAT_LOG
event entries as a mechanism to determine the units in the surrounding area. Unfortunately theCOMBAT_LOG
events only returns GUID and almost all information API calls use UnitID.One example is health. If I want to get the health of all mobs around (i.e. affecting combat) regardless of whether they are targeted ... the only way I can think of to do this is to ...
- Monitor the
COMBAT_LOG
events ... adding and removing GUIDs as appropriate. Yes I will also need another mechanism to purge GUIDs that die/leave combat log range, but thats not the issue here. - For each GUID found above loop through all of the known units (player, taret, targettarget, party1target, etc.) ... use UnitGUID on the UnitID to get a GUID for comparison ... and then if a match is found use that unitID to get health via UnitHealth().
This is clearly not ideal because it will only update the health for those units that have a UnitID.
I guess another way to ask the question is there a way to obtain the health of a unit given only the GUID of the unit?
Any help/alternatives would be appreciated.
Thanks, G
- Monitor the
-
Posted by jnwhiteh on Wed, 28 Apr 2010 12:32:02
I am creating a addon that reports information about the units in the surrounding area. I am using
COMBAT_LOG
event entries as a mechanism to determine the units in the surrounding area. Unfortunately theCOMBAT_LOG
events only returns GUID and almost all information API calls use UnitID.One example is health. If I want to get the health of all mobs around (i.e. affecting combat) regardless of whether they are targeted ... the only way I can think of to do this is to ...
- Monitor the
COMBAT_LOG
events ... adding and removing GUIDs as appropriate. Yes I will also need another mechanism to purge GUIDs that die/leave combat log range, but thats not the issue here. - For each GUID found above loop through all of the known units (player, taret, targettarget, party1target, etc.) ... use UnitGUID on the UnitID to get a GUID for comparison ... and then if a match is found use that unitID to get health via UnitHealth().
This is clearly not ideal because it will only update the health for those units that have a UnitID.
I guess another way to ask the question is there a way to obtain the health of a unit given only the GUID of the unit?
No, this is intentional. What you want to do is incredibly difficult to do actually accomplish, for the reasons you've outlined. You could make 'guid health bars' but you won't be able to get the maximum health of the units so they won't be very useful at all. The API is designed to give you information about units in your 'area of interest' by the combat log, and actual information from the API returns if someone in your group is 'involved' with the unit.
- Monitor the