[SOLVED] Equip Only if slot is available

HumzaKhalid

New member
hey everyone, really happy to be here,
I have been working with opsive character controller and opsive inventory to make something unique,

I have been facing an issue, where if I equip a certain item (item is added in opsive inventory), if I come along same item, I could equip it.
but actually I want to restrict this action, if my slot (certain) is equipped and try to pick up item of same catogory or same item definition, it should not equip or add it into inventory (should do nothing).

Tried multiple options, may be this is something easy, but im not finding anything related to complete above scenario.
Looking forward for the direction thank you :)

P.S:
Sorry for bad english
 
yeah I have set item rules for the euippment slot, but even if does not equip, it picks the item to store for inventory, I want to restrict both actions, if certain slot is equipped, I should neither equip related item definition/category nor add it in inventory.
 
Ah I am sure there is options to cover this, one being the max item definition count, sorry I cant think of its actual name right now and I dont have pc open. And also there is an option to equip on pickup or not, which if my memory serves correctly, is on the pickup item.
 
Do you have the Ultimate Inventory System? You are able to restrict the items equipped with that integration but the character controller inventory doesn't include support for this.
 
yeah I have UIS as well, please can you give me more guidance on how to restrict?? I have added set rules in "Inventory Item Set Manager" for category, but If I have equipped an item for example BoxA , when I try to pickup BoxB (of same category), BoxA is moved to invenotry and player equips BoxB.
the functionality I want is, if I have equip BoxA and try to pick up BoxB it should do nothing, no picking up, no saving current equipped item to inventory.

thats the scenario im looking to implement, please guide me how it could be achieved.
thank you.
 
Hi,

If I understand correctly what you want is an ItemRestriction. You can learn more here:

This can be achieved purely with the Ultimate Inventory System, you don't have to worry about ItemSetRules at all in your use case.

What you need is create a "Item Restriction Set Object" and set it on your Inventory component

Then add a "Item Collection Category Restriction" or "Item Collection Stack Amount Restriction" restriction to the list of restrictions.
Set both your EquipmentCollection and your Main item collection and restrict it such that you can have only a single item.



If that does not work there are other solutions but they require custom code.

1) Make your own custom pickup script that checks if the character already has an item before it allows you to pick it up
2) Make a custom item restriction script with more complex values



Also disabling this option might help in your case, although I'm not sure it is exactly what you want.
1671447238430.png
 
hey thank you for the guidance, I was able to solve my problem by adding custom code to "ItemPickupBase", I got item category information from base class and when player try to pickup, I check if player has same item category in "Equippable Slots", then I was able to put together solution for my particular scenario.
Thanks.
Regards,
 
Top