I want to kind of inflate my numbers so instead of doing 1 damage, do 10 damage. I want to have my HP and MP always round to a 10. is there a way to do that?
rounding numbers?
RPG Maker MV SupportThis can be done easily in programming, what language is your game in? (i.e., which engine? MV?)
I'll assume MV, and that's Javascript. So, this would round any number to the highest 10 (so 12 would be 20, 101 would be 110, etc)
Math.ceil(NUMBER / 10) * 10
edit: also, if you wanted to make it a function:
function toTen(num) {
return Math.ceil(num / 10) * 10
}
so you could round anything to the highest 10 by calling toTen(number)
I'll assume MV, and that's Javascript. So, this would round any number to the highest 10 (so 12 would be 20, 101 would be 110, etc)
Math.ceil(NUMBER / 10) * 10
edit: also, if you wanted to make it a function:
function toTen(num) {
return Math.ceil(num / 10) * 10
}
so you could round anything to the highest 10 by calling toTen(number)
Thanks! this was exactly what I was looking for!
"How do I...?" questions belong in the Support forum for the engine you are using. So,
I've moved this thread to RPGMaker MV. Please be sure to post your threads in the correct forum next time. Thank you.
I've moved this thread to RPGMaker MV. Please be sure to post your threads in the correct forum next time. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/rounding-numbers.64922/