ItemSlotCollections Usage

polonel

Member
Is ItemSlotCollections used for anything other than UCC integration?

I've set up an ItemSet to house different "Ship Components", about 9 of them. My thought was this would be ideal to have a ship component occupy a Slot in the ItemSet and then I could have an ItemSlotCollection that would easily allow swamping these ship components in and out. I then could identify what item was in which slot.

I guess I was wrong. After much trial and error, it seems ItemSlotCollection is just another collection as all the rest an only used for UCC integration. I don't see a straightforward way to assign an Item to the ItemSet slot.

Does the index of the item in the collection match the slot index, or does it find the first matching item with the selected category and say that item is in the slot? (Specifically when using m_ItemSlotCollection.GetItemInfoAtSlot("ShipArmor") )

I'm confused about the purpose and function of the ItemSlotCollection outside UCC integration. Could you possibly explain its use in more detail?
 
Last edited:
No the ItemSlotCollection is not specific to UCC at all. We use it in the UIS demo for equipping items to the character.

The way ItemSlotCollection works is by using the ItemSlotSet to know where items can be added and if they fit (restricted by item categories and size).

Code:
var equipmentItemCollection = m_Inventory.GetItemCollection(m_EquipmentItemCollectionID) as ItemSlotCollection;

//Use the slot Index
var itemAdded = equipmentItemCollection.AddItem(itemInfo, slotIndex);
var itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotIndex);
var itemRemoved = equipmentItemCollection.RemoveItem(slotIndex, amountToRemove);

//Or use the slot name
itemAdded = equipmentItemCollection.AddItem(itemInfo, slotName);
itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotName);
itemRemoved = equipmentItemCollection.RemoveItem(slotName, amountToRemove);

If you do not specify the slot you want to add/remove/get then the collection will choose for you.
Also the collection index might not match the slot index. Collections aren't ordered so:
Code:
var item = equipmentItemCollection.GetAllItemStacks()[0];
//Might not be equal to
var otherItem = equipmentItemCollection.GetItemInfoAtSlot(0);

I hope that help clear up some of your questions.

If it turns out ItemSlotCollection does not suit your needs you may also choose to create your own custom collection
 
Top