Hi there, I felt that there wasn't enough custom bosses out there for people who like to mess around making their own instances.
Therefore I'm releasing a boss from my twink realm.
Therefore I'm releasing a boss from my twink realm.
Code:
local NPC_ID = 60005 -- EDIT BOSS ENTRY
local SPORE = 60006 -- EDIT HEALTHORB ENTRY
local gobj = nil
local gobj2 = nil
local despawn = false
local boss = nil
--START OF Gar'tek
local function ShadowBoltVolley (eventID, delay, pCall, creature)
creature:CastSpell(creature, 27383)
end
local function ChangeTarget (eventID, delay, pCall, creature)
local target = creature:GetAITarget(0, true)
target:SendAreaTriggerMessage("Gar'tek is chasing you!")
creature:ClearThreatList()
creature:AddThreat(target, 100000)
end
local function PhaseTwo (eventID, delay, pCall, creature)
creature:RemoveEvents()
creature:StopSpellCast(16410)
creature:SetRooted(false)
creature:RegisterEvent(ChangeTarget, 10000, 0)
creature:RegisterEvent(ShadowBoltVolley, 14000, 0)
end
local function ShadowBolt (eventID, delay, pCall, creature)
local target = creature:GetAITarget(0, true)
creature:CastSpell(target, 16410, false)
end
local function DoD (eventID, delay, pCall, creature)
local target = creature:GetAITarget(0, true)
creature:CastSpell(target, 43265, true)
end
local function CheckHealth (eventID, delay, pCall, creature)
if creature:GetHealthPct() <= 60 then
creature:RemoveEvents()
despawn = true
creature:RegisterEvent(PhaseTwo, 10, 0)
end
end
local function PhaseOne (eventID, delay, pCall, creature)
local spawnrand = math.random(1,4)
if spawnrand == 1 then
creature:SpawnCreature(SPORE, 149, 266, -13, 0.7) --EDIT x, y, z, orientation SpawnPosition1
elseif spawnrand == 2 then
creature:SpawnCreature(SPORE, 212, 266, -13, 2.5) --EDIT x, y, z, orientation SpawnPosition2
elseif spawnrand == 3 then
creature:SpawnCreature(SPORE, 195, 245, -13, 1.9) --EDIT x, y, z, orientation SpawnPosition3
elseif spawnrand == 4 then
creature:SpawnCreature(SPORE, 161, 245, -13, 1.1) --EDIT x, y, z, orientation SpawnPosition4
end
end
local function Gartek_OnCombat (event, creature, target)
local target = creature:GetAITarget(0, true)
creature:AttackStop()
creature:CastSpell(target, 16410, false)
creature:RegisterEvent(PhaseOne, 15000, 0)
creature:RegisterEvent(DoD, 12000, 0)
creature:RegisterEvent(ShadowBolt, 3000, 0)
creature:RegisterEvent(CheckHealth, 100, 0)
creature:SetRooted(true)
end
local function Gartek_Died (event, creature, target)
--[[gobj = creature:GetNearestGameObject(1000, 182540) --Range, Entry
gobj2 = creature:GetNearestGameObject(1000, 182539) --Range, Entry
gobj:SetGoState(0)
gobj2:SetGoState(0)]]-- Uncomment these if you want to open doors
creature:RemoveEvents()
end
local function Gartek_OnLeaveCombat (event, creature, target)
creature:RemoveEvents()
end
local function Gartek_Spawn (event, creature, target)
creature:SetEquipmentSlots(28739, 0, 0)
creature:MoveHome()
creature:SetWalk(true)
end
RegisterCreatureEvent(NPC_ID, 1, Gartek_OnCombat)
RegisterCreatureEvent(NPC_ID, 24, Gartek_OnLeaveCombat)
RegisterCreatureEvent(NPC_ID, 5, Gartek_Spawn)
RegisterCreatureEvent(NPC_ID, 4, Gartek_Died)
--START OF SPORE
local function Spore_Despawn (eventID, delay, pCall, creature)
creature:DespawnOrUnsummon(1)
end
local function Spore_Move (eventID, delay, pCall, creature)
boss = creature:GetNearestCreature( 100, 60005)
print(boss)
if boss ~= nil then
creature:MoveFollow(boss)
if despawn then
creature:RegisterEvent(Spore_Despawn, 1, 0)
end
local distance = creature:GetDistance(boss)
if distance ~= nil and distance <= 0.8 then
local hp = boss:GetHealth()
boss:SetHealth(hp + 750)
if boss:GetHealth() > boss:GetMaxHealth() then
boss:SetHealth(boss:GetMaxHealth())
end
creature:DespawnOrUnsummon(1)
end
else
despawn = true
end
end
local function Spore_Spawn (event, creature, target)
creature:RegisterEvent(Spore_Move, 100, 0)
end
local function Spore_Died (event, creature)
creature:DespawnOrUnsummon(1)
end
RegisterCreatureEvent(SPORE, 5, Spore_Spawn)
RegisterCreatureEvent(SPORE, 4, Spore_Died)