PDA

View Full Version : Capture the boss event



runiker
14-01-09, 10:23 AM
This code is done in lua and its a modifyed version of keegroths Lord Cyran script i have made it so that when a horde player kills it it will turn itself horde and when an allince kills it it will turn it allince making it so that whoever was the last one to knock it below 10% health gets him as there own boss.




function LordCyran_EnterCombat (pUnit, event)
pUnit:SendChatMessage(14, 0, "Deviants...")
pUnit:RegisterEvent("LordCyran_Fallout", 1000, 1)
pUnit:RegisterEvent("LordCyran_Doomthrust", 24000, 0)
pUnit:RegisterEvent("LordCyran_Armorslice", 20000, 0)
pUnit:RegisterEvent("LordCyran_Phase2", 1000, 0)
end
function LordCyran_Fallout (pUnit, event)
pUnit:FullCastSpellOnTarget(31472, pUnit:GetClosestPlayer())
end
function LordCyran_Doomthrust (pUnit, event)
pUnit:FullCastSpellOnTarget(30744, pUnit:GetMainTank())
end
function LordCyran_Armorslice (pUnit, event)
pUnit:FullCastSpellOnTarget(15656, pUnit:GetMainTank())
end
function LordCyran_Phase2 (pUnit, event)
if pUnit:GetHealthPct() < 72 then
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "Bow before my Greatness!Proclaim yourselves among my faithful...and I may spare you")
pUnit:RegisterEvent("LordCyran_Demoncall", 10000, 0)
pUnit:RegisterEvent("LordCyran_Lethal", 15000, 0)
pUnit:RegisterEvent("LordCyran_Valiant", 17000, 0)
pUnit:RegisterEvent("LordCyran_Phase3", 1000, 0)
end
end
function LordCyran_Demoncall (pUnit, event)
pUnit:FullCastSpellOnTarget(28383, pUnit:GetMainTank())
end
function LordCyran_Lethal (pUnit, event)
pUnit:FullCastSpellOnTarget(28308, pUnit:GetMainTank())
end
function LordCyran_Valiant (pUnit, event)
pUnit:CastSpell(46287)
end
function LordCyran_Phase3 (pUnit, event)
if pUnit:GetHealthPct() < 49 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("LordCyran_Demoralize", 20000, 0)
pUnit:RegisterEvent("LordCyran_Impale", 50000, 0)
pUnit:RegisterEvent("LordCyran_Terror", 35000, 0)
pUnit:RegisterEvent("LordCyran_Phase4", 1000, 0)
end
end
function LordCyran_Demoralize (pUnit, event)
pUnit:CastSpell(27780)
end
function LordCyran_Impale (pUnit, event)
pUnit:CastSpell(19781)
end
function LordCyran_Terror (pUnit, event)
pUnit:FullCastSpellOnTarget(36950, pUnit:GetRandomPlayer(0))
end
function LordCyran_Phase4 (pUnit, event)
if pUnit:GetHealthPct() < 10 then
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "So...You have chosen...Death!")
pUnit:CastSpell(39046)
end
pUnit:RegisterEvent("getplayerclass", 3000, 0)
end
function LordCyran_LeaveCombat (pUnit, event)
pUnit:RemoveEvents()
end
function LordCyran_Die (pUnit, event)
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "Pity you cannot understand the reality of your situation....")
end

function getplayerclass (pUnit, event)

local faction = pUnit:GetFaction()

if faction = 1052 then
pUnit:SetFaction(1036)


else

pUnit:SetFaction(1052)


pUnit:RemoveEvents()
end
end


RegisterUnitEvent(777884, 1, "LordCyran_EnterCombat")
RegisterUnitEvent(777884, 2, "LordCyran_LeaveCombat")
RegisterUnitEvent(777884, 4, "LordCyran_Die")