Damage formula not giving critical hit

I am trying to make a skill that will guarantee a critical hit. I kept the actual damage bit vanilla to reduce any complications, but it doesn't seem to be causing a crit to happen.

The formula I've got is
target.result().critical = true; this.applyCritical(a.atk * 4 - b.def * 2)

I've also tried simply
target.result().critical = true; this.applyCritical(a.atk * 4 - b.def * 2)
but that didn't produce a result either.

Can anyone tell me what I've done wrong?

Thank you.
I just realised I wrote target in that thread, rather than b. Luckily for me, they're interchangeable in the damage formula, at least in the core scripts.

The second part, this.applyCritical(etc), should generally not cause any problems: it simply applies the critical damage modifier. The first part flags the result as a crit, which should cause all the usual crit effects to display, i.e. popup flash and crit message in the log.

Things to check/try:
  1. Try this damage formula:

    b.result().critical = true; this.applyCritical(10)
    Check how much damage that does, e.g. 10 or 30? This helps you to narrow down the precise problem, e.g. use of target in the formula, or crit damage calculation/display.

  2. If you turn off all your plugins, save your project to apply Plugin Manager changes, then test, does the skill always crit? If so, it's something related to the plugins you're using, maybe something that allows you to customise the crit damage multiplier.
@caethyril That new formula seems to work. Somewhere in one of my VS plugins I must have something about the value of the crit because it in fact did 20. But I got the colour popup etc., so I know the crit landed.

Thank you for your help.
Ah, that makes sense. I expect one of the VisuStella plugins renames target there.

You're welcome, happy RPG Making! 👋
This thread is closed due to being reported as solved. If you need it reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-not-giving-critical-hit.176403/