MZ Js code to test hp!=mhp?

I tried this but it didn't work.
The correct syntax probably doesn't use the b used in damage formulas...

<JS Pre-Damage>
if (b.hp != b.mhp) a.addState(1);
</JS Pre-Damage>
What plugin?

Try !== instead of just !=

or b.hpRate() < 1
Remember to save your project to apply plugin changes before testing!

If this is VisuStella Battle Core, then:
  • I think that what you've written should work unless you have edited the Mechanics Settings -> JS: Pre-Damage parameter (i.e. the code that determines how these notetags are processed).

  • You might want to consider using <JS Pre-Damage as User> or <JS Pre-Damage as Target> here.
Thank you both!
b.hpRate() < 1 -> this works like a charm!

That said what if the healing spell targets all characters, what kind of formula could you use (if any) to check the allegedly complex assertion:
at least one character has lost HP
Or I'll be fine with the reverse one too:
All characters are fully healed (maybe this one is actually easier for me to use actually)

Original thread: https://forums.rpgmakerweb.com/threads/js-code-to-test-hp-mhp.137341/