How to deal with many skills

Hi,

I’m working on a mobile RPG with multiple playable characters (you play 1 at a time). Each character has its own set of skills that it can learn, and they learn them through different parameters and milestones that they reach (e.g. Character A learns Skill X when he reaches level 5, Character A learns Skill Y when he has more than 100 attack, etc.). Each character can choose 4 skills to equip, however they will learn more than 4 skills (like pokemon if you didn’t have to replace moves with new ones).

What would be the easiest way to handle this? Checking for which character is being played, then checking the parameters to see which skill they will learn? I read that CSVs can be parsed and assigned to arrays, would it be smart to write up a CSV with the SkillName, Character, Requirements, etc. and assign those to arrays on load, then check through them to learn the skills? I previously implemented a small portion of this by hardcoding less than 10 characters, checking each parameter for each character (there will be >40 characters at some point), but there has to be a better way than hardcoding lol.

I have a very VERY basic understanding of C#, only just implementing a binary save/load system on appquit/start through a tutorial. This same save system loads the saved parameters, so now it would have to load in whichever skills the characters have equipped/learned. Sorry if this is confusing, I can elaborate if needed!

If there is another thread similar to this, please let me know, I couldn’t find any!

A more dynamic way could be to use a ‘mixin’, which in C# can be multiple inheritances. Basically you make a ‘base’ script which outlines parameters that exist in any given skill, like your required level, maybe even cost to the player or damage. This base script would be headed like normal:

public class SkillMixin : MonoBehaviour

And then each individual skill is headed

public class HyperbeamMixin : SkillMixin

So that it inherits all the variables from the base script, and you set them in your ‘derived’ script depending what the parameters of that skill are.

Then, either drag and drop all the skillmixins that would be available to each player on that player’s gameObject, and make a script so they’re only active after they’ve reached the level requirement OR make a script that adds the skillmixin once that player has reached the level requirement.

I prefer this method as it’s easier to change further down the line, easier to visualise in the project view, and is less susceptible to things like name changes and typos. I’m sure you can make a CSV method work too, but it wouldn’t be my first choice for something like this.

Can read more about inheritance in this Unity3D Tutorial