Stackable parameter buffs on states?

Hey, y'all! I'm looking for something very simple to explain: The game I've been working on has quite a few stat buffs, and I've been working on seeing if I can get a way for them to stack together. More specifically, I'd like them to stack for the base stat if possible (though I wouldn't be opposed to a multiplicative sort of thing if that's not possible). It seems like this is how it works for Extra Parameters, but not for regular Parameters. Here's an example of what I mean:

One state I have, "Motivated", boosts all stats by 10%.
Another state I have, "Agile", boosts Speed by 150%.

I'd like it so that having both of these states on a character would boost their Agility by 160% - as I understand it, this is not how it works by default and Agile would either override Motivated or the higher priority state would override it. As I said, I would like this to apply to the base stat specifically if possible. Using the example above...

Say a character has 80 Speed. I'd like both the 10% from Motivated and the 150% from Agile to come off that instead of off each other. So 80+40+8=128 Speed for the character, AKA 160%!

I'd like this to apply to stat debuffs as well - so someone having all stats debuffed by 10% and Attack debuffed by 50% would have their Attack debuffed by 60% total.

Thank you for reading! If anyone has any questions, please let me know!
One state I have, "Motivated", boosts all stats by 10%.
Another state I have, "Agile", boosts Speed by 150%.

I'd like it so that having both of these states on a character would boost their Agility by 160% - as I understand it, this is not how it works by default and Agile would either override Motivated or the higher priority state would override it. As I said, I would like this to apply to the base stat specifically if possible. Using the example above...
The states don't override each other - priority only determines which ones to display if there's limited space and not enough room for all afflicted states. Assuming "boosts by 10%" means you set the parameter trait to 110% and "boosts by 150%" means you set the parameter trait to 250%, combining the two would result in a boost of 165% - the two boosts are multiplied together.

With a small plugin or an edit to the core files, it's easy to change it to get the additive behaviour you want - you just need the paramRate function to call traitsSum instead of traitsPi.
Ahh, alright! I've heard contradictory things about that, so it's good to get some clarification; thank you very much.
Unfortunately, I have zero experience in modifying RPG Maker MV core files or anything like that; how would I go about doing that? ^^;
This function in rpg_objects.js:

JavaScript:
Game_BattlerBase.prototype.paramRate = function(paramId) {
    return this.traitsPi(Game_BattlerBase.TRAIT_PARAM, paramId);
};

Basically traitsPi just needs to be changed to traitsSum. Rather than editing it in the core file though, what I would recommend is copy-pasting it into a text file, changing it there, and saving it as WhateverYouLike.js. Then you can put it into your plugins directory and enable it as a plugin.

While this will make parameter traits additive, that has the side-effect that you won't be able to create a debuff. With the standard system, a debuff is simply a parameter rate lower than 100%, but with an additive system, you would need a negative number for a debuff, and the editor won't let you set a negative number as the param rate.

Also, with traitsPi, the result will be 1 if there are no traits, so everything will work fine. However, changing it to traitsSum means the default value is now 0! So, you will need to add a 100% buff for every parameter to every actor in order to offset that (or you could do it in the code automatically - return 1 + this.traitsSum). Otherwise everyone's parameters will be set to their minimum value (which I think is 1). Then for your 10% buff, you set it to 10% instead of 100%. Similarly, for your 150% buff, you set it to 150% instead of 250%.

Assuming "boosts by 10%" means you set the parameter trait to 110% and "boosts by 150%" means you set the parameter trait to 250%, combining the two would result in a boost of 165% - the two boosts are multiplied together.
Also I just noticed that my calculation appears to be wrong here. 1.1×2.5 gives 2.75, not 1.65. So a 110% and 250% boost would combine to produce 275% under the default system.
Hmm, I see. Thank you for the help on this! That said, not being able to create debuffs is a little problematic; is there any way I could work around that somehow?
There's definitely some way to work around it, but I'm not sure what I'd recommend. It would probably need to be something that uses note tags to specify the debuff.

Perhaps you could look at my ParamAdd plugin for ideas. I don't think it's what you want precisely, but it might help you figure out how to do what you want.
Hmm, I see. I'm not gonna mark this as solved just yet, cause that is a pretty big issue cause my game has a lot of stat debuff stuff too, heh. 😛 Thank you very much for the help nonetheless; if anyone else could help figure out how to get debuffs to work in the same manner, it would be appreciated!
Great advice from @Solar_Flare here.

One way to test how stacking will work is to make a skill whose formula is simply the stat you're testing - so in this case a.agi would be the entire formula. Give that skill 0 variance, make sure it cannot Crit, make sure Elemental Rates aren't affecting anything, and then get into battle and see how much damage the character deals, then apply the buffs/debuffs/states and see how much damage they deal afterwards. If you want to make the job even easier, make sure the character's stat is exactly 100 before applying the buffs/debuffs/states.

As far as the math with buffs and debuffs using additive stacking, I think the mathematical logic you're going for would be 1.00 + the sum of (each rate - 1). In other words, if the editor is showing a 110% rate (+10% buff), a 250% rate (+150% buff), and a 60% rate (-40% debuff), then the total rate for the player would be 100% + 10% + 150% - 40% = 220% (which is a total 120% buff).

I'm not totally sure, but I'd speculate the Return line for that would be:
return 1 + this.traitsSum(Game_BattlerBase.TRAIT_PARAM - 1.00, paramId);
TRAIT_PARAM is a constant that identifies a param rate trait, so subtracting from it definitely won't give the correct answer... rather than traitsSum or traitsPi, I think you'd probably have to use a manual reduce on traitObjects or traitsSet for what you describe.
Hmm, yeah, the way you describe the actual math stuff seems about right. It's just the trouble of actually figuring out how to implement it. ^^;

Original thread: https://forums.rpgmakerweb.com/threads/stackable-parameter-buffs-on-states.124434/