weapon spawning

hello,

so i was trying to figure out what would be the best way or most efficient way to use weapons in my game, to spawn an actor holding the mesh and fire functions or to define it all in the character script and just attach skeletal meshes that get turned off and on depending on the weapon selected.

Thanks!

Hi ,

You want to make sure that each weapon is its own script then spawn them/attach them to the character’s mesh sockets. It is generally not a good idea to put specific weapon functionality into the character script. Note: I am not, by any means, a C++ programmer. However, this exact situation came up several months ago and we had a discussion with a programmer, these were his thoughts on the subject.

ive personally done it in a modular fashion - if you download the shooter source code it looks like they are doing it the same

hi ,

thanks for the help means alot :), may i ask what you mean by !spawn/attach them to the mesh"? like creating a class type which would hold the weapon stuff inside the player, or spawning it and parenting it? sorry im fairly new to UE4 :confused: