hexedronin

Villager
Member
Joined
May 29, 2016
Messages
19
Reaction score
0
First Language
English
Primarily Uses
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?
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
997
Reaction score
852
First Language
English
Primarily Uses
N/A
This 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)
 
Last edited by a moderator:

hexedronin

Villager
Member
Joined
May 29, 2016
Messages
19
Reaction score
0
First Language
English
Primarily Uses
Thanks! this was exactly what I was looking for!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,510
Reaction score
12,013
First Language
English
Primarily Uses
RMVXA
"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.
 

Latest Threads

Latest Posts

Latest Profile Posts

At work.
Co: "This bug drove me insane. I tried a lot of things to debug, it just stuck".
Me: "How did you debug it?"
Co: *shows a complicated debugging method using breakpoints and everything*
Me: "What about ... " *casually prints a stack trace in the try/catch exception
Co: "Wait, you can do that??"
Totally original and unique OC
Harold.png
So after completing the Mass Effect Trilogy the first time as a Vanguard, I decided to replay the trilogy as a Soldier. Thus far, I've just finished the Horizon mission in ME2, and I'm already exhausted from ME2's f**k-awful enemy design.
Yeah, now Yes !!!! "boom boom "
"Fire the monsters, guards!!!"

index.php
I can't stop buying resource packs I'll never use, or engines for that matter, or free resources as my two terabyte external will attest. I am a digital hoarder I guess. Some people get drunk off the silly juice when they are bored, I just buy shiny digital nonsense I don't need.

Forum statistics

Threads
118,649
Messages
1,117,552
Members
155,751
Latest member
astralclutter
Top