Looking for a script/macro that will print my current targets Base health

Hey all,

I wanted to try collecting some health data in BGs to compare the difference of average health between two teams before the start of the BG to try to quantify much (or even if) a difference in gear effects the outcome of a game.

I was wondering if a script could be made which prints my current targets base health (i.e health with no bonus health modifiers like priest buff). I’m not very familiar with using the blizzard API so I’m not sure if that info can be easily found. Thanks for the help.

I think these functions will help you:

All the links are to Wowpedia.

Looking at the UnitAura page looks like a weakaura might be able to do what i’m wanting. I Still would need to figure out how i would make it. I’m thinking the weakaura would read the health of the target then divide out health modifiers if the target has them.

Here’s the work in progress weakaura that I made. I added an ilvl prediction feature to it which uses the health to estimate the targets ilvl. The prediction is pretty good for most classes and specs, it doesn’t currently work with tanks or fury warriors. If anyone knows a good way to detect a targets spec please let me know.

https://wago.io/j9ag1RpIu

GetInspectSpecialization(“target”)

I just finished editing the wiki article to improve the documentation. And here is a complete example…

local frame = CreateFrame("Frame")
frame:RegisterEvent("INSPECT_READY")
frame:SetScript("OnEvent", function(self, event, arg1)
  if event == "INSPECT_READY" and arg1 = UnitGuid("target") then
    local specializationID = GetInspectSpecialization("target")
    local role = GetSpecializationRoleByID(specializationID)
  end
end)

function Foo()
  if UnitExists("target") and UnitIsPlayer("target") then
    NotifyInspect("target")
  end
end

/run Foo()

Edit: added another line to indicate if tank, dps, heal, etc.

thanks for the suggestion

Sadly that only works with friendly players or enemy players with pvp disabled. The original intent of this thread was to look at enemy players in BGs to get an idea of how geared they are.

I think the only way to figure out the spec of an enemy player is to scan the combat log for spec specific spells.

Oops. That could be a problem.

Use UnitAura() to see if they have buffs that only a tank would have?

Checked that last night, passives such as veteran of the third war for DKs seem to be hidden i checked using /dump UnitAura(“target”, i) where i is the aura index. I went through all of auras applied to my DK and was unable to find it.

/run print(UnitHealthMax(“target”))
?

That prints the targets health including any health modifiers they have, I want base health i.e. health with no buffs.

Not accessible through the API I don’t think.

The best you’re going to be able to do is look at the current health and the current BUFFS and see if you can’t work into it backwards. Something very hard to do from a macro level script.

Yep that’s what I ended up doing with the weakaura above. It works for most classes and specs. It does not work on tanks or fury warriors.