Originally Posted by XEVENEX
I'm looking for functions or events that will fire if the player needs to cc break or when the player has cc immunity. I'd like to add some UI elements to make these two states a little more visible.
|
Hi.
I've never tried anything like this and I have not tested any of the code I posted below, but this is the first thing I would try.
EVENT_COMBAT_EVENT returns all kinds of information:
Lua Code:
EVENT_COMBAT_EVENT (integer eventCode, integer result, bool isError, string abilityName, integer abilityGraphic, integer abilityActionSlotType, string sourceName, integer sourceType, string targetName, integer targetType, integer hitValue, integer powerType, integer damageType, bool log)
On the esoui wiki Constants page, here:
ESOUI Wiki Constants search for ACTION_RESULT and see the long list of action results that can occur.
As an example I see one that says: ACTION_RESULT_STUNNED
Which is probably one of the results your looking for. So my guess is you could do something like:
Lua Code:
local function OnCombatEvent(eventCode, result, isError, abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log)
-- get the unit name for the target of the action
local sTarget = zo_strformat(SI_UNIT_NAME, targetName)
-- if the target of the action is not the player then return, nothing to do
if sTarget ~= GetUnitName("player") then return end
-- then check what the result of the combat action is:
if result == ACTION_RESULT_STUNNED then
-- then the player is stunned, do something
end
-- check the result against other ACTION_RESULTS and do whatever...
end
-- Make sure you register for the event
EVENT_MANAGER:RegisterForEvent(addon.name, EVENT_COMBAT_EVENT, OnCombatEvent)
Hope that helps.