OnComponentBeginOverlap to a InputAction

Hey, if you see the pic attached I have a blueprint so if the player walks into the ammo’s collision sphere, then it adds it to the players ammo count, everything is working fine with it. However I want it so that the player must press the ‘E’ key (InputAction Interact) in order to add the ammo, but I can’t as the cast to first person character node needs an object for its input, which is currently connected to the ‘other actor’ output, so I was wondering if there was a way around this? Thanks in advance

1-Create a boolean with a default value of false.
2-Set that boolean to true if the overlap event is triggered.
3-Have a branch connected to your input, so that if the boolean is true, then add more ammo. If false, don’t do anything.

That is the basics of it, can work your way from there I’m sure. Hope this helps.

Okay so if you see the pic I’ve done this but it’s not picking up the object and destroying the actor which is at the end of the blueprint (see pics for details) Thanks for the help

I’m pretty sure you miss the “Enable Input” node. Make sure to call “Enable Input” when the Player overlaps and also “Disable Input” when the Overlap ends (there is an “OnEndOverlap” or something for each collision shape).
Make sure to leave the target for self and connect the PlayerController to the other input. Otherwise the Blueprint will not receive input from the Player.

You can check all of that my adding a PrintString node behind your InputAction and checking if it is ever called.

Ah that worked great, thanks for the help guys :slight_smile: