How To Make A Skill That Does Guarantee Critical When A State Is Applied

Hi, so I'm still pretty new to RPG MV and I've still been having trouble figuring out simple things and adding in new things for my game. One of things I wanted to add to my game were weapons and equipment that have different effects.
Right now what I'm working on is, a skill that does a guaranteed critical hit when an enemy is afflicted with a state? Do I need a plugin or can I do it through common events? Please help!
Try using something like this for your skill's damage formula:

var dmg = a.atk * 4 - b.def * 2; if (b.isStateAffected(123)) b.result().critical = true, dmg = this.applyCritical(dmg); dmg
I.e.
  • Calculate a.atk * 4 - b.def * 2 and store it in a temporary variable called dmg;
  • Check if the target is affected by state ID 123, and if so;
    • Set the target's result to a critical hit (affects messages/visuals), and
    • Apply the critical damage modifier to dmg;
  • Return the value of dmg.
You'll probably want to change the parts in bold. 👋
Try using something like this for your skill's damage formula:

var dmg = a.atk * 4 - b.def * 2; if (b.isStateAffected(123)) b.result().critical = true, dmg = this.applyCritical(dmg); dmg

I.e.
  • Calculate a.atk * 4 - b.def * 2 and store it in a temporary variable called dmg;
  • Check if the target is affected by state ID 123, and if so;
    • Set the target's result to a critical hit (affects messages/visuals), and
    • Apply the critical damage modifier to dmg;
  • Return the value of dmg.
You'll probably want to change the parts in bold. 👋
Oh thanks I'll test it out! ☺️
Let me know if you have trouble getting it working!

If/when your problem is solved, feel free to report your post with a reason like "Solved". This brings it to the attention of the moderators, who can close the thread. 👋
Solved

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-skill-that-does-guarantee-critical-when-a-state-is-applied.145327/