Code:
-- Replace inside quotes to make the boss say something when entering combat, killing a target, etc...
-- Leave as "" to say nothing
local Combat_Enter = "I entered combat"
local Combat_Kill = "I killed a target"
local Combat_Dead = "I died"
local Combat_Wipe = "I left combat"
-- Fill in the time between each cast of the spell, in miliseconds (1000 = 1 second)
local Time_ShadowBolt = 6000
local Time_Pyroblast = 10000
local Time_Fear = 12000
local Time_ShadowFury = 8000
local Time_FlashHeal = 15000
-- the entry id for the boss
local entry = 900000
-- the display id before the dragon
local display = 24706
-- Dont change anything after this
kBossk = {}
local Times = {Time_ShadowBolt,Time_Pyroblast,Time_Fear,Time_ShadowFury,Time_FlashHeal}
local Messages = {Combat_Enter, Combat_Kill, Combat_Dead, Combat_Wipe}
local Spells = {70281, 64698, 5782, 45270, 68024}
function kBossk.OnCombat(pUnit, event, pAttacker)
local sUnit = tostring(pUnit)
kBossk[sUnit] = {}
kBossk[sUnit].phase = 1
pUnit:RegisterEvent(kBossk.Phases, 2000, 0)
pUnit:RegisterEvent(kBossk.Spells, 2000, 1)
if(Messages[1] ~= "") then
pUnit:SendChatMessage(12, 0, Messages[1])
end
end
function kBossk.OnLeaveCombat(pUnit, event, pLastTarget)
local sUnit = tostring(pUnit)
if(Messages[4] ~= "") then
pUnit:SendChatMessage(12, 0, Messages[4])
end
pUnit:RemoveEvents()
kBossk[sUnit] = {}
pUnit:Despawn(1000, 20000)
end
function kBossk.OnKilledTarget(pUnit, event, pDied)
if(Messages[2] ~= "") then
pUnit:SendChatMessage(12, 0, Messages[2])
end
end
function kBossk.OnDied(pUnit, event, pLastTarget)
local sUnit = tostring(pUnit)
pUnit:RemoveEvents()
kBossk[sUnit] = {}
if(Messages[3] ~= "") then
pUnit:SendChatMessage(12, 0, Messages[3])
end
end
function kBossk.OnSpawn(pUnit, event)
pUnit:SetModel(display)
end
function kBossk.Phases(pUnit, event)
local sUnit = tostring(pUnit)
if(pUnit:GetHealthPct() <= 80 and kBossk[sUnit].phase < 2) then
kBossk[sUnit].phase = 2
pUnit:RemoveEvents()
pUnit:RegisterEvent(kBossk.Phases, 1000, 0)
pUnit:RegisterEvent(kBossk.Spells, 100, 1)
elseif(pUnit:GetHealthPct() <= 50 and kBossk[sUnit].phase < 3) then
kBossk[sUnit].phase = 3
pUnit:RemoveEvents()
pUnit:SetModel(27082)
pUnit:RegisterEvent(kBossk.Phases, 1000, 0)
pUnit:RegisterEvent(kBossk.Spells, 100, 1)
end
end
function kBossk.Spells(pUnit, event)
local sUnit = tostring(pUnit)
if(kBossk[sUnit].phase == 1) then
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 1); end,Times[1], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 4); end,Times[4], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 2); end,Times[2], 0)
elseif(kBossk[sUnit].phase == 2) then
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 1); end,Times[1], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 2); end,Times[2], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 5); end,Times[5], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 4); end,Times[4], 0)
else
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 1); end,Times[1], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 4); end,Times[4], 0)
pUnit:RegisterEvent(function() kBossk.CastSpell(pUnit, 3); end,Times[3], 0)
end
end
function kBossk.CastSpell(pUnit, pSpell)
if(pSpell == 1) then
pUnit:CastSpellOnTarget(Spells[1], pUnit:GetRandomPlayer(0))
elseif(pSpell == 2) then
pUnit:CastSpellOnTarget(Spells[2], pUnit:GetMainTank())
elseif(pSpell == 3) then
pUnit:CastSpellOnTarget(Spells[3], pUnit:GetRandomPlayer(0))
elseif(pSpell == 4) then
pUnit:CastSpellOnTarget(Spells[4], pUnit:GetRandomPlayer(0))
else
pUnit:CastSpellOnTarget(Spells[5], pUnit)
end
end
RegisterUnitEvent(entry, 1, kBossk.OnCombat)
RegisterUnitEvent(entry, 2, kBossk.OnLeaveCombat)
RegisterUnitEvent(entry, 3, kBossk.OnKilledTarget)
RegisterUnitEvent(entry, 4, kBossk.OnDied)
RegisterUnitEvent(entry, 18, kBossk.OnSpawn)
Replace the stuff in red with what you want and add to your server.