1
Serverside Modding / [LUA] Unit:GetHealthPct Not Working
« on: March 08, 2013, 10:37:07 pm »
Hey Guys ,
I Made a Script but the problem is that when i use it ingame it Skips the Health Checks and Just proceeds to the next phase...
I tried everything i could find on the web but without any result...
Could it be that the Lua Engine i have in my server does not support this feature ? ( this could be the only thing i could think of at the moment.)
Well if some one could Check my Script for any bugs of have another solution , let me know !
Gr ,
Steve
Ps. Scroll box for posting walls of Text not working or am i doing it wrong ?
I Made a Script but the problem is that when i use it ingame it Skips the Health Checks and Just proceeds to the next phase...
I tried everything i could find on the web but without any result...
Could it be that the Lua Engine i have in my server does not support this feature ? ( this could be the only thing i could think of at the moment.)
Well if some one could Check my Script for any bugs of have another solution , let me know !
Gr ,
Steve
Ps. Scroll box for posting walls of Text not working or am i doing it wrong ?
Code: [Select]
---------------- Boss Fight -----------------
-- Variables
local NPC_ID = 90016
--------------------- Combat States -------------------
function Lorean_OnEnterCombat(Unit, Event)
Unit:CastSpell(48469) -- MOTW
Unit:CastSpell(53307) -- Thorns
Unit:CastSpell(768) -- Catform
Unit:RegisterEvent("MangleCat", 1500, 0)
Unit:RegisterEvent("RakeCat", 2000, 0)
Unit:RegisterEvent("FerociousBite", 5000, 0)
Unit:RegisterEvent("TigersFury", 10000, 0)
Unit:SendChatMessage(14,0,"So you wish to challenge me !")
Unit:SendChatMessage(14,0,"Powers of the Ancestors I invoke the !")
Unit:RegisterEvent("Lorean_Phase1", 2000, 0) -- Phase begint na 2 seconden Zoals het moet.
Unit:SendChatMessage(14,0,"Fase 1 Gestart")
end
function Lorean_OnLeaveCombat(Unit, Event, player)
Unit:RemoveEvents()
end
function Lorean_OnKilledTarget(Unit, Event, player)
Unit:SendChatMessage(14,0,"You will not break this dream !")
end
function Lorean_OnDeath(Unit, Event, player)
Unit:SendChatMessage(14,0,"NOOOO !!!!")
Unit:RemoveEvents()
end
--------------- Phases -------------------
function Lorean_Phase1(Unit, Event)
if Unit:GetHealthPct() <= 90 then
Unit:RemoveEvents()
Unit:RegisterEvent("MoonkinForm", 1000, 1)
Unit:RegisterEvent("Roots", 6000, 0)
Unit:RegisterEvent("Moonfire", 2000, 0)
Unit:RegisterEvent("Starfire", 11000, 0)
Unit:RegisterEvent("Wrath", 2500, 0)
Unit:RegisterEvent("Hurricane", 15000, 0)
Unit:RegisterEvent("Lorean_Phase2", 1000, 0)
Unit:SendChatMessage(14,0,"Fase 2 Gestart")
end
end
function Lorean_Phase2(Unit, Event)
if Unit:GetHealthPct() <= 80 then
Unit:RemoveEvents()
Unit:RegisterEvent("Lorean_Phase3", 1000, 0)
Unit:SendChatMessage(14,0,"Fase 3 Gestart")
end
end
function Lorean_Phase3(Unit, Event, player)
Unit:SendChatMessage(14,0,"Fase 3 Gestart")
if Unit:GetHealthPct() <= 70 then
Unit:RemoveEvents()
Unit:RegisterEvent("Lorean_Phase4", 1000, 0)
end
end
function Lorean_Phase4(Unit, Event, player)
Unit:SendChatMessage(14,0,"Fase 4 Gestart")
if Unit:GetHealthPct() <= 50 then
Unit:RemoveEvents()
Unit:RegisterEvent("Lorean_Phase5", 1000, 0)
end
end
function Lorean_Phase5(Unit, Event, player)
Unit:SendChatMessage(14,0,"Fase 5 Gestart")
if Unit:GetHealthPct() <= 30 then
Unit:RemoveEvents()
Unit:RegisterEvent("Lorean_Phase6", 1000, 0)
end
end
function Lorean_Phase6(Unit, Event, player)
Unit:SendChatMessage(14,0,"Fase 6 Gestart")
if Unit:GetHealthPct() <= 10 then
Unit:RemoveEvents()
end
end
-------- Cat Spells -----
function Catform(Unit, Event)
Unit:CastSpell(768)
end
function MangleCat(Unit, Event, player)
Unit:CastSpellOnTarget(42389, Unit:GetMainTank())
end
function RakeCat(Unit, Event)
Unit:CastSpell(27638)
end
function TigersFury(Unit, Event)
Unit:CastSpell(9845)
end
function FerociousBite(Unit, Event)
Unit:CastSpell(27557)
end
-------- Bear Spells -----
function Bearform(Unit, Event)
Unit:CastSpell(9634)
end
function MangleBear(Unit, Event)
Unit:CastSpell(42389)
end
function Barkskin(Unit, Event)
Unit:CastSpell(22812)
end
function Demo_Roar(Unit, Event)
Unit:CastSpell(9898)
end
function FaerieFireFeral(Unit, Event)
Unit:CastSpell(16857)
end
function Bash(Unit, Event)
Unit:CastSpell(8983)
end
function FrenzyRegen(Unit, Event)
Unit:CastSpell(22842)
end
-------- Healing Spells -----
function Regrowth(Unit, Event)
Unit:CastSpell(48443)
end
-------- Attack Spells -----
function MoonkinForm(Unit, Event, player)
Unit:CastSpell(24858)
end
function Moonfire(Unit, Event)
Unit:CastSpell(48469)
end
function Roots(Unit, Event)
Unit:CastSpell(21331)
end
function Wrath(Unit, Event)
Unit:CastSpell(48461)
end
function Starfire(Unit, Event)
Unit:CastSpell(48465)
end
function Hurricane(Unit, Event)
Unit:CastSpell(48467)
end
RegisterUnitEvent(90016, 1, "Lorean_OnEnterCombat")
RegisterUnitEvent(90016, 2, "Lorean_OnLeaveCombat")
RegisterUnitEvent(90016, 3, "Lorean_OnKilledTarget")
RegisterUnitEvent(90016, 4, "Lorean_OnDeath")