Go to Page... |
|
Thread Tools | Display Modes |
|
06/13/24, 01:20 PM | #1 | |
Join Date: Jun 2024
Posts: 2
|
At my wits end. UseCollectible doesn't work for just one character
Hello all. An add-on that I used all the time (Armory Style Manager) has broken after the Gold Road update, so I went in to simplify and fix it. I am completely baffled though because the code works fine except for one of my characters (I have 8). When the add-on was working, it worked for all of my characters and honestly I did not change much in this specific area.
For some reason the call to Code:
UseCollectible(id, GAMEPLAY_ACTOR_CATEGORY_PLAYER) For example, I will set a specific mount and personality for one Armory Build. The code fires after the event EVENT_ARMORY_BUILD_RESTORE_RESPONSE and iterates over the currently equipped items and attempts to replace the current items with the ones saved in my SavedVariables. I've triple checked the SavedVariables and they are fine. The code that saves the items works perfectly even for the character that is failing, it's only when I call UseCollectible() that I get the error for this one character. At this point, I have no idea what else to do here. Perhaps there is just something borked with this one character? Did Gold Road change how this works in some way? I cannot understand why the same code works for the others but not for this one. I'd appreciate any insight or suggestions. Thanks Relevant Code: Lua Code:
|
|
06/14/24, 06:59 AM | #2 |
As you call that in a for loop it might be a timing issue where collectibles cannot be used "directly after another".
Same like if you click some collectibles in your collections list and have to wait 9/45s afterwards. Are you use the error happens at that line 14 and not at line 21 (because your 1 char already wears another collectible)? You should add the same "IsCollectible* checks at that line 21 then and see if that helps, add some d() debug messages to see what hapepns when with that 1 character. Lua Code:
Last edited by Baertram : 06/14/24 at 07:03 AM. |
|
06/14/24, 09:48 AM | #3 | |
Join Date: Jun 2024
Posts: 2
|
Thanks for the reply, I appreciate it. I agree with your assessment that it is a timing issue and that perhaps I am trying to assign too many collectibles in too short of a time frame.
The error "COLLECTIBLE IS NOT READY YET" was actually happening on line 21 (I used debug statements to verify that), so you're correct in that was the problem. I modified that section of the code to add a delayed callback and it seems to have fixed the issue! I guess I overlooked the fact that the one character did have a lot of collectible switching between Armory builds whereas the others were more simple. This is what I added: Lua Code:
It results in a slight delay where the costume will be applied very shortly after you exit the Armory UI, but it does work. Thanks again for pointing me in the right direction! Last edited by RicAlmighty : 06/14/24 at 09:50 AM. |
|
06/14/24, 10:40 AM | #4 |
Maybe there is even a better way using EVENT_MANAGER:RegisterForUpdate (which basically is the same as zo_callLater but you can reuse it with multiple calls, e.g. every 500ms).
Within the callback function you check ech time it is called with functions like if IsCollectibleUnlocked(id) and IsCollectibleUsable(id, GAMEPLAY_ACTOR_CATEGORY_PLAYER) and IsCollectibleValidForPlayer(id) and maybe others that provide a return value like "Currently blocked because of reason BLOCK_REASON_ONE (I think there is such an API function like IsCollectibleBlocked which might return any blocked reasons or at least a true then) if the item is still blocked. If not: Unregister that update and equip the collectible then: Lua Code:
I'm assuiming you only equip 1 collectible during that loop. Else you'd have to create multiple of these EVENT_MANAGER:RegisterForUpdate with different unique names, one for each item slot to equip. |
|
06/17/24, 03:22 AM | #5 |
|
You can also call later using the collectible's cooldown time
I do that in one of my addons Lua Code:
Can even add a few MS for safety. Last edited by IsJustaGhost : 06/17/24 at 03:27 AM. |
08/29/24, 03:33 PM | #6 |
|
I've been trying to achieve the same thing recently.
I got it working for U43 a week ago, and have since added support for the new types of collectibles added to the game (random mounts / customized actions / skill styles). You can find my updated version here, just replace the old one with this one and your existing builds should work again. I ended up using an EVENT_MANAGER:RegisterForUpdate() to fix the "not ready yet" issue. It's set to 1 second, which seems to work well without being too noticeable. Last edited by loosej : 08/29/24 at 03:39 PM. |
08/30/24, 07:36 PM | #7 |
|
Lua Code:
|
ESOUI » AddOns » AddOn Help/Support » At my wits end. UseCollectible doesn't work for just one character |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|