Permanently increasing parameters

I'm trying to give players a choice when they level up to invest in certain points, which end up increasing various things like atk, hp, mag def, etc. I'm assuming others have played around with this, would anyone be able to give some advice?

I had initially thought it would be as simple as adding to a variable for atk or def for an actor, but it seems more difficult now that I look into it. It looks like the parameters are kept track of in the BattlerBase script, and are calculated in the param() method I think, but I'm having trouble understanding the logic of it.

What I've tried:
-editing the BattlerBase script as below, attempting to add 50 hp for every point invested, on top of normal hp:
def mhp; param(0)+@hp_points*50; end

This gives me the following error: Script 'Game_BattlerBase' line 69: NoMethodError occured. undefined method '*' for nil:NilClass

Additionally, I think adding the amount as I did in the mhp method might cause issues, since I've noticed that parameters are not always called by using those named methods. Sometimes the paramters are accessed in other scripts by their param id, in which case they will bypass my additions and simply return their normal values.

I'm also concerned that once I actually manage to increase a parameter for an actor, that it will be reset by the character leveling up. If that happens, I might have to disable the normal leveling up.
you need to follow the script functions for the event commands that change parameters.

all parameters have three parts that are always added together: the level-dependend base value, the added equipment properties and a single value that keeps track of all "irregular" additions or substractions for that parameter.
The event commands to add or substract actually affect only that third part, and that is where you need to add your points as well because the other parts and the total are always re-calculated on changes to level or equipment.
It has been a while since I have worked in Ruby; but I had once created a system where leveling up would generate an item in the player's inventory; which I then used on a specific 'scene' to 'spend' for specific characters to learn new things or get new stats.

I think it might be adjustable to what you want; but that depends.

There should be a section in the main code that mentions 'def level.up' or something similar.

If it works in Ruby - you might be able to tack on a line onto the end that would cause a Common Event to run upon each level up - and set up that Common Event to ask the player to chose a stat for leveling - then increasing that parameter.

Again, I am not 100% certain since my Ruby is rusty, but I believe something like that might be possible if you are trying to avoid using something like a leveling script.
Thanks Ander, that helps me understand the relevant methods a bit better. I thought base value referred to value at level 1, and that the irregular value might be for temporary boosts from states or something. I'll give it another look and let you know if I can figure it out.

Thanks cthmpsn91, it sounds like a similar idea, but differently executed. I guess some of this could be done without scripting, but I'm trying to get better at it anyway.
in XP it's just

Ruby:
# get actor (example, actor 1)
actor = $game_actors[1]
# add parameters! (example, add 12 to strength)
actor.str += 12

for VX Ace you'd want something like


Ruby:
actor = $game_actors[1]
# in VX Ace, 2 is ATK.
actor.add_param(2, 12)

you could make a method that increases the parameter every time you put a point into it (putting a point into it would then just be, call the method from a choice dialog or something)
in XP it's just

Ruby:
# get actor (example, actor 1)
actor = $game_actors[1]
# add parameters! (example, add 12 to strength)
actor.str += 12

for VX Ace you'd want something like


Ruby:
actor = $game_actors[1]
# in VX Ace, 2 is ATK.
actor.add_param(2, 12)

you could make a method that increases the parameter every time you put a point into it (putting a point into it would then just be, call the method from a choice dialog or something)
Thanks, I just barely figured that out before you posted. Guess I have to use the param id numbers, so to increase hp by 50 I would do actor.add_param(0,50), because the id for maximum hp is 0. I've tested it, and the changes seem to survive both leveling up and saving and loading, so it seems to be working.

Original thread: https://forums.rpgmakerweb.com/threads/permanently-increasing-parameters.135016/