Download

Equip a weapon simple class problem

Hey ! For a group project I had to learn UE4 from videos which made me got some gaps for some things like classes and how to use them.
I followed a tutorial ([UE4] [1] Melee Combat System: Pick up actor/Attaching weapon - YouTube) which worked in a first time, but when we decided to put all our part in one simple UE4 project, it ****ed up. But I was firstly doing it without really knowing what the blueprint meaned.

It works like this :

  1. There is a “MasterWeapon” actor which is the parent of all the weapon. When you create a child, you just have to put the socket’s name and the mesh.

  2. There’s a PickUpActor which as a sphere collision that make you able to pick up the weapon when you overlap it (a simple widget shows “Press [E] to pick up” in the same time).

  3. In the HeroBP, it sets the “EquippedWeapon” var to the new one after deleting the old one (if there were one). Then, it goes to the “Equip” function to add the mesh.

The problem is that it does nothing. Actually, it seems that the “Item_To_Add” var is set to nothing so the first branch in the PickUpEvent cannot be passed.
How do I make the “Item_To_Add” be the Sword that I want to add ?

Thank you for the help ! I stay here if there’s any information required !