Code:
function Menion_OnCombat(pUnit, Event)
pUnit:RegisterEvent("Menion_DivineProtection", 1000, 0) --checks every second if the boss is at 60%
local RandomTalk=math.random(1, 4);
if RandomTalk == 1 then
pUnit:SendChatMessage(14, 0, "I'm going to be a Kingslayer!")
elseif RandomTalk == 2 then
pUnit:SendChatMessage(14, 0, "It's title time!")
elseif RandomTalk == 3 then
pUnit:SendChatMessage(14, 0, "I need more buffs!")
elseif RandomTalk == 4 then
pUnit:SendChatMessage(14, 0, "Ok, heal me, I'm going to be taking tons of damage!")
end
end
function Menion_DivineProtection(pUnit, Event)
if pUnit:GetHealthPct() <= 60 then
pUnit:RemoveEvents() --remove the 1 second check function
pUnit:SendChatMessage(14, 0, "Heal me, y'all")
pUnit:CastSpell(498) --Divine Protection
end
end
function Menion_OnDied(pUnit, Event)
pUnit:SendChatMessage(14, 0, "They should make it 50%...")
pUnit:RemoveEvents()
end
RegisterUnitEvent(900014, 1, "Menion_OnCombat")
RegisterUnitEvent(900014, 4, "Menion_OnDied")
end