Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local T = {}
- local function OnCombat(pUnit, event, pAttacker)
- T[tostring(pUnit)] = CreateLuaEvent(function() HPCheck(pUnit) end, 5000, 17280)
- end
- local function HPCheck(pUnit)
- if(pUnit:GetHealthPct() <= 20) then
- for k,target in pairs(pUnit:GetInRangePlayers()) do
- target:CastSpell(9220)
- end
- if(T[tostring(pUnit)]) then
- DestroyLuaEvent(T[tostring(pUnit)])
- end
- end
- end
- do
- local QUERY = WorldDBQuery("SELECT Entry FROM creature_proto WHERE boss = 1")
- for i = 1, QUERY:GetRowCount() do
- RegisterUnitEvent(QUERY:GetColumn(0):GetLong(), 1, OnCombat)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement