Active item set based off of equipment slots

Grandexed

New member
Hello,

I'm trying to create left/right hand equipment slots that behave similarly to games like Elden Ring where you can use the left and right d-pad buttons to change items in your right or left hand.

In the screenshot below, I have 2 item slots for the left hand and 2 item slots for the right hand (labeled R1, R2, L1, and L2). Currently, the shield in L1 and the knife in R1 are active.

Lets say I have 2 new item abilities called "Equip next right hand item" and "Equip next left hand item".

In this situation, if the user activates the "Equip next right hand item" item ability, then the shield would remain active but the knife would become soft equipped and the sword in R2 would become active.

If the user activates the "Equip next left hand item" item ability, then the item set would change so that the shield is no longer active but the knife still is.

unitypic2.png

Here is the list of item sets, everything is working as expected and I can get to each item set by using the "Equip Unequip" item ability. The problem is that I need to be able to specify which item set will be active based on which left/right item slots are currently active.

So from the example above, if L1 and R1 item slots are active, and the user activates the "Equip next right hand item" item ability, then the active slots should change to L1 and R2 which would also select a specific item set that is mapped for those two slots (in this example it would change to item set 5).
unitypic3.png

Is there built in functionality that supports this or would this require custom components/scripts?
I'm still fairly new to unity so any advice would be greatly appreciated!

Thank you.
 
I see, at the top of my head I don't think we have something built-in that would allow to switch between the two.
In version 2 you would have used the ItemSet index, but since V3 the item sets are dynamic so the index of the itemset you want to equip might be change.

In those cases I usually write a custom script. The steps are

1. Get the item inside the Inventory equipment slot (all on the inventory system side).
2. From the inventory item get the itemsets it is assigned to
3. Equip the item set.

You should be able to do all of this using functions on the InventoryBridge component.
If you are stuck let me know, I'll try to point you in the right direction :)
 
Hi Sangemdoko,

Thank you for the advice! I was able to get this working but I do have a question.

To figure out which itemSlot is active, I am using the IsItemActive() method in the CharacterInventoryBridge component by passing the items stored in the ItemSlotCollectionView component.

Ex:
  • bool isActive = m_CharacterInventoryBridge.IsItemActive(m_ItemSlotCollectionView.ItemSlotItemViewSlots.ItemInfo.Item);


It's using the main menu's UI to determine if which item slots are active. This works, but there is a short period while switching items where nothing is active. If the user tries to switch items again during this short period, the incorrect itemset gets set.

Is there a better way to figure out which item slot an active item is in? Or is there a way for me to prevent the item ability (custom ability that I made for this behavior) from triggering until the EquipUnequip item ability is complete?
 
Last edited:
Preventing your custom ability while EquipUnequip ability is active is one way to go.
or
should be a good start to learn how.

I believe you can set abilities to be blocked by others in the inspector too. The order of the abiities in the list matter when that's the case
 
Back
Top