ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Issue with Equip Outfit? Only equipping the first slot. (https://www.esoui.com/forums/showthread.php?t=9891)

Leonardo1123 08/25/21 01:59 PM

Issue with Equip Outfit? Only equipping the first slot.
 
Here's my code, and the following is the chat output when entering combat.

My other outfits are identical to "No Outfit" except for the dye channels, could it possibly be that they're technically null as a "style?"

Edit: I was able to rule that out as the reason.
Edit: So for more specifics, EquipOutfit() is behaving the same as EquipOutfit(-1) the same as ..(1) same as ..(2).

Thanks for any and all help! First addon. :D

Code:
Lua Code:
  1. function LeonardosWardrobeManager.OnPlayerCombatState(event, inCombat)
  2.     -- The ~= operator is "not equal to" in Lua.
  3.     if inCombat ~= LeonardosWardrobeManager.inCombat then
  4.         -- The player's state has changed. Update the stored state...
  5.         LeonardosWardrobeManager.inCombat = inCombat
  6.  
  7.         -- ...and then announce the change.
  8.         if inCombat then
  9.             d("Entering combat.")
  10.             EquipOutfit(3)
  11.             d("Equipped Outfit: " .. GetOutfitName(3))
  12.             d("Outfit Index: " .. GetEquippedOutfitIndex())
  13.         else
  14.             d("Exiting combat.")
  15.             UnequipOutfit()
  16.         end
  17.  
  18.     end
  19. end

Output:
Code:

[2:57PM] Entering combat.
[2:57PM] Equipped Outfit: Paladin // outfit 3 is "not" named paladin
[2:57PM] Outfit Index: 1

Outfits:

Baertram 08/26/21 04:26 AM

You should use the outfit manager to equip the outfit.

Outfit_Manager:EquipOutfit(actorCategory, outfitIndex)
As Outfit_Manager is the class you need to use the object for it:
ZO_OUTFIT_MANAGER

So ZO_OUTFIT_MANAGER:Outfit_Manager:EquipOutfit(actorCategory, outfitIndex)
See file esoui/ingame/outfits/outfit_manager.lua


The function EquipOutfit needs the same 2 parameters btw, not only an index! 1st param is actorCategory
EquipOutfit(actorCategory, outfitIndex)

Every function where a companion could be involved needs this actorCategory now!

actorCategory is of this type:
GAMEPLAY_ACTOR_CATEGORY_COMPANION = 1
GAMEPLAY_ACTOR_CATEGORY_PLAYER = 0


Edit:
You need to check the API documentation of the MOST CURRENT ApiVersion (see here for the live server, or use the PTS version for the PTS
https://wiki.esoui.com/APIVersion#live_API_version
and then check the linked ApiDocumentation .txt file) and not anything you find which maybe outdated of older APIversions!
The ESOUI Wiki is not updated in total. Always check at the top of the main page (functions, events, constants, etc.) which APIversion it was updated with last and compare it to the current live version.

Leonardo1123 08/26/21 11:36 AM

Thank you very very much! :D


All times are GMT -6. The time now is 06:19 AM.

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