Drop weapon when picking up another weapon

MissBig

Member
Hi I was wondering is there a way when you pick up a weapon and if you have a weapon equip it will just swap weapons. So, for example, I have 2 weapons only aloud in inventory and I have a pistol equipped and when I pick up another weapon like an assault rifle it swaps the pistol or whatever is equipped for that new weapon. so I was just wondering if that's possible. Similar to this:
 

Justin

Administrator
Staff member
I believe that this is possible with the Ultimate Inventory System integration but @Sangemdoko will confirm. The inventory included with the controller is extremely basic so is not possible without additional scripting.
 

Sangemdoko

Moderator
Staff member
I believe this would require a custom script even for the Ultimate Inventory Integration.
By default you can set a pickup to Equip automatically. So the current Item will be unequiped, going back to the Main Item Collection. By setting an Item Restriction you could prevent the item from being added to the main item collection which will cause an Item rejection event to occur. You would then be able to listen to that event with some custom script to drop the item.

A more straight forward way of doing this (which I would recommend) is creating a custom pickup that simply checks what item you have equipped. If you have a weapon equipped you drop it before equipping the new weapon. It should be fairly simple since the Drop and Equip functions on the character inventory are easily accessible from the pickup.

Using Item Categories and the Item Slot Set you'll be able to know if an item was equipped in that sepcific slot. Check out these documentation pages and video tutorial:

I hope that helps
 

MissBig

Member
I believe this would require a custom script even for the Ultimate Inventory Integration.
By default you can set a pickup to Equip automatically. So the current Item will be unequiped, going back to the Main Item Collection. By setting an Item Restriction you could prevent the item from being added to the main item collection which will cause an Item rejection event to occur. You would then be able to listen to that event with some custom script to drop the item.

A more straight forward way of doing this (which I would recommend) is creating a custom pickup that simply checks what item you have equipped. If you have a weapon equipped you drop it before equipping the new weapon. It should be fairly simple since the Drop and Equip functions on the character inventory are easily accessible from the pickup.

Using Item Categories and the Item Slot Set you'll be able to know if an item was equipped in that sepcific slot. Check out these documentation pages and video tutorial:

I hope that helps
Thank you but I'm not using Ultimate Inventory System. I'm going to be using adventure creator.
 
Top