Crit chance in damage formula

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
2,019
Reaction score
584
First Language
English
Primarily Uses
N/A
In rpg maker vx ace thier was a formula you could put in the damage formula bar thing that could let you add a specific crit chance to the skill. is thier something like this in MZ?

Thank you in advance
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,835
Reaction score
2,176
First Language
EN
Primarily Uses
RMMZ
Maybe something like this (untested):

let r = a.atk * 4 - b.def * 2; if (Math.random() < 0.2) { b.result().critical = true; r = this.applyCritical(r); }; r

  • Store the usual formula result, whatever it is, in a temporary variable named r;
  • Math.random() < 0.2 should be true 20% of the time;
  • b.result().critical = true triggers the crit visual effects/message;
  • r = this.applyCritical(r) applies the normal critical multiplier to r.
    • You could do something like r *= 3 here (i.e. "multiply r by 3") instead if you want.
  • Finally, return the value of r.
I think it has to be done separately like this because the crit result is passed into makeDamageValue as a fixed value, before the formula gets evaluated.
 

vietanhdang2017

Veteran
Veteran
Joined
Sep 16, 2021
Messages
31
Reaction score
14
First Language
English
Primarily Uses
RMMV
I think it's not possible. Crit had been decided before damage calculating
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
2,019
Reaction score
584
First Language
English
Primarily Uses
N/A
Maybe something like this (untested):

let r = a.atk * 4 - b.def * 2; if (Math.random() < 0.2) { b.result().critical = true; r = this.applyCritical(r); }; r
Thanks i'll try this out

@vietanhdang2017 you could in VX Ace
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,230
Reaction score
1,190
First Language
English
Primarily Uses
RMMV
I think it's not possible. Crit had been decided before damage calculating
Just because it was decided doesn't mean it can't be changed, as caethyril did.

And since it being a critical doesn't do anything until after the damage is calculated (you can't print large text of the damage that doesn't exist yet), I suspect this will work.

However, make sure you turn Critical Hits off on the skill page in your database. You wouldn't want the engine to decide it's a critical, multiply the damage, then you multiply it again inside your formula.
 

Latest Threads

Latest Posts

Latest Profile Posts

To be released 2021/10/21
Now that I made this "What the MZ RTP is missing" spreadsheet it's itching me to fill some the gaps D:
Aaaaand I completely forgot about the RMMV Chicken Rave my brother decided to implement in a parody of my VERY FIRST UNFINISHED project. We could not escape the chicken rave... The chickens would block the ladder...
I love how I can look up a problem I'm having with my game, find a post from like six years ago that addresses the issue, and the solution provided still works in RPG Maker.
It's times like those that my life feels really easy XD
Change costumes with equipment!

Forum statistics

Threads
115,949
Messages
1,094,292
Members
151,207
Latest member
majinludde
Top