MZ Prevent display of "0" in custom formulas

Hi to everyone,

I'm using "$gameVariables.setValue(10, a.mp)" in most of my formulas to keep track of the user's MP, then rely on VisuStella's battles sequences to control the flow of battle.

I have however skills that only contain this code, with no value to result.
My question is : How to prevent the display of "0" in the resulting value when such a skill is used ?

So far i've try :
" $gameVariables.setValue(10, a.mp) "
" $gameVariables.setValue(10, a.mp); 0; "
" $gameVariables.setValue(10, a.mp); ''; "
" $gameVariables.setValue(10, a.mp); 'undefined';

All those formulas result in the display of "0" when skill is used.

Any help would be apprecied !

Thanks
Use the JS post-damage/post-apply etc. notetags for this instead of the damage formula.
Use the JS post-damage/post-apply etc. notetags for this instead of the damage formula.

Thanks for your quick answer.
It's related to a VisuStella plugin, isn't it ?

What would then be the JS equivalent of $gameVariables.setValue(10, a.mp) ?
What would then be the JS equivalent of $gameVariables.setValue(10, a.mp)
It would be $gameVariables.setValue(10, a.mp) - it's already JavaScript 😉
I mean if you really wanted to make it javascriptier you could do like

$gameVariables.setValue(10 + 20 / 2 * 0, a.mp * 2 / 2 - a.mp + a.mp)

And yeah, it's part of Battle Core.
What would then be the JS equivalent of $gameVariables.setValue(10, a.mp) ?
The way to do this in damage formulae without using the direct script call would've been by using the accessor for variables that you see when you mouse over the damage formula window.
Code:
v[10] = a.mp

But even that is still JavaScript, the entire damage formula is.

Just as a side note, if you're not already using VisuStella plugins and you just want to add this functionality, the Eval Tags plugin in my signature is a lighter weight alternative.
It would be $gameVariables.setValue(10, a.mp) - it's already JavaScript 😉

Oh right ! I thought in wasn't because I know that the "a.smthg" has an equivalent outside of formulas ($subject.smthg).

I mean if you really wanted to make it javascriptier you could do like

$gameVariables.setValue(10 + 20 / 2 * 0, a.mp * 2 / 2 - a.mp + a.mp)

And yeah, it's part of Battle Core.

I see what you did there 😀

The way to do this in damage formulae without using the direct script call would've been by using the accessor for variables that you see when you mouse over the damage formula window.
Code:
v[10] = a.mp

But even that is still JavaScript, the entire damage formula is.

Just as a side note, if you're not already using VisuStella plugins and you just want to add this functionality, the Eval Tags plugin in my signature is a lighter weight alternative.

Ok thanks for the info 🙂
I'm using VS's plugin already, I bought the full waves a while ago, i'll check yours though 🙂
i'll check yours though 🙂
If you've installed and are using VisuStella products you shouldn't, they'll conflict. That's why I mentioned it if you're not already using VisuStella.
I'm currently not 100% sure if the tags in VS_BattleCore still work the same as Yanflys MV equivalents, but if they do:

the <post-damage> tag might only work in conjunction with a damage formula.
the <post-apply> tag should work without a damage formula but might not care if the skill actually hit.
Unless you want to execute the script even when the skill missed/got evaded, you can add
if (b.result().isHit()) { ... } to check if the skill succeeded (does not work with <pre-apply>).

Original thread: https://forums.rpgmakerweb.com/threads/prevent-display-of-0-in-custom-formulas.167186/