Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = Math.floor(value);
}
this._data[variableId] = value;
this.onChange();
}
};
As stated, using $gameVariables.add truncates any number put into it. Is there any particular reason? This comes up from someone else asking how they can use a floating point number with a variable and assigning it with a bit of script did not work (obviously).
I have to say, I really really dislike truncation. If there's some reason it absolutely needs to be an integer, I feel like it should be rounding, at least. But that's the real question - is an integer really needed? Is there some strange thing that would break if it didn't get an integer or something? Seems like a strange choice to me.