Code:
function Hellraiser_OnCombat (unit, Event)
unit:SendChatMessage(14, 0, "You stand no chance against the Fire Lord!")
unit:RegisterEvent("Hellraiser_CheckA", 100, 0)
end
function Hellraiser_CheckA(unit, Event)
if unit:GetHealthPct() <= 75 then
unit:RemoveEvents()
unit:RegisterEvent("Hellraiser_Spawn", 45000, 0)
unit:RegisterEvent("Hellraiser_CheckB", 100, 0)
end
end
function Hellraiser_Spawn(unit, Event)
unit:SendChatMessage(14, 0, "Minions! Aid your master!")
x, y, z, o = unit:GetX(), unit:GetY(), unit:GetZ(), unit:GetO()
unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
unit:SpawnCreature (43111, x, y, z, o, 14, 30000)
end
function Hellraiser_CheckB (unit, Event)
if unit:GetHealthPct() <= 25 then
unit:SendChatMessage(14, 0, "I'll make sure you wish you had never been born!")
unit:RemoveEvents() ;
unit:CastSpell(24222) ;
unit:Teleport (1, 4792.708984, 1948.873291, 1072.531291)
unit:GetClosestPlayer()
unit:FullCastSpellOnTarget(20564)
unit:FullCastSpellOnTarget(20564)
unit:Teleport (1, 4781.679199, 1981.849487, 1073.596680)
unit:GetClosestPlayer()
unit:FullCastSpellOnTarget(20564)
unit:FullCastSpellOnTarget(20564)
unit:GetMainTank()
end
end
function Hellraiser_OnLeaveCombat (unit, Event)
unit:SendChatMessage(14, 0, "Fools! You have failed!")
unit:RemoveEvents() ;
end
function Hellraiser_OnDeath(unit, Event)
unit:SendChatMessage(14, 0, "Fools! You have failed!")
unit:RemoveEvents() ;
end
function Hellraiser_OnDied(unit, Event)
unit:SendChatMessage(14, 0, "I... I don't understand... How could this happen?")
unit:RemoveEvents() ;
end
RegisterUnitEvent(43110, 1, "Hellraiser_OnCombat")
RegisterUnitEvent(43110, 2, "Hellraiser_OnLeaveCombat")
RegisterUnitEvent(43110, 3, "Hellraiser_OnDeath")
RegisterUnitEvent(43110, 4, "Hellraiser_OnDied")
So what your doing now is, constantly check HP until its under 75% Then stop checking. Start Runnign Spawn Function every 45 seconds and Check if its under 25%. Every 45 seconds it spawns. Once he hits 25% HP stop Checking and Stop ads Spawning. Run Phase 2