#Handling Weapons

1 messages · Page 1 of 1 (latest)

clever zealot
#

I'm making a game that requires me to have many weapons available for the player. All these weapons are unique with very little in common (That being things like damage type {Blunt/Slash} which alter the sound effect of the weapon). I have currently attempted 2 ways to handle these weapons but they don't feel "proper". At times it is very difficult to add changes to these systems when I need it.

Each weapon has a unique Basic attack sequence (4 basic attacks), Critical Attack, and parry/block animations.

They all have these though.

(Much likes game like Deepwoken, Mountfall,)

QUESTION
My question is basically asking if anyone has had experience with a system like stated above but I will explain the ways I have currently done them and the issues with them to see if they may be fixable.

#
  • I have a local script to take all the inputs of the player then I fire a remote event when a keyboard is pressed.
  • In a server script I receive any needed parameters and use the corresponding function stored in a module script.
  • I then play the animation and use animation events to handle when hitboxes are used.
    -Things for the hitbox such as size, damage and etc are stored in a table in the module.
    -Physical things for the weapon such as animations and models are stored in the

The main issue with this is the fact that I can not vary things a lot. Occasionally I can add small details using Animation events but it gets really messy really quick when I have multiple effects or special behaviours for 1 animation. The system is also hard to make altering hitboxes for (like the first basic attack having a wider hitbox than the second)

I could make the whole game using this method but like I said it gets messy and I'm just unsure if this is the right way to go about it

(I was fairly new to this as I had seen someone doing it with guns on a view model series I was watching)
-Create a separate module script for each weapon and play the animations in there.
-I link the animation events to a function that fires a remote event whenever something needs to be done on the server side.
-I still have a module script for basic things such as making the hitbox
-I no longer use a table to store damage as I can store it in the module script or hardcode it.
-animations and models are parented to the module script

The issue with this is that I need to constantly repeat code that I wouldn't in the first one as they are all in separate modules. This however allows me to customize the attacks better. As they modules are made individually. I can hardcore things such as altering hitboxes.

You only really need to read the part labelled questions and the paragraph before it
But it's easier to understand if you read the whole of it.

#

If anyone needs screenshots to explain the poorly explained parts I'll provide them tomorrow

craggy monolith
#

OOP would help

#

I would create a WeaponManager on both client and server

#

Which handles each weapon you make

#

So one for the client and one for the server

#

The weapons-manager would handle player input and anything else you need while the weapon itself will store the data it needs as well as animations and hitboxing