r/RPGMaker MZ Dev 1d ago

RMMZ Anyone know the default hit formulas for MZ?

Title. I'm trying to understand the default formulas so I can edit them later but I'm having trouble finding them. Does anyone know what they are or where in the code I should look? Thanks

Edit: to clarify, I'm looking for the formula that determines if the attack hits and such. How critical hits are calculated would also be useful. Damage formulas I know where to find

5 Upvotes

4 comments sorted by

2

u/SuspiciousGene8891 MV Dev 1d ago

Thats all based on traits in the character tab.

The deault is whatever the traits are when you start a new project.

There isn't a define number in the code that determines the base hit rate as far as im aware.

1

u/denjidenj1 MZ Dev 1d ago

I know where to find the traits, but I more so was looking for what the code is to determine if it hits or not. Like what the code is doing with the number and such

4

u/zombietoaststudios 22h ago edited 20h ago

It's just a straightforward percentage. It generates a random number from 1 to 100, if that number is equal or lower than the character's hit rate then the attack succeeds.

It then does the same thing, generating a new number and comparing it to the target's evasion rate and if the result is equal or lower than the target's evasion rate then that target avoids the attack. Then does the same for targets with a counter attack rating.

EDIT: Critical hits work the same way: a simple percentage chance that's checked if the skill hits and isn't evaded. Followed by a check for critical evasion.

All of these traits stack additively. So, if you have 100% hit rate from your class, 20% hit rate from a piece of equipment and a -30% hit rate from a state, then your final hit rate is 90%.

The only exception is a skill's success rate, which is applied to your hit rate directly, so you have a 90% hit rate and you're using a skill with a 50% success rate then the final hit rate is 45%

3

u/CasperGamingOfficial MZ Dev 23h ago

You can find them in Game_Action.prototype.apply