Code:
--local npcid = 1000000
-- Boss entry id?
function KingKandaroth_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function KingKandaroth_OnKilledTarget(Unit, Event)
Unit:SendChatMessage(12, 0, "HA! a Casualty to be taken care off!")
Unit:CastSpell(2060)
end
function KingKandaroth_OnDied(Unit, Event)
Unit:SendChatMessage(12, 0, "No...How..dare..you destroy me!")
end
RegisterUnitEvent(5000001, 2, "KingKandaroth_OnLeaveCombat")
RegisterUnitEvent(5000001, 3, "KingKandaroth_OnKilledTarget")
RegisterUnitEvent(5000001, 4, "KingKandaroth_OnDied")
RegisterUnitEvent(5000001, 1, "KingKandaroth_OnCombat")
function KingKandaroth_OnCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "The Lich King Only wished for you to come he was devastated that u broke his defences,but know we have bronken yours HA!")
Unit:RegisterEvent("KingKandaroth_Phase1", 10000, 1)
end
function KingKandaroth_Phase1(Unit, Event)
if Unit:GetHealthPct() <= 75 then
Unit:RemoveEvents()-- A phase can't have a loop without this, and also this can remove some problems.
Unit:SendChatMessage(14, 0, "Try Handling This!")
Unit:CastSpell(69037)
--Unit:RegisterEvent("KingKandaroth_Phase1_Spell", 3500, 0) -- Try make Events like this ^^ it's useful.
end
Unit:RegisterEvent("KingKandaroth_Phase2", 10000, 1)--Try to place the Register for next event phase between the ends
end
function KingKandaroth_Phase2(Unit, Event)
if Unit:GetHealthPct() <= 50 then
Unit:RemoveEvents()
Unit:SendChatMessage(14, 0, "How Dare you Even attempt to weaken me further!")
Unit:SendCHatMessage(12, 0, "Lets Weaken YOU a bit!")
Unit:FullCastSpellOnTarget(5, Unit:GetRandomPlayer(3))
--Unit:RegisterEvent("KingKandaroth_Phase2_Spell", 3500, 0) -- And this
end
Unit:RegisterEvent("KingKandaroth_Phase3", 20000, 1)
end
function KingKandaroth_Phase3(Unit, Event)
if Unit:GetHealthPct() <= 10 then
Unit:RemoveEvents()
Unit:SendChatMessage(14, 0, "NO! You Have reduced me to virtually a shred it cannot be!")
Unit:SendchatMessage(12, 0, "Try To Defeat me After this")
Unit:CastSpell(70358)
Unit:FullCastSpellOnTarget(5, Unit:GetRandomPlayer(3))
--Unit:RegisterEvent("KingKandaroth_Phase3_Spell", 3500, 0) -- And this :P
end
end
-- *** Then Register the Spell events down here! It will solve a lot of problems if you make bigger scripts! ***
-- *** Example for Phase1's spell:
--function KingKandaroth_Phase1_Spell(Unit, Event, Attacker)
--if(pUnit:GetMainTank() ~=nil) then
--pUnit:CastSpellOnTarget(69037, Unit:GetMainTank())
--else
--end
--end