How to structure Ability System – Programming & Scripting


Im working on an ability System for my vampire survivors like (shoot em up). I made a base ability and base aoe ability and etc. all are actors.
I ran into a problem because i want to safe the level in the ability, but i instantiate the ability from class when casting. So i cant update level or change cooldown inside the ability.
How could i go about this. I was thinking about saving the level of each ability in a seperet component, but that feels not right.
Also i though about making one component for each ability and attach them to the player, but should you use components if it is only used by one actor?
Maybe someone with more experience could give a little point in the right direction?

components would be fine, or even a struct if you just want to keep it really simple.



1 Like

As above, comps will work well for this.

  • make a base component class
    – shared stats go here
    – leveling it up
    – dispatchers
    – auto firing
    – saving
    – and so om
  • make a child of the base that is a projectile
  • make a child of the base that is an AOE effect
  • make a child of the base that is an OT effect
  • any other child class whose effects bring something new / unique enough to warrant a subclass

Spawn comps dynamically on the player with:

image

Before you spawn it, look up whether the player already has one and level it up instead.



Source link

Leave a Comment