Item Sets represent a set of Item Types that can be equipped at the same time. The Item Set Manager is the component responsible for switching which Item Sets are active. When a new item is added to the character an Item Set will automatically be created with that Item Type if it isn’t already created. More than one Item Sets can be active at the same type through the Categories defined within the Item Collection.

Scenarios

Single Category Setup

In this scenario the character will always have a max of one item equipped at a time. While this is the most basic setup of the Item Set Manager it will also be the most common. In a lot of the cases each item will occupy the same slot (such as the right hand slot) but this is not a restriction.

When the game starts the Item Set 0 will first be equipped (assuming the slot is valid – in this scenario the slot will be valid if the character has the pistol). When the Equip Next ability is activated the Item Set at index 1 will be activated, which contains the assault rifle. Since the Item Set 1 specifies the assault rifle for slot 0 the pistol will be unequipped. The sword will then be activated after the assault rifle. If the Equip Next is triggered again after Item Set 2 the Item Set Manager will then skip back to the beginning, Item Set 0. This is because Item Set 3 has the Can Switch To field deselected:

The Can Switch To field indicates whether or not the abilities can switch to the specified Item Set. If the abilities cannot switch to the Item Set then the only way for the Item Set to be activated is it is the Default Item Set or if a state activates it via the Disabled Index. In this scenario the Item Set 3 is the Default Item Set so when the Toggle Equip ability is activated then the Item Set 3 will be activated. By setting up the Item Set this way it prevents the character from switching to the body Item Set unless no item should be equipped. When the body Item Set is the default Item Set it will allow the character to punch and kick when no item is equipped.

The Item Set doesn’t have to contain an Item Type – if both Slot 0 and 1 had no Item Types set then when the Item Set is activated the character wouldn’t be able to punch or kick.

Dual Wield Single Category Setup

This scenario will extend upon the previous scenario by allowing the character to dual wield two pistols and a sword with a shield. No new categories need to be added as the dual wield items can only be equipped with a single Item Type. In this scenario the Weapons category looks like:

When the game starts it will first try to activate Item Set 0. If the character does not have 2 pistols then Item Set 0 will not be able to be activated and the next slot will be tested. Assuming the character does have 2 pistols in the inventory then Item Set 0 will activate. Slot 0 corresponds to the right hand and slot 1 corresponds to the left hand. This will allow two pistols to be equipped at the same time (assuming the pistols are setup to work together).

When the next Item Set is activated it will activate the Item Set 1 which only contains the assault rifle in the right hand. There is no Item Type specified for slot 1 so the left pistol will be unequipped. The next Item Set only contains the sword which will unequip the assault rifle. Item Set 3 contains a sword and shield combo. Slot 1 will equip the shield and because slot 0 contains the same Item Type as what was in Item Set 2 the slot will not change.

Double Category Setup

The goal of this scenario is to have a primary weapon but also allow a grenade to be thrown at any time. One way to do this would be to have the grenade act as a dual wield item similar to the last scenario, but in this case we don’t want the Item Set to be dependent on the number of grenades the character has so a second category should be created. The Weapons category within the Item Set Manager should look the same as it did within the Single Category scenario, and the following category and Item Set should be added:

This new category has the frag grenade being equipped within slot 1, the left hand. If you take a look at the Single Category scenario you’ll see that no Item Types occupy slot 1 within the Weapons category so there are no conflicts. If the character has a grenade the Item Set 0 will be activated and they can throw the grenade with the left hand at any time.

When the body Item Set from the Weapons category is activated we don’t want the character to be able to throw a grenade. We can prevent this from happening by first setting a state name when the body Item Set is activated:

When the Body state is activated the Item Set 0 from the Grenades category should disable itself by setting the Enabled property to false within the state system.

With this setup the Body state will be activated when the body Item Set is activated within the Weapons category and the state will disable the Enabled property within the Item Set. When the Item Set is disabled it will switch to the Item Set 1 because that Item Set isĀ Enabled when the Body state is active:

