[CF 1481] How to get count of raid units with special low hp?
tmw-issue-import opened this issue ยท 5 comments
I tried use icon type unit conditions and for eah unit set HP value and use use stack visible but its doesn't help. I see only solution to create 40+ icons for each raid number and use counter as notification. Can some one explain me how to get count of buffs/unit hp from multi targets?
Posted by CurseForge user Aynni | Imported from CurseForge issue #1481 | Raw
You can do this with LUA by rotating all party members and checking their HP, then keep that number on a counter.
This code (didnt test but it should work baring any LUA syntax errors I might have) will get you the count:
local low_health_count = 0
local i, unit_name, current, max
for i=1,40 do
unit_name = GetRaidRosterInfo(index)
if (unit_name) then
current = UnitHealth(unit_name)
max = UnitHealthMax(unit_name)
if (current / max < 0.3) then
low_health_count = low_health_count+1
end
end
end
You can use the code in this issue to update the counter.
You will also need to decide when/how to poll this data.
Posted by CurseForge user ariehg
(don't know how to put this without sounding like self promotion, but you can use this addon I wrote to have some easier time writing such an icon since it exposes some easier APIs to do this sort of thing with TMW, though you can do it all without it)
Posted by CurseForge user ariehg
This will do the trick I think. If you dont use the addon I suggested you can just set the counter like it says in the issue I linked to.
The important thing for you is it creates a new counter - "low_health_count" - which you can use in any of your icons
Posted by CurseForge user ariehg
can also try this one:
which uses the combat log event icon type (which I just learned about :) ), though I might be using it incorrectly
Posted by CurseForge user ariehg