Problem with making skill system for my creatures

Hi. I want to make some skill system for my creatures. I see it like that:

  • Write classes for all skills (they inherit from some abstract base class and I want all skills to perform different action, preferably in coroutines if possible)
  • Add all of them to some static general dictionary (all skills have unique string id)
  • Add some default skills to my creatures (let’s say i want one of them to have Fireball, Kick, Roar, the other to have Acid, Thunder Bolt, Attract etc.)
  • And finally let players change specific creature’s skills (remove, add, maybe upgrade) in some menu.

I wanted to make it like this:

But i have some questions:

  • Should i create separate script for every skill? Or can i just have all classes in one script with base abstract class? Or maybe abstract class in one script and all inherited classes in other script?
  • Do i have to attach skill script with base skill class/inherited skill classes to game object? Because they have to derive from MonoBehaviour if i want to use coroutines (i think)
  • How and when i should skills to general dictionary?

Or maybe there’s better way to do it?

Its a tricky thing to tackle, since “fireball” probably massively changes the way the creature interacts. I’m doing something similar in a game i’m making, it’s a city builder and there are lots of tools such as the road tool, zoning tool etc. These tools are each scripts on a manager gameobject. The manager object also has a manager script. Each of the tool’s scripts has an “active” Boolean, and the manager script turns the Boolean on and off. You can do something similar, by having a manager script on each creature, and scripts for each skill on the creature. The manager script can then turn the skill scripts on and off by changing the stage of an “active” Boolean. Just an idea, but it’s a solution that would work. :slight_smile: