RPG Maker Forums

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.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,546
Members
137,835
Latest member
yetisteven
Top