ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   CC Break & CC Immunity (https://www.esoui.com/forums/showthread.php?t=4219)

XEVENEX 01/22/15 04:52 PM

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.

circonian 01/22/15 11:35 PM

Quote:

Originally Posted by XEVENEX (Post 18351)
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.

SpellBuilder 01/23/15 12:00 PM

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.

XEVENEX 02/08/16 04:23 PM

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.

circonian 02/08/16 11:07 PM

Quote:

Originally Posted by XEVENEX (Post 25928)
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


Quote:

Originally Posted by XEVENEX (Post 25928)
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

sirinsidiator 02/09/16 06:09 AM

Quote:

Originally Posted by circonian (Post 25930)
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).

circonian 02/09/16 01:50 PM

Quote:

Originally Posted by sirinsidiator (Post 25933)
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.

XEVENEX 02/10/16 09:40 AM

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.

circonian 02/10/16 08:43 PM

Quote:

Originally Posted by XEVENEX (Post 25941)
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.


All times are GMT -6. The time now is 04:36 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI