Hi there,
I've tried to bring up the "Eluna Engine" for trinitycore and so far it worked out for me. Now I'm playing around with a few LUA snippets. So far there are 2 different LUA scripts in my folder:
local PLAYER_EVENT_ON_LOGIN = 3
local function OnLogin(event, player)
player:SendBroadcastMessage("I'm online!")
end
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, OnLogin)
Thats quit easy, and its just for me to be sure LUA is working.
I've tried a little boss script and I dont know whats wrong but nothing happened. Here the code:
local NAME = "Elite Boss"
local NPCID = 600000
function Elite_OnCombat(pUnit, event, player)
Elite=pUnit
pUnit:SendChatMessage(12, 0, "Hello")
pUnit:RegisterEvent("Elite_Phase1", 1000, 1)
end
function Elite_OnLeaveCombat(pUnit, event, player)
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "Bye")
end
function Elite_OnDeath(pUnit, event, player)
pUnit:RemoveEvents()
end
function Elite_Phase1(pUnit, event, player)
if Elite:GetHealthPct() == 85 then
Elite:SendChatMessage(12, 0, "I see that you want a true battle")
Elite:CastSpell(52262)
Elite:RegisterEvent("Elite_Phase2", 1000, 1)
end
end
RegisterUnitEvent(600000, 1, "Elite_OnCombat")
RegisterUnitEvent(600000, 2, "Elite_OnLeaveCombat")
RegisterUnitEvent(600000, 4, "Elite_OnDeath")
I've just copied this from an online tutorial. The ID 600000 is my testing npc, but he still just hit me without any word
The Eluna log told me the folowing things:
I'm at the very beginning of LUA, so Ihave no Idea how to fix that. Every little hint would be great.
Edit:
Okay, worked out that the second "end" near to the end is without any sense. But still not workable.