Skills that damage both HP, MP, and TP, or all of those in one

Is there any way to make a skill that damages multiple stats at once, and not just either HP or MP? I wanted to at least make a skill that damages HP and also MP relative to the amount of damage inflicted. I tried utilizing formulas:
b.mp = 0 ? a.atk-b.def : a.atk-b.def b.gainMp(-(a.atk-b.def))
but all it returned was 0.
Any help is appreciated, thank you. c:
your formula needs to be a valid javascript code to work, and the last number processed will be the official damage - so the gain function can't be the last statement.

there is a pinned topic about how to use the damage formula, please read that.
because if done correctly that is the way to handle things like that.

unless you want to go the plugin route and place the code in notetags for the plugin to read (which has some advantages but requires a correc tly configured plugin)
your formula needs to be a valid javascript code to work, and the last number processed will be the official damage - so the gain function can't be the last statement.

there is a pinned topic about how to use the damage formula, please read that.
because if done correctly that is the way to handle things like that.

unless you want to go the plugin route and place the code in notetags for the plugin to read (which has some advantages but requires a correc tly configured plugin)
ah. i actually read a buncha damage formula threads weeks ago, but i suppose i just didn't read them well enough. i'll check, thanks
b.mp = 0 ? a.atk-b.def : a.atk-b.def b.gainMp(-(a.atk-b.def))
You're missing a semicolon before b.gainMp(stuff), but even then it would probably not work as intended. IIRC, the damage itself needs to be the last line of the code. So something like this:

JavaScript:
b.mp != 0 ? b.gainMp(-(a.atk-b.def)):''; a.atk-b.def

Note that the damage will return as 0 when the calculation has an error.
You're missing a semicolon before b.gainMp(stuff), but even then it would probably not work as intended.
They are recommended for organizational purposes, but semicolons are technically optional in JavaScript.

There are more serious syntax errors in the OP, such as trying to set the value of the read-only property mp, and returning the value of a function that has no return value.

JavaScript:
b.mp != 0 ? b.gainMp(-(a.atk-b.def)):''; a.atk-b.def
It doesn't hurt anything, but I don't see the point in using a ternary operator when there's no second outcome. Why not simply
Code:
if (b.mp > 0) b.gainMp(-(a.atk - b.def))

Original thread: https://forums.rpgmakerweb.com/threads/skills-that-damage-both-hp-mp-and-tp-or-all-of-those-in-one.173341/