Weapon Selection System
At the moment I have a fleshed out weapon system that includes various things like ironsights, muzzle flash, reloading, ect, but it is all handled inside the player blueprint and not in a weapon specific blueprint. I feel this will fill my player blueprint space pretty quick and just seems like an inefficient method. Im interested in expanding each weapon into its own specific blueprint, but Im not sure how I should have everything work together. Ive basically expanded a lot on the FPS blueprint template.
asked Dec 20 '14 at 08:03 PM in Blueprint Scripting
I have been slowly experimenting with various ways of doing this, initially I did it all in the player blueprint too, but I found that having specific weapon blueprints is definitely the way to go. The hard part for me was actually calling those blueprints to function inside the player blueprint when called, but it is very easy! The way I achieved it is by creating the weapon BP, which contains the shooting logic, ammo count, gun mesh, etc, and then exposed all variables that I would want to change for future weapons (so I could easily duplicate and switch out meshes). I had the "fire" logic made as a function, and then in the Character blueprint, I got all actors of the Gun BP class, cast to that specific BP, and then from there I could expose the functions as variables and I could call the shooting function when the player presses shoot. To attach the mesh to the player, I just spawned the WeaponBP actor at event begin play, at a socket on the character mesh. This definitely isn't the best way to go about it, but it could help you get a step further. My next goal is to have a simple 2 weapon inventory system, so instead of calling specific functions and weapons on spawn, I would be able to call a variable that then sets those values!
answered Dec 29 '14 at 02:24 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here