Notice that the Disabled Index is set to 0 which means that when the Item Set is deactivated (the Body state is deactivated) the Item Set will disable and switch to the index specified, which is Item Set 0.

Triple Category Setup

The Ultimate Character Controller uses a triple category setup. This setup allows the grenade to be equipped as a primary item with the right hand or thrown from either hand as a secondary item. In most cases the grenade will be thrown from the left hand as a secondary item (such as when the character has an assault rifle or sword equipped) but the bow occupies the left hand so the grenade needs to be able to be thrown from the right hand as well.

To get started ensure the Left Hand Secondary Grenades and Right Hand Secondary Grenades categories are created and then add a Primary Frag Grenade Item Type to the Weapons Item Set. To demonstrate the secondary grenade switching slots the Bow Item Type has also been added to the Weapons category:

The Secondary Frag Grenade Item Type should be added to the Left Hand Secondary Grenades Category along with an empty Item Set:

Finally the Primary Frag Grenade Item Type should be added to the Right Hand Secondary Grenades Category along with an empty Item Set:

 

The basic setup is now complete and the Item Types need to be setup, similar to how the Item Types were setup in the Double Category scenario. In order for the Left and Right Hand categories to know that they need to do something different from the default the primary frag grenade Item Type (at index 3) should activate the PrimaryFragGrenade state. Similarly, the bow Item Type (at Item Set 4) should activate the Bow state.

Looking at the Left Hand Secondary Grenades category first, by default the Item Set 0 should be enabled since this Item Set will be activated most of the time. When the PrimaryFragGrenade or Bow (or Body) state is activated this Item Set should deactivate so Item Set 1 can activate. This will prevent the Secondary Frag Grenade from being equipped in slot 1 when another item is activated in slot 1:

Item Set 1 starts off disabled and will be enabled when the PrimaryFragGrenade, Bow, or Body states are active. When the state is disabled again (meaning none of those states are active) then the category will switch to the Disabled Index which is Item Set 0. This is how Item Set 0 reactivates again.

The Right Hand Secondary Grenades Category is almost the reverse of the Left Hand Secondary Grenades Category. Item Set 0, which contains the Primary Frag Grenade Item Type, should only be activated when the bow is activated. This allows the grenade to still be thrown when the bow is equipped even though the bow occupies slot 1. The Item Set still disables itself when the Body state is activated because no Item Sets should be enabled at that time.

Item Set 1 of the Right Hand Secondary Grenades Category is similar to Item Set 1 of the Left Hand Secondary Grenades Category except it doesn’t contain as many states because this Item Set is only activated when the bow is equipped.

Sword and Shield Category Setup

You may be working on an RPG which has hundreds of swords or shields and they can all be dual wielded together. Having a single category with every possible combination would not be feasible. For this case you can create two categories: Left Hand Items and Right Hand Items. All of the swords can be equipped in the right hand (slot 0) and all of the shields can be equipped in the left hand (slot 1). With this setup any shield can be equipped with any sword. Here’s an outline of what the Right Hand Item Category would look like:

The Left Hand Category would then contain all of the shields:

Inspected Fields

State

The state name that should be enabled when the ItemSet is active. This is extremely useful in the case where you want to enable or disable certain properties when a particular item is equipped.

Slot n

The ItemType for the specified slot index. These slots match up to the same slots that are specified by the ItemSlot component.

Default

Is the ItemSet the default ItemSet? Default ItemSets will be activated when the Toggle Equip ability is activated or a particular ItemSet has been disabled. Only one Default ItemSet is valid per category.

Enabled

Is the ItemSet enabled? A disabled ItemSet cannot be activated through the EquipUnequip ability.

Can Switch To

Can the ItemSet be switched to by the EquipNext/EquipPrevious abilities?

Disabled Index

Specifies the ItemSet index that should be activated if the current ItemSet is disabled while being active.