Advice on V's Level Up Stats script

Discussion in 'RGSSx Script Support' started by Kes, Oct 31, 2016.

  1. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,169
    Likes Received:
    10,324
    First Language:
    English
    Primarily Uses:
    RMVXA
    I am using V's Level Up Stats script which can be found here.


    A certain number of spend points are allocated every time an actor levels up.  Everything is working as it should.  However, I hit a problem when an actor changes class.


    In order to keep the actor at the same level after the class change as s/he was before, instead of reverting to level one, I use a variable to store the actor's EXP.  Once the class has been chosen, I change the EXP to the amount in the variable.  This works as intended.  However, what also happens is that the spend points for all those levels are allocated to the actor again, on top of the ones that have been received in the normal course of playing.  As these changes happen around level 7, the actor gets an extra 20+ points, which effectively breaks the balance.


    Can anyone see a way round this?  


    Thanks.
     
    #1
  2. Sixth

    Sixth Veteran Veteran

    Messages:
    2,121
    Likes Received:
    789
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You can do several things to counter this.


    1. Restrict the stat point gain on class change. Can be done with scripting.

    Code:
    
      def level_up
        old_level_up546345()
        return if @dont_add_points # <-- Added this line.
        @lvupp += Points_Per_Level
        $game_system.leveling = true
      end

    The above code is from V's script.


    I made a @dont_add_points instance variable there.


    That will be set to true just before you make the class change, and set to false after all is done with the class change.


    I don't know how you make the class change, but seeing that you already did it, I assume you know when and where it triggers. That's where you should toggle this instance variable as well.


    If your class change is entirely evented, you will need to do some extra work.


    First, you will need to allow access to this new instance variable from outside the class. That should be easy, looks like:

    Code:
    
    class Game_Actor < Game_Battler
    
      attr_accessor :dont_add_points
    
    end

    Just enter this anywhere in the script editor.


    When this is done, you can set it's value from evented script calls too. That works like:

    $game_actors[id].dont_add_points = true/false

    $game_party.members[index].dont_add_points = true/false

    The first one is based on actor ID, while the second one is based on the members' party position.


    Just set the value to true for this variable before the class change in the event, and set it back to false after the change.


    But I don't know how this stat allocation works. If the allocated points are stored within the actor object, than the above change should be enough. But if it's stored somewhere else which might also reset due to the class change, than further edits will be needed to save the allocated points somewhere else. 


    I wrote "several things", but quite honestly, I forgot what else I had in mind. :D  
     
    Last edited by a moderator: Nov 1, 2016
    #2
    Kes likes this.
  3. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,169
    Likes Received:
    10,324
    First Language:
    English
    Primarily Uses:
    RMVXA
    The class change is indeed entirely evented.


    I've tested this out and it works to perfection.  It was looking like I'd have to choose between stat allocation or class choice, and now I can continue with both.


    Thank you so much.  I much appreciate your help.
     
    #3

Share This Page