How to do damage while changing variable in attack formula?

So I have a skill that's supposed to do damage while also change a variable to the actor who used the skill but idk how to do both in the attack formula, only the variable gets changed and deals 0 damage for some reason.
help im new to this
1685737133096.png
You should read up on how damage formulae work:

The most important part is that the last number in your formula is always what gets used for the damage. Since saying "this equals this" isn't a number, that's why your damage is 0.

The other thing that's worth mentioning is that, depending on some of your game mechanics, it's not good to put things like this in the damage formula.

If you ever use the auto-battle trait, or give this skill to enemies, the code in your damage formula gets run without the skill being used. So you might get that variable set to unexpected things.

All that being said, if you want to do this and deal damage equal to the actor's current MP, just swap the order.
Code:
v[3]=a.actorId(); a.mp
ah you're right, i forgot that's how it went
thanks
Since saying "this equals this" isn't a number, that's why your damage is 0.
Minor correction: in JavaScript, assignment (e.g. v[3] = a.actorId()) returns the assigned value. Details:
The damage was zero in this case because of an error: a.mp is not a function. The brackets got interpreted as enclosing inputs of a function named a.mp. When a damage formula results in an error or non-numerical value, the core scripts return 0 instead.
Minor correction: in JavaScript, assignment (e.g. v[3] = a.actorId()) returns the assigned value.
Good to know. So if the OP had put a semicolon after the first statement of a.mp (as I demonstrated above), it would still have not worked as intended, but wouldn't have errored out to 0 😉

Original thread: https://forums.rpgmakerweb.com/threads/how-to-do-damage-while-changing-variable-in-attack-formula.158017/