Hi everyone !
I need help writing a mod in lua. (I don't know how to write in lua ..).
I followed a few tutorials and I manage to get this mod working (it's not mine) but I wanted to add some features.
So this is the mod
CombatWarning= {}
CombatWarning.name = "CombatWarning"
function CombatWarning:Initialize()
CombatWarning.inCombat = IsUnitInCombat("player")
end
function CombatWarning.OnAddOnLoaded(event, addonName)
if addonName == CombatWarning.name then
CombatWarning:Initialize()
end
end
EVENT_MANAGER:RegisterForEvent(CombatWarning.name, EVENT_ADD_ON_LOADED, CombatWarning.OnAddOnLoaded)
EVENT_MANAGER:RegisterForEvent(CombatWarning.name, EVENT_PLAYER_COMBAT_STATE, CombatWarning.OnPlayerCombatState)
function CombatWarning.OnPlayerCombatState(event, inCombat)
if inCombat ~= CombatWarning.inCombat then
CombatWarning.inCombat = inCombat
if inCombat then
d("Entering combat.")
else
d("Exiting combat.")
end
end
end
And I would like to add this function EVENT_MOUNTED_STATE_CHANGED (integereventCode, boolmounted) so that when the player get on or off his mount a message appears in the chatbox. I tried doing it like the player combat state function but it's not working ..
Anyone can help me ?