Search Unity

DND style stat progression

Discussion in 'Scripting' started by Quiet_Apples_Studios, Aug 7, 2020.

  1. Quiet_Apples_Studios

    Quiet_Apples_Studios

    Joined:
    Jan 27, 2020
    Posts:
    17
    When I level up i would like to pull from a scriptable object, search for the stats relevant to my level and then add them to my character base level.

    I originally planned to do this via 2d scriptable objects but for some reason they do not show up, any guidance welcome
     

    Attached Files:

    • 2dd.png
      2dd.png
      File size:
      4 KB
      Views:
      304
  2. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    The reason they don't show up may be, that they don't exist? At least I have never heard of 2d scriptable objects.

    I assume your image contains some code? Don't do that. Post your code with code tags directly.

    To your problem with stats and levels. I would just make an array of stats for each level of the character and if there is a level up just retrive the one with the current level (its the index in the array). Then each set of stats for a level could be it's own scriptable object or you have one scriptable object (for example for different classes like paladin, druid) with said array and it contains a struct of the stats. Does that make sense or do I misunderstand your problem?
     
  3. Quiet_Apples_Studios

    Quiet_Apples_Studios

    Joined:
    Jan 27, 2020
    Posts:
    17
    2D arrays in scriptable object.
    The picture is a rough guidline of what I meant.

    Thanks for the advice though its much clearer to me now
     
  4. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    Could you post your code so that we can find out why they "don't show up"? Do you mean you can't see the array in the inspector? Or you can't access the scriptable object from the character to retrive the values?
     
  5. Quiet_Apples_Studios

    Quiet_Apples_Studios

    Joined:
    Jan 27, 2020
    Posts:
    17
    I meant in the inspector, i would psot but I deleted that code i'm afraid, thanks a lot for the help though exactly what I wanted :)