- Joined
- Jun 6, 2020
- Messages
- 531
- Reaction score
- 232
- First Language
- English
- Primarily Uses
- RMMV
Code:
Math.min(5, your formula here)
Math.min(5, your formula here)
I was talking about everything in generalMath.min will work in MZ, at least. It's part of core JavaScript.
Are you talking about within the formula or once the formula has ended? Because after the formula is finished, the system automatically rounds the result, because items like HP and TP only accept integers.How would I avoid getting a Decimal in my numbers?
Example; I have a skill that cuts TP in half. But it will leave me with say .5 at times. So
a.setTp(a.tp / 2)
Used at 5 TP will make the user's TP, 2.5. I'd like to avoid that but how?
I'm talking about this.Are you talking about within the formula or once the formula has ended? Because after the formula is finished, the system automatically rounds the result, because items like HP and TP only accept integers.
No that still doesn't seem to work. And it's not a plugin problem before people suggest that, I'm trying this with an empty new project.@MerlinCross
Math.floor( a.setTp(a.tp / 2) ) but preferable way is
Math.floor( a.setTp(a.tp * 0.5) )
And now I just gain a flat 50.Aaahhh now I see where is error:
a.gainTp(Math.floor( a.maxTp()*0.5) )
a.setTp(Math.floor(a.tp / 2))
, or maybe a.gainTp(-Math.floor(a.tp / 2))
.