I made a terrible mistake

When I first started making my game, one of the first things I did was nerf critical hits -- they're far too powerful in the base program -- and I did that by changing this value from 2.0 to 1.5.
upload_2019-1-6_1-46-29.png

This caused a horrifying problem - decimal health; sometimes my characters would have up to 3 digits after the decimal on their health (a playtester said they got around 7 or 8 digits but I don't have evidence of this).
upload_2019-1-6_1-48-25.png

At this point I tried removing critical hits altogether by changing those values further:
upload_2019-1-6_1-50-35.png

I assumed this would prevent critical hits from happening, but now regular attacks still seem to show up as criticals, just without the word "critical" under the damage. And they still do decimal point damage.

At this point it should be clear I have no idea how the script here works. I'm perfectly fine either with a way to round the number to avoid decimals or a way to remove critical hits entirely. Can anyone help me do either of these?
There's a simple solution for disabling Critical Hits but you have to do it for each Skill you use. Check your Database and then go to Skills. Under the Damage Calculation Formula (next to the Variance option), there's an option called Allow Criticals. Set it to No.

Greetings,
Tw0Face
You can replace that line with this to round the damage
Code:
self.damage = (self.damage * 1.5).round
You can replace that line with this to round the damage
Code:
self.damage = (self.damage * 1.5).round
I put that in... my character's critical hit did around 8 times the normal damage for some reason... trying to fix this
Update: I found out the problem.
upload_2019-1-6_4-34-31.png

I removed this little asterisk next to the = sign here. Seems to have completely fixed the issue!
@truthHarbinger I'm not sure that removing that asterisk won't have problems further down the line. You could try this:
self.damage = (self.damage * 1.5).i

That .i makes it a full integer, rather than a decimal.
Update: I found out the problem.View attachment 106426
I removed this little asterisk next to the = sign here. Seems to have completely fixed the issue!
*= is basically multiplying itself with a value
so this
Code:
self.damage *= (self.damage * 1.5).round
equal to this
Code:
self.damage = self.damage * (self.damage * 1.5).round

@truthHarbinger I'm not sure that removing that asterisk won't have problems further down the line. You could try this:
self.damage = (self.damage * 1.5).i

That .i makes it a full integer, rather than a decimal.
I think what you mean is .to_i, there's no .i method.
Thank you all for your help, hopefully I won't run into any further problems!
You're right, that's what I get for doing this on my phone. It should indeed be .to_i
I think the .to_i will fix your problem (assuming you didn't do anything elsewhere that will muck stuff up) but I always just used the same level of precision that I would want the result to be. So I'd do self.damage = (self.damage * 15 / 10) or similar.
It originally was a *=1.0 (multiply a by 1.0 and put the new value into a)
If you turn it into a =1.0 you achieved nothing and you will probably cause many problems for the future. (set the new value of a to be 1.0)

*= is an operator, like +, or - so in order for us to understand it better...
a *=1.0 is eqivalent to a = a * 1.0

But when we say in math a * 1 (a times 1) it gives us a as a result. Right? So why do did the coders made that line here?
It is different to tell
a *=1
than
a *=1.0
because a *= 1 will return a result of the same kind "a" is. If operand "a" is an integer, it will return an integer. If operand "a" is a decimal it will return a decimal.
By multiplying by 1.0 ( a literal decimal that does not change the original value of "a") you make sure that what will be returned will be an integer.
a *= 1.0 always returns a decimal.

This can cause you problems hard to solve in the future, when you will be trying to balance damage and stuff.
It wasn't decimal for no reason. You should follow @Kes suggestion, it's safer.

What you actually did, was instead of setting a to a decimal, you now set it equal to 1.0
That means if operand "a" was 40, now it is set to 1. That line meant to turn 40 into 40.0 so it can have decimals that can be rounded in the future for more accurate formulas I suppose.
You will ruin all the damage system that way. I will pass if that's what you wanna happen though. 😛

Original thread: https://forums.rpgmakerweb.com/threads/i-made-a-terrible-mistake.104111/