Equipping secondary weapon in addition to other weapons

Klin

Member
Hello,

I have an Item (weapon) in item Slot 0 in the character root. In Slot 0, I want to have multiple items later and toggle between them.
I want to have a secondary item (Body Weapon), which I want to put under the right foot into the newly created Slot 2.


So the first thing would be, how would I get both items to be enabled at the same time?



What I tried:

In the "Inventory Item Set Manager", under the first Category Item Set Rule, I have "Equippable" with Item Category Slot 0 "Equippable".
In the "Inventory" under Equippable, I have the first weapon under Item Amounts.
This works fine.

Now in the "Inventory Item Set Manager" under Category Item Set Rule, I added a second rule, "Body" (which inherits from Equippable). Here I put "Body" into Slot 2. For that I increased the "Slot Count" to 3 (So Slot 2 is visible).

When I hit play now, it works as it should, still only the first weapon gets spawned, in "Inventory Item Set Manager" is only one Item Set visible -> "Item Set 0 (Active)" with the weapon in Slot 0, and no error/warning messages.

Now I want the second weapon (Body, Slot 2) also to spawn at start and to be enabled concurrently, while I can switch between the slot 0 weapons (after I add more).

I add the Body weapon (Slot 2) in "Inventory" -> "Item Amounts" under the first item.

1635962423793.png


When I hit play now, there are 3 Item Sets appearing in "Inventory Item Set Manager". This is how it looks like during playmode:

1635961712257.png

And I get this error message:
1635961831853.png

The second Item (Body, Slot2) appears under the main-Items component in the character hierarchy, but not under the Items Slot.

Thanks a lot for helping out!
 
Using two Category Item Set Rules allows you to equip different ItemSets in paralel. So if you have many different Item Sets you wish to combine with body foot (you wrote "food" I suppose that's a typo) you'll be able to have the body foot always equipped.

Now the issue you have is that the body Item is being set in two Item Sets. One in the Equippable and another in the Body category.
My guess is that the Equippable Item Set Rule use the "Equippable" category for slot 0.
Since Body inherits from the Equippable category an Item Set is created.
You should replace the Equippable category in slot 0 and set a category that is more precise (i.e Main Weapon).

That will ensure only the Hammer gets an Item Set in the Equippable category Item Set. while the body Item Set will be part of the Body category Item Set.

Apart from that you want to make sure that your Body Item prefab has slot ID set to 2

You can read the integration documentation again, the part about setting up the Item Set Rules. It might make more sense once you read it now that you've tried setting it up.

I hope that helps
 
I tried to use more specific Category Item Set Rules.

I get the following error messages (only trying to spawn the first weapon):
1636016262150.png

The first error is pointing to ItemSet.cs line 179
C#:
// If the item set is not active and it is enabled then the item set should be enabled if it can be.
                var targetItemSetIndex = m_EquipUnequip.IsActive ? m_EquipUnequip.ActiveItemSetIndex : m_ItemSetManager.ActiveItemSetIndex[m_CategoryIndex];
                if (targetItemSetIndex == -1) {
                    m_EquipUnequip.StartEquipUnequip(m_Index);

which I think means, that the Equip Unequip ability does not have the correct ItemSet Category defined.

In the integration demo, in the Equip Unequip -> ItemSetCategory dropdown, there are all 4 categories listed.
In my project, only "Equippable" is visible in the dropdown.

I tried to recompile / restart the editor but the categories are not recognized.

1636016534241.png
1636016565121.png
 
The Equip Unequip ability might be it. You say that only Equippable appears in the drop down? All the ItemCategories used as Category Item Set Rule categories should be in the drop down
1636017279762.png
As you can see it matches the categories in the screenshot below. Make sure you don't have any errors/warinings in your console at edit time.

Btw when I said you should change Equippable by something more specific I meant on the ItemSetRule, not the CategoryItemSetRule.
Like this
1636016878152.png

I think you might be confusing the ItemSlotSet with the ItemSets.

The ItemSlotSet is used to define what items can be set in an ItemSlotCollection (within the UIS context)
The ItemSets are the items can can be Equipped (within the UCC context)

The Item Set Rules takes all the items that are within Equippable Item Collections (the list of Equippable Item Collection is defined on the Character Inventory Bridge component by a list of item colleciton names)

Every time an item is added or removed from any Equippable Item Collection the bridge component recomputes the ItemSets using the Items that are currently int the Equippable Item Collections.
For example you can check the demo scene, you'll see that we have an Item Collection for the weapon slots and another just for the body, because the body is not in a slot, it is always equipped.

I hope that clarifies some things.
 
Top