For killing an enemy, you will want to give him a Health variable. When you hit him with a bullet or line trace, you can call “Apply Damage” on him where you can specify the damage you want to deal.
Inside of the Enemy, you can then use “Event Any Damage” to create the logic of the damage. It will pass the damage you used for “Apply Damage” and you can then just subtract the amount from
the health variable. If the health is <= 0, you can call your drop and destroy methods.
Here are some screenshots of the things you might want to use (no actual setup, because that is too much work for me and you should do a bit of work yourself :D)
You can see they match the values
The left one gets called on the Weapon/Player or where you call you shooting event.
The right one gets called on the actor that gets damaged (your Enemy).
For dropping something with 20% chance, you will want to have a simple random int between 1 and 100 (including) and
check if the number is between 1 and 20. So you have a 20 percent chance
There are some other random nodes with streams and things that you might want to use.
For picking up the weapon with E, you might want to have a variable to save a reference to your weapon on your character
and a socket on your mesh (google helps you here, because there are already several tutorials on youtube and the wiki for
You can do something like that:
I have not filled the Start and End Location here and i’m missing a cast to the specific weapon class, because i simply don’t have one.
Combine this above with the thing you find on youtube and google and you are good to go (:
Documentation Page about Sockets on Skeletal Meshs
Youtube Search for equipping weapons to your Player
A video from Epic that somewhat shows you how to use a Line Trace and how to interact with another BP Actor