Weapon Duplication Issue

Hi there.

I’m trying to make my character NOT pick up a weapon (in this case the BP_Rifle) if he already has one in hand.

What happens now is that every time the player walks on the Rifle, he will pick it up and the weapon will be duplicated in his hands (I’m shooting two balls instead of one).
This is what I did.

If someone can point me in the right direction or tell me if my logic is wrong as I’m still not able to make it work.

Thanks

Other instances have no way of knowing the value of the bool. From the weapons point of view it knows when it has been equipped but thats about it.

Hey @Skyler90!

So you’ll want to set a bool on your character saying whether or not a gun is in their hand, or some other variable (usually people use a custom ENUM with each weapon being an option). Then you’ll use your first person reference, “Get” that variable, and use THAT to check your branch like you’re already doing, just replace the variable with the one from First Person Char Ref. :slight_smile:

Hey Mind-Brain,

I can’t seem to make it work but I think I’m close.

I want to keep the OnComponentBeginOverlap of the Rifle and from there verify if the Character is already holding one or not.
I did an Enum in the Character (equipped, not quipped) however, I’m still stuck on the communication between the Blueprints.

Thats what I had in mind:

  1. The Character is set to NotEquipped by the Enum.
  2. As the Chracter overlaps with the BP_Rifle, the Rifle verifies if the Character is equipped or not.
  3. If Equipped, do nothing. If NotEquipped, equip Rifle.

It should be simple but I may not know enough yet to understand what’s not working.

If you have some other tips I’ll take them. In the mean time I’ll try to find some doc for Blueprint communication. I spent way too much time on this XD.

Thanks bud.

If this is your issue:
OverlapWeapon2

It can be avoided with a simple check like this:

OverlapWeapon

This is the default 1st person template. All I did was add the branch to check for the bool and make the actor do something if true. Everything else you can check out by creating a project with the template.

Hope it helps.

2 Likes

I knew it had to be something stupid like that haha.

Thanks a lot. This is Exactly what I was looking to do. Most videos were showing Pickup and Grab event, which I dont need. The anim with the rifle turning red is pretty cool.

Thanks again my dude, you made my day.

2 Likes