#best way to make a gun system

1 messages · Page 1 of 1 (latest)

ruby fractal
#

I finished making a single gun tool and now im wondering what the best way to make it OOP (i think this counts) is. should I put a module script under each gun which has modifiers and requires the main gun system? should i scan each tool in the main gun script for a gun attribute and check int values under the tool for differences? something else?

#

optimization is sort of a priority

limpid girder
#

if you're using OOP you're gonna want to structure it in a way that requires as few scripts as possible

#

per gun*

#

ideally just 1 module script for each gun

#

the way you want to structure the gun system if you want to use OOP is to make a whole ton of different assets you can just slap together in a modulescript with a main function for both client and server that is called when the tool is first given to the player

#

So instead of hardcoding things like shotguns you just have a bunch of reusable code that can be used to make a shotgun

pale egret
restive geyser
#

1 module to store data of all guns like firerate, damage.

#

and use atttributes

limpid girder
#

generally though just structure it in a way where you don't need to write more than 150 lines per gun

#

my old system would take upwards of 450 lines per gun, it was awful

pale egret
pale egret
ruby fractal
#

thanks

ruby fractal
#

would it check for attributes or something

limpid girder
#

you just add the module to the tool, which has init/main functions (whatever you wanna call them) that does all the gun building

#

just you need a local and server script to call them