Creating a Weapons template

Sorry for the late response. In the editor, click the green “Add New” button. In the list, select “Blueprint Class”. Now name this whatever you’d like (I usually do WeaponMaster so I can do a quick search for Master and find the Master of any class I want be it weapon, grenade, etc…). Now repeat clicking the green “Add New” button and select “Blueprint Class” again, only this time search for whatever you named the Weapon Template; this will be your first actual weapon (we will call it “FirstGunBP”). The Master or Template is only used for creating and setting variables, and creating events that spread across each weapon. Once you select and create it, open both. From here, if you want to put an event, say Mouse Click, you can put the event, even custom events, in the Template/Master and attach some code to it. Now, you can return to your FirstGunBP and add that same event. Then, right click on the event node and click on “Add Call to Parent Function”. After that, you can connect any nodes to customize each weapon in each weapons BP. As for variables, any variable that you create in the Template/Master BP Class will show once compiled in the child actors, so any weapons you have made by using this method.

To cast to these weapons you will need a reference to the weapon itself, or you will only be able to get what you have the stats set as in the weapon. If you have a reference, you can read information only to that weapon such as upgraded damage, without the reference, it will only show what you programmed that weapon to start as. When you cast, as long as you have the reference, you can manipulate any stats you want. Also, it is a good idea to have a Function for Shooting one shot off. That way you don’t have to reprogram shooting for each weapon, only how it shoots. (Ex) If you have a pistol and an assault rifle, you can choose to only call Fire Shot event on Mouse Down, or you can call it until the mouse is released, once or many times.

As far as Mouse Down events and control events, it is a good idea to have an event in your player characters BP that casts to your equipped weapon and fires its own event within the weapon, and it is also a good idea to have the shooting key in your inputs in the Project Settings. This allows you to run any checks your player may need to run to see if he can shoot such as Allowed to Shoot and Is Stunned, and your weapon can run its own checks like Ammo in Clip and Is Jammed and keeps things organized. Sorry for the long response, but I remember how frustrating this was for me to learn at first as well. Let me know if you need any explanations or anything more.