Hi, I'm in need of a script (most likely a single line of code to be used in an event) to allow me to multiply and divide variable and get decimal answers, or set a variable to a decimal value (This is in both RMVX and RMXP). But RPG Maker just seems to round it down whenever I try this...:/
So I need a line of code or a script modification that stops the rounding down, or bypasses it or something.
Thanks for your help!
$game_variables[ID] = 5 / 2.0
Result would be 2.5
you must add a ".to_f" at the end of one of those numbers.
Quote from: game_guy on March 28, 2011, 07:37:38 pm
you must add a ".to_f" at the end of one of those numbers.
It's not needed as 2.0 is a float. If anything it would be 5.to_f as 2.0.to_f is redundant, but the conversion happens automatically.
Not sure what happens if you try to multiply or divide a Bignum with a Float though-