Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Magic/Skill System

Discussion in 'Scripting' started by Camronas, Aug 14, 2016.

  1. Camronas

    Camronas

    Joined:
    Apr 20, 2012
    Posts:
    154
    Hey, I am trying to make a Magic/Skill system. I am just trying to figure out the best way to handle it. My first thought was to use a scriptable object as a sort of data base which is working fine, my spells all have names, costs, etc. the only issue is I am not sure how to give them all separate functionality.
    I want to keep using the scriptable object for obvious reasons, I want it to be really quick and easy to add/remove spells, but I am not sure what the best method would be to have that scriptable object store/determine spell functionality.

    Any and all suggestions would be greatly appreciated!
     
  2. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    RavenOfCode and zombiegorilla like this.
  3. Camronas

    Camronas

    Joined:
    Apr 20, 2012
    Posts:
    154
    Thanks, that lecture really helped. I now have a spell system that is working rather well. Still need to push it more to the limit but overall I am quite pleased with it. I simply have a scriptable object per-spell but each spell could have a different type (AOE, Ray, Touch, etc.) then the characters have a list of the spells they know and can use.

    Thanks again for the help and the link.
     
  4. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    Yeah, no problem. Thank TonyLi for posting the link and Richard Fine for the lecture. It helped me out a lot too. I am going to set mine up basically as inventory items and allow a player to buy different items in exchange for some sort of economy whenever they level. So basically, it will be an inventory system. Then it will basically go on what amounts to an item bar.

    I was also considering the whole "universal system" concept and I may break the whole spell system down into something else. Basically, my spells will be activated "weapons" from the skill bar. They'll be containers that consist of three scriptable objects.


    WEAPON
    cost (mana, health, etc.)
    cooldown
    # projectiles
    rate of fire
    velocity
    cast animation
    FX

    PROJECTILE
    straight line (stop on hit)
    duration/range (end projectile)
    homing
    FX

    WARHEAD
    damage
    area (ball, wall, storm, cone, etc.)
    duration
    secondary effect (damage, heal player, etc.)
    secondary effect duration (poison, burn, etc.)
    damage type
    knockback
    physics effects
    travel to additional targets (like chain lightning)
    FX



    Maybe that will help you out too. Maybe not. LOL
     
  5. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    EvilGremlin likes this.