Code:
Razorscalespawned = 0
Phase2 = false
function Start_Event(pUnit, event)
pUnit:RemoveEvents()
pUnit:RegisterEvent("Healthcheck_Start_Event", 1000, 0) --Starts the Timer
end
function Healthcheck_Start_Event(pUnit, event)
if pUnit:GetHealthPct() <= 50 or
pUnit:IsDead() == true and --If the Healthpoints of the NPC get under 50% he spawns Razorscale (Just a Interim solution)
Razorscalespawned == 0 then
pUnit:SpawnCreature(33186, X, Y, Z, O, 14, 0) --Here you replace "X" "Y" "Z" and "O" with the X Spawn-Coordinats, the Y Spawn Coordintes, the Z Coordinats and the Orientation
Razorscalespawned = 1
end
end
RegisterUnitEvent(33210, 1, "Start_Event")
function Razorscale_On_Combat(pUnit, event)
Razorscale = pUnit
Razorscale:RegisterEvent("Adds", 1000, 1) --Creates the Adds
Razorscale:RegisterEvent("Devouring_Flame", 5000, 1) --Creates the Timer for the Devouring Flame
Razorscale:RegisterEvent("Fireball", 10000, 0) -- Creates the Timer for her Fireball
Razorscale:RegisterEvent("Phase_2", 1000, 0)
end
RegisterUnitEvent(33186, 1, "Razorscale_On_Combat")
function Devouring_Flame(pUnit, event)
local Random = Razorscale:GetRandomPlayer(7)
Razorscale:RemoveEvent("Devouring_Flame")
Razorscale:CastSpellOnTarget(63014, "Random")
Razorscale:RegisterEvent("Devouring_Flame2", 25000, 0)
end
function Fireball(pUnit, event)
local Random = Razorscale:GetRandomPlayer(7)
Razorscale:CastSpellOnTarget(62796, "Random")
end
function where(pUnit, event)
RS_Position_X = Razorscale:GetX()
RS_Position_Y = Razorscale:GetY()
RS_Position_Z = Razorscale:GetZ()
end
function Adds(pUnit, event)
Razorscale:RemoveEvent(Adds)
Razorscale:SpawnGameObject(194316, RS_Position_X + 10, RS_Position_Y + 10, RS_Position_Z + 1, 5000)
Razorscale:SpawnGameObject(194316, RS_Position_X - 10, RS_Position_Y - 10, RS_Position_Z + 1, 5000)
Razorscale:RegisterEvent("Adds1", 20000, 0)
end
Wich_Kind_of_Mobs = math.random(1, 4)
function Spawnmobs(pUnit, event)
local Mole = pUnit
local MoleX = Mole:GetX() --Getting the X, Y and Z Coordinates of the Mole
local MoleY = Mole:GetY()
local MoleZ = Mole:GetZ()
if Wich_Kind_of_Mobs == 1 then --25% chance
Mole:SpawnCreature(33846, MoleX, MoleY, MoleZ, 0, 14, 0) --Spawns a Dark Rune Sentinel
else --75% chance
Mole:SpawnCreature(33453, MoleX, MoleY, MoleZ, 0, 14, 0) --Spawns a Dark Rune Watcher
Mole:SpawnCreature(33388, MoleX + 1, MoleY + 1, Molez, 0, 14, 0) --Spawns a Dark Rune Guardian
Mole:SpawnCreature(33388, MoleX - 1, MoleY - 1, Molez, 0, 14, 0) --Spawns a Dark Rune Guardian
end
end
RegisterGameObjectEvent(194316, 2, "Spawnmobs")
function Phase_2(pUnit, event)
if
Razorscale:GetHealthPct() <= 50 and
Phase2 == false
then
Razorscale:RemoveEvent()
Razorscale:RegisterEvent("Flame_Buffet", 20000, 0)
Razorscale:RegisterEvent("Wing_Buffet", 40000, 0)
Razorscale:RegisterEvent("Fuse_Armor", 35000, 0)
Razorscale:RegisterEvent("Flame_Breath", 25000, 0)
Razorscale:RegisterEvent("Devouring_Flame", 27000, 0)
Phase2 = true
end
end
function Flame_Buffet(pUnit, event)
local Maintank = Razorscale:GetMainTank()
Razorscale:CastSpellOnTarget(64016, "Maintank")
end
function Wing_Buffet(pUnit, event)
Razorscale:CastSpell(62666)
end
function Fuse_Armor(pUnit, event)
local Maintank = Razorscale:GetMainTank()
Razorscale:CastSpellOnTarget(64771, "Maintank")
end
function Flame_Breath(pUnit, event)
Razorscale:FullCastSpell(63317)
end