View Single Post
01/22/15, 11:35 PM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by XEVENEX View Post
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:
  1. 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:
  1. local function OnCombatEvent(eventCode, result, isError, abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log)
  2.    -- get the unit name for the target of the action
  3.    local sTarget = zo_strformat(SI_UNIT_NAME, targetName)
  4.  
  5.    -- if the target of the action is not the player then return, nothing to do
  6.    if  sTarget ~= GetUnitName("player") then return end
  7.  
  8.    -- then check what the result of the combat action is:
  9.    if result == ACTION_RESULT_STUNNED then
  10.       -- then the player is stunned, do something
  11.    end
  12.  
  13.    -- check the result against other ACTION_RESULTS and do whatever...
  14. end
  15.  
  16. -- Make sure you register for the event
  17. EVENT_MANAGER:RegisterForEvent(addon.name, EVENT_COMBAT_EVENT, OnCombatEvent)

Hope that helps.
  Reply With Quote