FIXED, SEE BELOW FOR NEW PROBLEM -_-
Hi, I'm in the process of learning LUA, It's still a little difficult, but I think I got a grip of it. Heres my script
It almost works, however, once he reaches 85%, he casts both spells on himself.function phase_1(pUnit, Event)
if pUnit:GetHealthPct() < 85 then
pUnit:RemoveEvents()
pUnit:GetMainTank()
pUnit:SendChatMessage (11, 0, "THE SCOURGE IS DOMINANT!")
pUnit:CastSpellOnTarget(40876)
pUnit:RegisterEvent("phase_2",1000, 0)
end
end
function phase_2(pUnit, Event)
if pUnit:GetHealthPct() < 85 then
pUnit:GetMainTank()
pUnit:RemoveEvents()
pUnit:CastSpellOnTarget(40876)
end
end
function Boss_Start(pUnit, Event)
pUnit:RegisterEvent("phase_1",1000, 0)
pUnit:SendChatMessage (11, 0, "YOU ARE A FOOL TO CHALLENGE THE DAMNED!")
end
RegisterUnitEvent(99012, 1, "Boss_Start")
Can someone explain to me what I did wrong? Any help is appreciated.
My new problem
heres my new script
However, i get this error after phase_2 finnishes,function phase_1(pUnit, Event)
if pUnit:GetHealthPct() < 85 then
pUnit:RemoveEvents()
pUnit:SendChatMessage (11, 0, "THE SCOURGE IS DOMINANT!")
pUnit:CastSpellOnTarget(40243, pUnit:GetMainTank())
pUnit:RegisterEvent("phase_2",1000, 0)
end
end
function phase_2(pUnit, Event)
if pUnit:GetHealthPct() < 82 then
pUnit:RemoveEvents()
pUnit:FullCastSpellOnTarget(40876, pUnit:GetMainTank())
pUnit:RegisterEvent("Phase_3",1000, 0)
end
end
function phase_3(pUnit, Event)
if pUnit:GetHealthPct() < 50 then
pUnit:RemoveEvents()
pUnit:FullCastSpellOnTarget(40876, pUnit:GetMainTank())
end
end
function Boss_Start(pUnit, Event)
pUnit:RegisterEvent("phase_1",1000, 0)
pUnit:SendChatMessage (11, 0, "YOU ARE A FOOL TO CHALLENGE THE DAMNED!")
end
RegisterUnitEvent(99012, 1, "Boss_Start")
(If you can't see it, it says "Tried to call invalid LUA function "Phase_3" from Ascent <Unit>!")
After the Boss dies, Ascent then proceeds to crash.
What did I do wrong? Again, thanks for any help.