Need assistance in coding item pick up issue C++

Hi All,

I am new to Unreal but have been working hard at learning it and C++ over he past few months. I am having a bit of an issue when it come to picking up an item. Currently I have a weapon class in my game and the weapons are basically auto-equipped when a character overlaps with them. That functionality is fine for me at this point but the problem starts when another character overlaps with the weapon currently equipped by the first player. The other player then snatches it and equips from the first (interesting game play but not what I am looking for).

Any idea on how to set the weapon to no longer be subject to the equip function I created once its been equipped? (I tried to make a copy of the weapon once equipped and then destroy the original but was unable to make it work correctly.)

Please use C++ instead of blueprints.

I am just looking to be pointed in the right direction and not perfect cut/paste code for my project as it helps me learn.

Thank you all!!

Hey there Bagman2488,

Without being able to see your code, it is a little difficult to tell you exactly how to approach something. However, you could dictate whether or not to process some logic in a function with a boolean, such as: bCanBePickedUp = false;
if “bCanBePickedUp” is true, then allow the logic to be run for what happens when a player picks it up.
if “bCanBePickedUp” is false, then don’t allow players to pick it up.

Let me know if this helps you at all and feel free to attach your code so I can, maybe, better help you.

I figured it out. I incorporated a bool that would skip my equip function after the first equip. There is probably a better way but its working as I wanted now. Thanks to all who looked at this