Unequip current item?

jimi

Member
Hi there,

Is there a way to get the current equipped item in order to unequip it during an ItemAction of a different Item?

Looking to unequip all before executing a method.

I tried equipping the body ItemDefinition by referencing it via an attribute but that doesn't quite work either.
C#:
  protected override void InvokeActionInternal(ItemInfo itemInfo, ItemUser itemUser)
        {
            var HandsDeff = itemInfo.Item.GetAttribute<Attribute<ItemDefinition>>("Body").GetValue();
            var HandsItemInfo = itemInfo.Inventory.GetItemInfo(HandsDeff as ItemDefinition);
            InventorySystemManager.GetDisplayPanelManager(1).CloseMainMenu();
            EventHandler.ExecuteEvent(itemUser.gameObject, "OnEnableGameplayInput", false);
            EventHandler.ExecuteEvent<ItemInfo, bool>(itemInfo.Inventory.gameObject, "OnItemActionEquipUnequip", (ItemInfo)HandsItemInfo, true);
            EventHandler.ExecuteEvent<ItemInfo>(itemInfo.Inventory.gameObject, "OnItemActionPlace", itemInfo);

        }
Thanks
 
I recently updated the UCC/UIS integration documentation with some code examples:

It shows how to get the equipped items in a UCC or a UIS way.
It also shows how to get the UIS Item from the UCC Item and vice versa.
 
Very nice, thank you. Updated doc is great, that conversion function is useful.

For others searching, if you do not need the Item for other reasons, this quick unequip method seems to work for me:
Code:
var UCCBridge = itemUser.gameObject.GetComponent<UltimateInventorySystemBridge>();
if (UCCBridge.GetActiveItem(0) != null) UCCBridge.UnequipItem(0);
 
Top