how to stop weapons from the beginning in my inventory

I have weapons actors in my game that could be picked up by pressing E when the character collides with their Collision box
however there is a filter ( branch ) inside the weapon actor blueprint that chicks if the weapon exist inside the weapons array in the third person blueprint, and only if the weapon does not exist, it add the weapon to the array

however that branch is not working and when I click the E button two times, the first time it picks the weapon from the floor adding it to the weapon array and the right hand, then when I click it second time it is picking the weapon from the right hand adding it again to the weapon array, therefore duplicating the same weapon in the inventory

this is causing a lot of issues in my game logic how can I solve this problem




The check needs to happen in the Interaction code.

Interact → check Inventory for match → No match, then Add, else ignore (return).

1 Like

Perhaps an or Boolean and a query of whether the weapon is in the players hand as well as checking the inventory

1 Like

Weapon would still have to be listed in inventory.

1 Like

Try an add unique node instead, this will only add the actor if it isnt in the array

It will skip that branch

So simply from your weapon array just drag out and add unique in you weapon actor.

Hope that helps

2 Likes