How to make a limit to the weapons carried

Hi, I'm now looking for a way to limit the number of weapons the player can carry at a time, like how some FPSs will only let you carry 2 weapons, then if you want to pickup another one, you have to swap your current weapon for it. I'd still want them to be able to carry other items, so if I could limit the weapons with my "Two Hand Shootable" Category Item Set Rule that would be good. I looked in the documentation and discussions for how to do this and didn't see anything.

I was thinking maybe I could make it so the Pickup ability will drop your current weapon instead of just unequipping it when you already have 2 weapons that might work, but I can't find how to identify how many weapons are currently in my inventory with the specific item set rule. Can you help point me in the right direction for this?
 
This isn't supported within the base Ultimate Character Controller. It is supported with the Ultimate Inventory System integration, or you will need to subclass the Inventory component in order to add support for it.
 
I downloaded and imported the ultimate inventory system package from the opsive site and it gave me a ton of errors. Most of them CS0234 errors that say something like:

Assets\Opsive\UltimateCharacterController\Integrations\UltimateInventorySystem\Scripts\AmmoData.cs(10,18): error CS0234: The type or namespace name 'UltimateInventorySystem' does not exist in the namespace 'Opsive' (are you missing an assembly reference?)

The other assets are all up to date. The Opsive Ultimate Character Controller is 3.2.2, Opsive Shared is 2.0.3, and UFPS: Ultimate FPS is 3.2.2.

Do you have any idea what might be causing this?
 
Ok, I decided to buy the ultimate inventory system too. I went through the integration videos and some of the main ones for the inventory system. I tried putting the AssaultRifleDrop prefab in the scene, and changed the item definition to the new Assault Rifle item definition made during the tutorials, to see if I could pick it up and have it added to the inventory. It just disappears when you pick it up without adding anything to the inventory.

I tried adding the ItemPickup prefab after watching the tutorial on that and putting the Assault Rifle item definition in it. This allowed me to add it to my inventory, but he doesn't equip it automatically the way he does when you use the weapon drop from the FPS controller.

Can you use the weapon drop prefabs from the fps controller with the ultimate inventory system?

If not, how do you make the ItemPickup prefab from the ultimate inventory system auto equip a weapon you pick up?
 
Thanks for the purchase RogueSnake!

When using the Ultimate Inventory System (UIS) for pickups you have two choices.

The default UIS pickups wich simply add the item to a sepcified itemCollection. If you specify the equipment itemcollection then your items will be automatically soft equipped.

The other option is the integration pickup. This pickup allows you to automatically active equip on pickup.

Both of these pickups can be found in the integration demo scene with the assualt rifle pickups you see on the floor.

There is a little section in the integration docs that goes more in depth:

I hope that points you in the right direction :)
 
You're referring to this "Demo" scene? I opened that scene but when I try to pickup an object, it doesn't equip it or anything. It puts an icon in the inventory for it which says 0/(some number) and then when I try to equip it, it just disappears.

1751739608522.png
 
Hello, sorry for the delay, I'm currently on holiday so support is slower than usual.

That is indeed the integration demo scene I was talking about.
In that scene there are two different examples of assault rifle pickup. The one using IventoryItemPickup component with the option "Equip On Pickup" is probably what you are looking for
 
Back
Top