Thread Tools Display Modes
01/22/15, 04:52 PM   #1
XEVENEX
Join Date: Jan 2015
Posts: 6
CC Break & CC Immunity

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.
  Reply With Quote
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
01/23/15, 12:00 PM   #3
SpellBuilder
 
SpellBuilder's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 10
I would sugges to use Active Combat Tips system for this task
After you set to 'Always Show' in-game active combat tips, you can utilize fully the event
Code:
EVENT_DISPLAY_ACTIVE_COMBAT_TIP (integer eventCode, integer activeCombatTipId)
Take a look into CombatCloud or LuiExtended for how it is done. Of course, if you do not want to look into default UI tip visual, just hide it manually in your addon, while leaving events system in place.
  Reply With Quote
02/08/16, 04:23 PM   #4
XEVENEX
Join Date: Jan 2015
Posts: 6
Late thank you for the replies guys. I am using OnCombatEvent and ACTION_RESULT_STUNNED.

1) Is there a way to determine if you are currently CC immune? Is there a way to check for the swirly animation under your feet?

2) I'm looking for a way to tell if the reticleover currently has reflective scales or defensive stance up. Is there any way to pull the visual effects from your target? GetUnitBuffInfo('reticleover', x) isn't returning anything useful in this context.

Last edited by XEVENEX : 02/08/16 at 06:12 PM.
  Reply With Quote
02/08/16, 11:07 PM   #5
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by XEVENEX View Post
1) Is there a way to determine if you are currently CC immune? Is there a way to check for the swirly animation under your feet?
1)
I have no idea if all effect/buffs for immunities are displayed as buffs/effects, but I would start by trying something like this:
Warning: Spoiler


Originally Posted by XEVENEX View Post
2) I'm looking for a way to tell if the reticleover currently has reflective scales or defensive stance up. Is there any way to pull the visual effects from your target? GetUnitBuffInfo('reticleover', x) isn't returning anything useful in this context.
I've not tested it, but I would think GetUnitBuffInfo() should work. Almost the same code as above:
Warning: Spoiler


To find the abilityId for reflective scales put it on your action bar, place the mouse cursor over it and type /zgoo mouse in chat (zgoo addon must be installed). The abilityId will be listed as ["actionId"] = xxxxxx
Do note that each rank/morph has a different abilityId...so if you want it to work for all versions of reflective scales you'll have to find all of their abilityId's.

Here is an example of how to do that:
Warning: Spoiler


Then create a table with all of those abilityId's and use it as a lookup to see if any given abilityId represents one of the reflective scales ranks/morphs:
Warning: Spoiler

Last edited by circonian : 02/08/16 at 11:33 PM.
  Reply With Quote
02/09/16, 06:09 AM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,577
Originally Posted by circonian View Post
Do note that each rank/morph has a different abilityId...so if you want it to work for all versions of reflective scales you'll have to find all of their abilityId's.
You should also keep in mind that not every effect has the same abilityId as its skill.
Some skills that have multiple effects with different length simply apply multiple abilities to the target, so just looking for it in the action bar won't necessarily give you the correct id.
P.S. There are also cases where the API reports the wrong effect, but still applies the correct ability (e.g. Phase).
  Reply With Quote
02/09/16, 01:50 PM   #7
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by sirinsidiator View Post
You should also keep in mind that not every effect has the same abilityId as its skill.
Some skills that have multiple effects with different length simply apply multiple abilities to the target, so just looking for it in the action bar won't necessarily give you the correct id.
P.S. There are also cases where the API reports the wrong effect, but still applies the correct ability (e.g. Phase).
Good point, I didn't think about him maybe wanting to watch for a specific effect caused by the ability.
  Reply With Quote
02/10/16, 09:40 AM   #8
XEVENEX
Join Date: Jan 2015
Posts: 6
I will try looking at IDs later tonight.

I have tried iterating through the target buffs already, printing to chat effectName. It only ever gave me stuff like food, mundus, and vapirism. With that limited testing I assumed that the api would not tell you about active buffs like reflect.

I suppose some things have a null effectName and my test was missing all of those buffs?

Thanks again.

Last edited by XEVENEX : 02/10/16 at 09:45 AM.
  Reply With Quote
02/10/16, 08:43 PM   #9
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by XEVENEX View Post
I will try looking at IDs later tonight.

I have tried iterating through the target buffs already, printing to chat effectName. It only ever gave me stuff like food, mundus, and vapirism. With that limited testing I assumed that the api would not tell you about active buffs like reflect.

I suppose some things have a null effectName and my test was missing all of those buffs?

Thanks again.
I tested it and apparently GetUnitBuffInfo() will only work properly on "player". After that I looked around and found a post where someone said they changed it, it used to work on other unitTags.

You could still do it by monitoring the event (which would be better anyhow):
Lua Code:
  1. local function OnEffectChanged(eventCode, changeType, effectSlot, effectName, unitTag, beginTime, endTime, stackCount, iconName, buffType, effectType, abilityType, statusEffectType, unitName, unitId, abilityId)
  2.    ...
  3. end
  4. EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_EFFECT_CHANGED,    OnEffectChanged)
To see when anyone receives or looses the desired effect. If you only care about the target you have your reticle over, you can check to see if that is the unitTag
Lua Code:
  1. if not AreUnitsEqual(unitTag, "reticleover") then return end

Or you could just monitor for all targets that receive the desired effect and display them with their name so you can tell which target is which.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » CC Break & CC Immunity

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off