Code:
RegisterUnitEvent(70027, 1, "Grull_OnCombat")
RegisterUnitEvent(70027, 2, "Grull_OnLeaveCombat")
RegisterUnitEvent(70027, 3, "Grull_OnKillTarget")
RegisterUnitEvent(70027, 4, "Grull_OnDeath")
RegisterUnitEvent(70026, 1, "Mini_OnCombat")
RegisterUnitEvent(70026, 2, "Mini_OnLeaveCombat")
RegisterUnitEvent(70026, 3, "Mini_OnKillTarget")
RegisterUnitEvent(70026, 4, "Mini_OnDeath")
RegisterUnitEvent(70022, 18, "Ad_OnSpawn")
RegisterGameObjectEvent(999012,2,"CustomMallPortal")
--Declare Variables--
local ad = 70
local g
--Grull Functions
function Grull_OnCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "You Want to Die? As You Wish. . . ")
Unit:RegisterEvent("Grull_one", 100, 0)
end
function Grull_OnKillTarget(Unit, Event)
Unit:SendChatMessage(14, 0, "Pityful Beings, Yet Another of your Team is Laid to Rest")
end
function Grull_OnDeath(Unit, Event)
Unit:RemoveEvents()
Unit:SendChatMessage(14, 0, "No! I... can't... die... I am... the Dragonslayer...")
Unit:SendChatMessage(16, 0, "Shade of Grull's Body Shrinks as His Power is Drained by a Mysterious Portal")
Unit:SetScale(0.2)
Unit:SpawnGameObject(999012,Unit:GetX(),Unit:GetY(),Unit:GetZ(),6,60000)
end
function Grull_one(Unit, Event)
local p
p=math.random(1, 2)
if Choice==1 then
Unit:CastSpell(6432)
end
end
--Portal--
function CustomMallPortal(pUnit, Event, pMisc)
pUnit:Teleport(1,-10551.9,2194.788,-20)
pMisc:Teleport(1,-10551.9,2194.788,-20)
end
--MiniBoss--
function Mini_OnCombat(Unit, Event)
g=Unit
Unit:SendChatMessage(14, 0, "Open the dances!")
Unit:RegisterEvent("Mini_one", 100, 0)
end
function Mini_OnKillTarget(Unit, Event)
Unit:SendChatMessage(14, 0, "One Dancer Down")
end
function Mini_OnDeath(Unit, Event)
Unit:RemoveEvents()
Unit:SendChatMessage(14, 0, "You.. danced better... than me...")
end
function Mini_one(Unit, Event)
if Unit:GetHealthPct() <= 80 then
Unit:RemoveEvents()
local x = Unit:GetX();
local y = Unit:GetY();
local z = Unit:GetZ();
local o = Unit:GetO();
Unit:SpawnCreature (70022, x+3, y+3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x+3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y+3, z, o, 14 ,60000);
Unit:RegisterEvent("Mini_two", 100, 0)
end
end
function Mini_two(Unit, Event)
if Unit:GetHealthPct() <= 60 then
Unit:RemoveEvents()
local x = Unit:GetX();
local y = Unit:GetY();
local z = Unit:GetZ();
local o = Unit:GetO();
Unit:SpawnCreature (70022, x+3, y+3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x+3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y+3, z, o, 14 ,60000);
Unit:RegisterEvent("Mini_thr", 100, 0)
end
end
function Mini_thr(Unit, Event)
if Unit:GetHealthPct() <= 40 then
Unit:RemoveEvents()
local x = Unit:GetX();
local y = Unit:GetY();
local z = Unit:GetZ();
local o = Unit:GetO();
Unit:SpawnCreature (70022, x+3, y+3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x+3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y+3, z, o, 14 ,60000);
Unit:RegisterEvent("Mini_fou", 100, 0)
end
end
function Mini_fou(Unit, Event)
if Unit:GetHealthPct() <= 20 then
Unit:RemoveEvents()
local x = Unit:GetX();
local y = Unit:GetY();
local z = Unit:GetZ();
local o = Unit:GetO();
Unit:SpawnCreature (70022, x+3, y+3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x+3, y-3, z, o, 14 ,60000);
Unit:SpawnCreature (70022, x-3, y+3, z, o, 14 ,60000);
end
end
--MiniBoss Ads
function Ad_OnSpawn(Unit, Event)
Unit:RegisterEvent("ADCHECK", 100, 0)
end
function ADCHECK(Unit, Event)
if g:GetHealthPct() <= ad then
Unit:Despawn(100, 0)
ad = ad - 20
end
end
The Ad's arnt Despawning at 70,50,30,10 as they should