How to make it so that when I press the G button, will my character throw away the weapon he is holding?

I already have a PickUp system, but I want that I could throw out the weapons that I have in my hands by clicking on the button, how do I do this?

Сould you show me the details
this is to realize. I can imagine in my head how it should look, but I do not know how to do it exactly.

I basically destroy the current weapon and spawn the pickup for that same weapon type. I spawn the pickup near the right hand but far enough away that it doesn’t hit the character mesh. That will only look so good but it’s the right place to start.

For something more sophisticated you’d want to use an animation of the character dropping the weapon. The button press would trigger the animation (I’d use a montage) and an animation notify would trigger the destroy/spawn process I described above. With this you’d want to spawn the pickup much closer to the hand so it looks better.

If you need details just ask.

This is the basic idea. I had to pull out stuff that wasn’t relevant so I’ve never run this exact event. It should work though.

What does the variable Equpped weapon indicate?

Where did you get the type of weapon on Weapon Pickup BP?

A lot of incomprehensible. Could you explain it in more detail?

EquippedWeapon is a reference to the weapon actor. When DropWeapon is called, EquippedWeapon has already been spawned and attached to the right hand socket. The character is holding that weapon and can pull the trigger so it fires. If your weapon isn’t a blueprint (i.e. just a mesh) then it should be a blueprint with a mesh component.

WeaponType is a variable in the weapon blueprint. It specifies the kind of weapon (M4A1, M416, etc.). The weapon pickup has WeaponType set to “Expose on Spawn” so it can be set in the “Spawn Actor from Class” node. When the pickup is spawned, BeginPlay is run and in there I set the mesh of the pickup based on which weapon type is set. Then I get one pickup that can be set to any weapon. When you pick it up, you check the type so you know what kind of weapon to spawn and attach to the character.

“Expose on Spawn” is an option you can set for a blueprint variable. It must also be set to “public” to work. It will add pins to the “Spawn Actor from Class” node so you can initialize variables before BeginPlay is run.

Hi again. I see you posted a new question and it uses some of my example. Can you please mark this question as answered so it can be put in the “Solved” category?

Under the button you pressed to give the answer a +1, there is a check mark. Click that. FYI: when you have multiple answers you can only accept one of them.

How can i do this?