Originally Posted by
Luciferozzy
Hi i need help creating a loop function and i was hopeing some nice ppl in here could help me.
What i need is a loop that looks thru the raid to see how many got a certain buff
but i only want it to return if the person also got hp below lets say 90
and then I want to use the return to cast a spell.
lets say 5 ppl got the buff and are below 90 hp i want to cast a spell.
Is this possible?
Something like this?
Havent tested it, just created it now
Code:
function SomeFunction(buff, amount, health)
local units = 0
if IsInGroup() or IsInRaid() then
local prefix = (IsInRaid() and 'raid') or 'party'
for i = 1, GetNumGroupMembers() do
local Obj = prefix..i
if math.floor((UnitHealth(Obj) / UnitHealthMax(Obj)) * 100) <= health then
local Name, _,_, Count, _,_,_,_,_,_, Id = UnitBuff(Obj, buff)
if Count then
units = units + 1
end
end
end
end
return units >= amount
end