damage formula for a skill that restores MP to the user if it lands?

I have a physical attack skills that deals 1 damage. I want 1 MP to be restored to the user only if the attack successfully hits. How would I write this in the damage formula?
JavaScript:
(damage formula); a.gainMp(1)

Damage formula are only evaluated when the skill hits so that part is moot. As long as no battlers in your game uses the autobattle function, you are good.
JavaScript:
(damage formula); a.gainMp(1)

Damage formula are only evaluated when the skill hits so that part is moot. As long as no battlers in your game uses the autobattle function, you are good.
Thank you. I thought i already tried this but I must have typed it out wrong. It works now. Thanks for the quick response 🙂

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-for-a-skill-that-restores-mp-to-the-user-if-it-lands.181434/