How to organise multiple character fighting system

Hi,
I’ve started work on a smash-bros style fighting game - I plan to have multiple characters, where you select one and movesets are tailored to each character (I.e. pressing “e” on one character does their character-specific move).

I understand I should be using OOP, but I’m wondering where I should be placing scripts related to attacks; Where should I be placing “moveset scripts”, with the attacks of a specific character inside, and how do I ensure only the current selected character’s script gets executed? My priority is maintainability; Ideally, I should be able to add characters with ease after I’ve prototyped them.

Any help would be greatly appreciated!

I’ve made a system like this before, and although I haven’t made any attacks on it, this is how it works. I use a dictionary system, and depending on which character you have selected, a different “dictionary” module is selected, which returns the NAME of the attack you want to use. So if you’re using character1, for example, the module will know that you’re pressing e, and return “MoveECharacter1”, and the script will send that up to the server. Hope this helps.

1 Like

Using a local script in StarterPlayerScripts and then finding the backpack by doing.

local Attack = script.Parent.Backpack.Attack -- this would be finding your attack

You could also store your attacks in a folder in replicated storage and when it’s time you clone them to the players backpack.

1 Like

put a stringvalue inside the player and then keep track of the character he’s using, use that stringvalue for everything.

something like
if stringvalue.Value == "Mario" then animationMarioPunch1:Play()

then to add other characters you just add an elseif

1 Like

This makes sense, but why would I need to keep it in the backpack? Is it easier to trigger attacks this way compared to accessing replicated storage directly when a key is pressed?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.