This tutorial assumes you understand at least the basics of RGSS coding. Such as aliasing methods, classes, variables, etc..
Step 1 ::
Grab the class and any methods you need to modify. In this case, that would be Game_Actor and the method ‘param’ – which determines the param value. So, we would write this code… (or something highly similar)
#=============================================================================== class Game_Actor #=============================================================================== #----------------------------------------------------------------------------- # List Of Aliased Methods #----------------------------------------------------------------------------- alias :dekita_param_mod_tutorial :param #----------------------------------------------------------------------------- # Method to determine value of actors params #----------------------------------------------------------------------------- def param(param_id) dekita_param_mod_tutorial(param_id) end end
All this code does it alias the current ‘param’ method and then calls the aliased method whenever param is called. This is the most basic way of ensuring that the old method is not fully overwritten.
Step 2 ::
Now, we can add a way for the param value to be modified by a variable…
#----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def param(param_id) ( dekita_param_mod_tutorial(param_id) * $game_variables[VARIABLE_ID] ).to_i end
See what I did there?
Because I know that the old method for ‘param’ will return an integer value all I have to do is multiply that value by the value stored in my variable. Lets say in this case the variable is equal to ‘1.5’, this means all stats will be multiplied by 1.5.
Then, because we dont want float numbers for our params (numbers with a decimal point such as 1.234), instead we want nice round integers (such as 1,2,3,4..) I enclosed the formula (old method * variable value) within brackets ‘( )’ and then added an additional method onto the end. ‘.to_i’ will ensure that the code is going to return an integer value.
And thats it done.
Obviously, you can start getting ‘more creative’ and maybe create a class or module to determine how the param is going to be modified. Hell, you could end up doing what I did and create about 30 scripts that modify the ‘param’ method to determine the value.
Wait, this affects the whole parameters every time right? I did a parameter change script back then that adds the parameters per level up, but I was curious how about the special parameters? I want to assign tgr, mdr, etc into new values per level up via a note tag but somehow I can’t find where they are.
Yea this would modify regular params by the value stored in the declared variable – for all stats.
Obviously this was only intended for simple parameter modifications, but the principals are fairly similar.
For modifying the x / s – params, you could have a look at how i done it in my ‘statistic control’ script 🙂
https://dekitarpg.wordpress.com/2013/03/14/d13x-statistic-control/
Also – using the ‘Developer Stat Level Up Distribution’ script, it allows for all stats to be ‘donated’ to actors etc on level up. 🙂
https://dekitarpg.wordpress.com/2013/03/14/d13x-statistic-level-up-control/
Both great points of reference if you are able to follow the code 😀
Thanks. I did some param control back then but never had the chance to bring up the s-x-param because they seem to be in the features. I’ll look at how you did it and try to see if I can pull it out on my own.