TellMeWhen

TellMeWhen

24M Downloads

[CF 1481] How to get count of raid units with special low hp?

tmw-issue-import opened this issue ยท 5 comments

commented

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

commented

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

commented

(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

commented

https://gist.githubusercontent.com/arieh/756285d088ce1905b4b29b4533e50b4c/raw/21cfd0bd43bcd6f37fa502c86a15fb558d0303fe/gistfile1.txt

 

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

commented

can also try this one:

https://gist.githubusercontent.com/arieh/58294fed09a7e51b6e0eb42902bcf9c7/raw/f1ad8ac0e3b4b5cbc2908368d0704b1a1054ec25/gistfile1.txt

 

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

commented

Thanks for answer, this is a lot of new staff for me :)


Posted by CurseForge user Aynni