Thread Tools Display Modes
02/03/24, 07:10 AM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
Question 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.

Last edited by sinnereso : 02/03/24 at 07:23 AM.
  Reply With Quote
02/03/24, 11:08 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,961
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).
  Reply With Quote
02/03/24, 11:34 AM   #3
Mouton
 
Mouton's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2018
Posts: 9
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
)

Last edited by Mouton : 02/03/24 at 11:38 AM.
  Reply With Quote

ESOUI » AddOns » Released AddOns » detect if ability in use that would block collectible use?

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