CharacterQuantityDropItemAction "Deleting" Amount of Items on Drop from Character Inventory

mdonatelli

New member
Hi folks,

I've been following the UIS and UCC Integration tutorials, and I've hit a bit of a roadblock. It's quite possible it's user error, so maybe someone can point me in the right direction.

Screenshot 2021-06-22 213505.png

I'm using CharacterQuantityDropItemAction to drop items from my Character's inventory into an InventoryItemPickup.

However, when I pick a quantity to drop in-game, say 3 of 5, it drops 3 and destroys the other 2 in the character's inventory.

Ideally, the 2 would remain in the character's inventory. I don't really know where to start troubleshooting this. I think it might have to do with the settings on the Inventory Item Pickup prefab, but I'm really not sure. These fields are not well documented.

Screenshot 2021-06-22 213739.png

It also might not be these. It might have something to do with the item definitions?

1624423142842.png

Any help or guidance is appreciated. Thanks!

-Matt
 
I was able to reproduce this issue. I have no idea how no one found this issue until now, including me.
I think it just requires a more complex setup to replicate.

Thankfully it's a bug that's very easy to fix.

In the "BridgeDropProcessing" script there is a function called "RemoveOnDrop".
On line 94 I forgot to set the amount to the amount specified, so it removes everything instead of just 3. This only happens for items that are not stored in the default collection.

So here is the new function that works:

Code:
/// <summary>
/// Remove the item when dropping the item.
/// </summary>
/// <param name="itemInfo">The item info dropped.</param>
private void RemoveOnDrop(ItemInfo itemInfo)
{
    if (EquippableItemCollections.Contains(itemInfo.ItemCollection)) {
        BridgeEquippableProcessing.AboutToDrop(itemInfo);
        EquippableItemCollections.RemoveItem(itemInfo);
    } else if (itemInfo.ItemCollection == DefaultItemCollection) {
        DefaultItemCollection.RemoveItem(itemInfo);
    } else {
        var result = m_InventoryBridge.Inventory.GetItemInfo(itemInfo.Item);
        if (result.HasValue) {
            BridgeEquippableProcessing.AboutToDrop(itemInfo);
            itemInfo = (itemInfo.Amount, result.Value);
            itemInfo.ItemCollection.RemoveItem(itemInfo);
        }
    }
}
 
Top