Create Item from ItemSetManager inside a script?

Acer

New member
Hi,

I want to create an Item from the ItemSetManager but how? should I use the ItemSetManager.AddItemSet(.....) ?
I think I need to create an Item and one ItemSet object somehow.
Is there an easy way to create them? maybe there is a method to get the information from the Item Collection somehow or maybe from the Inventory?
And also how do I remove Items?

I use my own inventory system so I just want to control the item the player can use.
 
The base inventory class is responsible for this instead of the Item Set Manager. The Item Set Manager is responsible for determining which item is equipped. I recommend familiarizing yourself with the Inventory class first.

Even if you don't have the Ultimate Inventory System I recommend taking a look at that integration to see how we overrode the base classes in order to add integration.
 
The base inventory class is responsible for this instead of the Item Set Manager. The Item Set Manager is responsible for determining which item is equipped. I recommend familiarizing yourself with the Inventory class first.

Even if you don't have the Ultimate Inventory System I recommend taking a look at that integration to see how we overrode the base classes in order to add integration.
Thanks for the answer but I have some follow up questions and clarification.

So my Idea is more to create a default inventory loadout in Opsive that have all the weapons and bullets but let my own inventory deside what you can equip because my inventory is quite diffrent.
So lets say from the start my charater have no weapons in the inventory(my own created inventory) and then he picks up two weapons (my own pickup system) so no changes will be done to Opsive inventory(the Opsive inventory still have all the weapons/bullets).
Now I want to control what items are equiped if the user do a Scroll Mouse och press any keyboard number and lets say the player have put one weapon on the fifth slot and the other on second slot.
Should not the ItemSetManager only have two items now? one in "Item Set 2" and the other in "Item Set 5" or maybe its set like "Item Set 1" and "Item Set 2". Or maybe the items are just mirrored from the Opsive inventory.

Seems like the variable m_CategoryIndexMap (its a Dictionary of <IItemCategoryIdentifier, int>) in ItemSetManager controls the items?
Perhaps its on that variable I should add and remove items? Or maybe I should not remove/add items there and just direct the users Mouse Scroll and keyborad number input to the correct Item in the ItemSetManager?


[Update]
I think I have figured out a way to solve it.

1. Add all items to the Default Loadout and then it adds them to the Current Inventory.
2. Then in the EquipUnequip.CanStartAbility() I do my own check to determine what item should be active in the ItemSetManager with the m_ActiveItemSetIndex variable.

I guess this work but is it a correct way to do it?
And I guess that the ItemSetManager can have more then 10 items? and that the "Item Set" have nothing to do with the player number keybord input reverence.
 
Last edited:
For this situation you will need to override both InventoryBase and ItemSetManagerBase. This will give you an abstract inventory implementation. There is a lot to this though so I would start with reading the comments and implementing each abstract method. You should also just output when the method is called by each ability so you can understand the flow.

Your idea does sound like it would work, but for the fullest integration you shouldn't need to change the actual ability and instead implement the two base classes. That is going to be a lot of work though so if you have something that's working then I'd continue with that until you hit a restriction.
 
Top