Unable to find ItemSet after unequip

jimi

Member
Hi there,

I'm running into an issue with equipping items that were unequipped during an itemAction.

I was unequipping them like this:
C#:
var item = UCCBridge.GetActiveItem(0);
if (item != null) UCCBridge.UnequipItem(0);

However it seems like something changed with last update because now I'm getting this error whenever I try to requip any item after it has been equipped this way.
Error: Unable to find the ItemSet for item

I've attached a screenshot of the full error stack along with the item showing up in the Inventory & Bride component.
1616033861960.png

Once this happens, the game is no longer playable. The inventory system will not equip any item, whether this one or a new one.

One work around that kinda works but not really is to fake the unequip with this event:
C#:
var item = UCCBridge.GetActiveItem(0);
EventHandler.ExecuteEvent(itemUser.gameObject, "OnAbilityUnequipItemComplete", item, 0);
The item remains visible but not useable during the item action so then you can manually unequip then reequip in the game UI but this is really awkward and not shippable.


How can I unequip the current item safety from a different item's itemAction?
 
Have you tried using the CharacterEquipUnequipItemAction?

Internally it calls this event:
Code:
EventHandler.ExecuteEvent<ItemInfo, bool>(itemInfo.Inventory.gameObject, IntegrationEventNames.c_GameObject_OnItemActionEquipUnequip_ItemInfo_Bool, itemInfo, m_Equip);

Perhaps you could try using that event to unequip the item instead of
bridge.Unequip(0)


Note that I am currently in the process of re-writing the integration between UCC and UIS from scratch. I started around 3 weeks ago and I still have a long way to go, but it's already much easier to use and stable than the current public version is. It's still missing a few features though compared to the current version, and I plan to add new features once I am done implementing those. I'm taking my time with this update to make sure it is stable, easy to use and easy to refactor.

Once it is ready I'll make sure to update the documentation explaining things in detail and have code examples including on how to equip/unequip things correctly. I'm also planning to make some new video tutorials.

I hope that will help and that the wait will be worth it.
 
Oh interesting ok. Let me know if you need help/feedback.

Yes thanks. I was trying to use the CharacterEquipUnequipItemAction but was having trouble figuring out how to get the itemInfo from a UCC item. After a good night's rest this is my solution:

Code:
        protected override void InvokeActionInternal(ItemInfo itemInfo, ItemUser itemUser)
        {
            var UCCBridge = itemUser.gameObject.GetComponent<UltimateInventorySystemBridge>();
            var item = UCCBridge.GetActiveItem(0);

            if (item != null)
            {
                var itemIdentifier = item.ItemIdentifier as Opsive.UltimateInventorySystem.Core.Item;
                ItemCollection itemCollection = itemInfo.Inventory.GetItemCollection(ItemCollectionPurpose.Equipped);
                var EquippeditemInfo = (ItemInfo)itemCollection.GetItemInfo(itemIdentifier.ItemDefinition);
                EventHandler.ExecuteEvent<ItemInfo, bool>(itemInfo.Inventory.gameObject, IntegrationEventNames.c_GameObject_OnItemActionEquipUnequip_ItemInfo_Bool, EquippeditemInfo, false);
            }
            InventorySystemManager.GetDisplayPanelManager(1).CloseMainMenu();
            EventHandler.ExecuteEvent<ItemInfo>(itemInfo.Inventory.gameObject, "OnItemActionPlace", itemInfo);


        }

I like your class with event string names btw, very CLASSY
 
Top