[RMVX ACE] HOW CAN I ROUND UP/DOWN VARIABLES?
Posts
Pages:
1
Is there a way to round up variables in VX Ace? Either with events or with scripts? I'm having an issue with my stealth system where rounding up/down variables would probably be the solution.
I hope I'm not being too vague with this request.
I hope I'm not being too vague with this request.
Here is a tutorial that will probably help you figure out what you're doing. This tute is for 2003. It'll be the same in VX Ace, but be aware that VX Ace doesn't use pointers.
https://rpgmaker.net/tutorials/479/
This next one will not solve your particular problem, but it is the elementary tutorial on variables and switches that everyone should read at least once.
https://rpgmaker.net/tutorials/601/
https://rpgmaker.net/tutorials/479/
This next one will not solve your particular problem, but it is the elementary tutorial on variables and switches that everyone should read at least once.
https://rpgmaker.net/tutorials/601/
Script Call:
X is the variable ID
y is how many decimal places you want to show.
You could also tryWhich converts a number with decimal to a whole number.
$game_variables[x].round[y]
X is the variable ID
y is how many decimal places you want to show.
You could also try
$game_variables[x].to_i
Thanks Pianotm. I arleady know that trigonometry tutorial very well, someone recommended it to me some time ago and it has been very helpful for what I'm trying to achieve.
Thanks Kaneshon, but those scripts sadly don't help me.
This one doesn't even work, it always turns the variable into a zero. Maybe I'm doing something wrong.
This one just takes away the decimal part, put I want to round up/down acordingly, like so: 1.5 = 1 ; 1.6 = 2
Thanks Kaneshon, but those scripts sadly don't help me.
$game_variables[x].round[y]
This one doesn't even work, it always turns the variable into a zero. Maybe I'm doing something wrong.
$game_variables[x].to_i
This one just takes away the decimal part, put I want to round up/down acordingly, like so: 1.5 = 1 ; 1.6 = 2
Can you add another decimal place so that your variables are 10s instead of 1s? Then 15 = off and 16 = on?
The square brackets after round should be parenthesis, square brackets are for an array dereference, parenthesis are for passing parameters, so:
or
if you just want to do normal rounding with the decimal value. Here's the rubydoc's documentation on rounding.
$game_variables[x].round(y)
or
$game_variables[x].round
if you just want to do normal rounding with the decimal value. Here's the rubydoc's documentation on rounding.
author=GreatRedSpirit
The square brackets after round should be parenthesis, square brackets are for an array dereference, parenthesis are for passing parameters, so:$game_variables[x].round(y)
or$game_variables[x].round
if you just want to do normal rounding with the decimal value. Here's the rubydoc's documentation on rounding.
Thanks Undyn... err, GreatRedSpirit, now that that script call is working appropiatly and the variables are rounded the right way, my stealth system works!! ^.^ I'm so happy! Thanks to all of you guys! Without you I would be at a loss, I can't wait to finally make progress with my next game, I had been stuck on creating the stealth system for 2+ weeks now.
Now I will also have a reason to make the game page.
Pages:
1















