Weapon Pickup & Drop Issues

Hello readers,

I have recently been attempting to start on my own third person/first person split shooter game, and as such have been attempting to implement a system wherein a player can pick up a weapon from the weapon being on the floor, and then drop that weapon after, however I am having a few issues where primarily whenever I press G (drop bind) regardless of whether I am actually holding the weapon (in this case a flashlight), this flashlight will drop at the feet of the player, which is a spammable command, and I don’t realistically want players running around spewing out flashlights all over the floor.

The other issue I am having is that whenever I press E (pickup bind) the flashlight I am intending to pick up immediately enters my hands, regardless of my distance from the flashlight itself on the map, which is a hindrance as I would like it set so players can only pick up this object whilst near the actual object.

In the screenshots below you can see the issues I am having, and how my blueprints are laid out for the flashlight_equip blueprint, and the thirdpersoncharacter blueprint. Any help I could get on this matter would be very much appreciated.

Third person view of the flashlight’s placement on the map:

Flashlights spammed around the map:

Not holding a flashlight:

After pressing E, equipping a flashlight whilst nowhere near the object:

Flashlight_Equip blueprints:

ThirdPersonCharacter blueprints:

Thanks,

I am editing my answer:

Add another bool CarryingFlashlight to the players blueprint

Put a branch at the beginning of the chain of events when G is pressed based on the value of CarryingFlashlight being true, only go further if it is true. and then at the end of your chain of events after you spawn the flashligh, set the value of CarryingFlashlight to false.

To fix the E key so it will not pickup from wherever you are in the level uncheck the box where you set equipmentpickup at the end of the chain so it becomes false again, also you will need to add another node to the end of the chain of events on the E key to set CarryingFlashlight to true

That should do it.

Hey ,

Thanks for the swift response! Using your issue resolution I managed to fix the problem of the G key instantly dropping from wherever, so thank you very much for that! However, I am still able to pick up the flashlight from anywhere on the map, regardless of the position of the actual flashlight, even though I have triplechecked your methods and applied them. Any thoughts on fixing the E key?

Thanks!

Bump

I am still having this issue, and it’s becoming a bit difficult to continue with this project when I know I may have to start fresh.

Anyone else have any ideas?

Is the equipmentpickup bool supposed to be the flag telling the game whether or not the player is allowed to pick up the flashlight?

If you put an OnEndOverlap event in the flashlight BP, and use that to set the EquipmentPickup to false, it should prevent the player picking up the flashlight once you’ve moved away from its collision sphere.

Hey ,

If I could kiss you right now, I probably wouldn’t, but I would still be extremely thankful as your solution resolved my issue!

Occam’s Razor - The simplest solution is always the best

I can believe I didn’t think of that as a solution, but there you go! Thank you!