Forum > Serverside Modding

[LUA] Unit:GetHealthPct Not Working

(1/2) > >>

Diemen:
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 ? :P


--- Code: ------------------- 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")
--- End code ---

Diemen:
60 views and no one who can  give me an answer ? ...

schlumpf:

--- Quote ---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.)
--- End quote ---
yes, but you never said which server or engine you use instead of pasting al code that does not matter. Refer I their documentation.

Ascathos:
ArcEmu supports LUA. Not sure if the boss scripts do, though.

Trinity Core does not. I suggest looking into EventMap.

Diemen:
I'm sorry for being not clear enough , i am indeed using  a arcemu Server.
i never had any trouble with Scripts like these on my old server btw.
ArcEmu is using LuaEngine  i didn't use LuaBridge

Navigation

[0] Message Index

[#] Next page

Go to full version