ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Released AddOns (https://www.esoui.com/forums/forumdisplay.php?f=170)
-   -   detect if ability in use that would block collectible use? (https://www.esoui.com/forums/showthread.php?t=10808)

sinnereso 02/03/24 07:10 AM

detect if ability in use that would block collectible use?
 
Hi I'm looking for a way to detect and prevent collectible use if there is an ability or skill in use or being channeled that would prevent it. Looking for ideas as I cant seem to find any relevant api functions yet.

Baertram 02/03/24 11:08 AM

As described in my other thread:
I'd check what error message is shown as that happens and search that string in the ingamelocalization.lua (or any other esoui source lua files) -> SI_WHATEVER.....
Maybe that way you can find the functions used by ZOs.

If that is not ZOs code it will be handled by the c functions, not lua, and you only see the error message if you try to do that -> and server says "blocked". I doubt you got a way to detect it then by API unless you have any EVENT_* thrown by the game?
Did you use zgoo and/pr merTorchbug's event tracker to see what events fire as that happens and if tehy provide you and parameters at their callback functions that could tell you (e.g. actionBlockedType or similar).

Mouton 02/03/24 11:34 AM

There's no way I found so far to check this prior the activation. You can still use

Code:

EVENT_COLLECTIBLE_USE_RESULT (number eventCode, CollectibleUsageBlockReason result, boolean isAttemptingActivation)
To try to get why the use failed (UseCollectible function does not return anything if I remember) https://esoapi.uesp.net/current/data...lectible.html=

You can still check for the main cases before activation:

Code:

if not (IsMounted() or IsUnitReincarnating("player") or IsUnitSwimming("player") or IsUnitDead("player") or GetUnitStealthState("player") ~= STEALTH_STATE_NONE) then
  -- Do things
end

But I could not find a proper way to check this before.

(On top, collectible activation is not consistent from where it's used, making it hard to track on some other way if you want prevent it, but you wan still override the global function that is used, sometimes:

Code:

local Prev_ZO_CollectibleData_Use = UseCollectible

function UseCollectible(collectibleId, actorCategory)
    -- Do or check something
    Prev_ZO_CollectibleData_Use(collectibleId, actorCategory)
end

)


All times are GMT -6. The time now is 08:14 AM.

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