Help with weapon system

Hello, I am making a combat system that involves the usage of different weapons. I found a way to detect which weapon a player has, but now I am confused on how I can change the weaponry script based on the weapon. For example, a player picks a sword as their weapon, how can the game choose which module script (and or) other scripts to use for that weapon. Or should there be individual scripts for individual weapons?

2 Likes

Have a module for each gun type, named as that gun type, when you know the gun type a player has (equipped) require that module, if you have any custom settings (or attributes) use them to change the gun settings through the module.

1 Like

I will go ahead and try what you’ve recommended me

1 Like

Got it to work?

feel free to ask any questions.

1 Like

Sorry I had school. I’m going to try this method now.

Also I have a few more questions about this. Such as should all the functions be the same name for the modules, and where should I store the scripts and modules inside the weapon or elsewhere?

the modules should be inside the script which detects the gun type, and yes have the functions the same name

I have figured out the process, every weapon will have a folder of animations and scripts, and I can apply them inside a special storage area for the game to detect and use

I thought you gave up on the idea, good job :clap: you had the patience.

1 Like

Thanks. I didn’t realize how hard it would have been to do this either. also thanks for the help!

1 Like