So basically the engine provides us with the ability to have states that alter percentages of parameters (attack * 100%) but doesn't allow for specific values (attack +1) like equipment does.
I tried to follow how the states are handled but i'm a junior in JS so i got lost before i could reach the source. My solution was to change how it handles the multiplication and do an addition instead. I even tried looking at the states object in the console.log but the only thing i found was a "traits" property. I tried changing the traits but the parameter wouldn't be affected - it seems it must be "refreshed" somehow. But still, i think i'm looking at it the wrong way.
Does anyone know how to have a state affect a parameter using additions/subtractions rather than multiplication? Even if all the states will be changed to behave this way.
EDIT: I'm not talking about the battle scene. I'm talking about getting a state outside it. For example, if you haven't eaten for too long, you get a "hungry" state, which lowers specific values of your stats (for example -1 def). It will only be removed manually.
EDIT:
Found it!!!!
Code:
Game_BattlerBase.prototype.param = function(paramId) {
var value = this.paramBase(paramId) + this.paramPlus(paramId);
value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
var maxValue = this.paramMax(paramId);
var minValue = this.paramMin(paramId);
return Math.round(value.clamp(minValue, maxValue));
};
See this function? This is what changes the parameter. So instead of "value*=" if you write "value+=" you get the result of the percentage ADDED.
This means that if your state has a trait of "attack 100%" it will add 1. 200% will add 2, etc.
However, in this manner, you will replace the behavior of ALL states, ALL traits. So handle with care. In my case, that's exactly what i wanted to do.
EDIT on the previous EDIT: It seems that i had to also change this:
Code:
Game_BattlerBase.prototype.traitsPi = function (code, id) {
return this.traitsWithId(code, id).reduce(function (r, trait) {
return r * trait.value;
}, 1);
};
and replace * with +
Take ultra care when changing these. In my game i am making my own systems/mechanics and most likely these functions affect how enemies behave as well. In my game these changes will not clash with anything else, but in your games they might.
However, i even used 2 states (500% each) and removed them to check what it does to the parameters. It seems that in each case, 5 was added with each state and then 5 was reduced with their removal. So it SEEMS to be working as intended. If i come across bugs or errors i will edit this post to let you know.