help Is it possible to make the basic attack deal damage to enemy and restore manna points ?

Is it possible to make the basic attack deal damage to enemy and restore manna points to the person using
is to restore 5% MP

1684323746740.png
Add a common event call to the attack skill and have it restore 5% mana 😀

I'm sure there's some plugin that could do it, but that's how I'd do it out of the box.
Better than Iron_Brew's method and still without using a plugin, you can append it to the attack formula like so:
a.gainMp([insert formula to determine amount restored]); [after the semicolon, insert standard formula for determining damage of the attack]
5% mp would be a.mmp * 0.05

The reason why you would want to do it this way and not the common event method is because the common event method will not make the MP restore pop-up numbers appear. Will it work? Yes. Will it provide adequate feedback to your player? probably not.
Putting it into the formula will allow mp restore pop-up numbers to appear.
Better than Iron_Brew's method and still without using a plugin, you can append it to the attack formula like so:
a.gainMp([insert formula to determine amount restored]); [after the semicolon, insert standard formula for determining damage of the attack]
5% mp would be a.mmp * 0.05

The reason why you would want to do it this way and not the common event method is because the common event method will not make the MP restore pop-up numbers appear. Will it work? Yes. Will it provide adequate feedback to your player? probably not.
Putting it into the formula will allow mp restore pop-up numbers to appear.
you beat me to the reply about the damage formula as i was typing it, but i was going to include that if they were going to use auto battle in any way, theyd probably want to use the common event anyways. They run the risk of getting that bug where the gainMp function runs even if attack isnt used and every action the auto battler does would regen mp without getting a separate plugin or modifying RM's code directly to fix it
@TheAM-Dol @Robro33 Even without auto battle, you probably wouldn't want to do it that way.

Unless you have a separate Attack skill that enemies use (and you don't want them to get this functionality), that code will be executed every time it's an enemy's turn and they're evaluating their choices in their attack pattern.

So they'd be regenerating MP every turn, which could affect other battle mechanics if enemies cast spells and are expected to have limited MP for it.

If all of that doesn't matter...then yes, sticking it into the damage formula is fine 🙂
Better than Iron_Brew's method and still without using a plugin, you can append it to the attack formula like so:
a.gainMp([insert formula to determine amount restored]); [after the semicolon, insert standard formula for determining damage of the attack]
5% mp would be a.mmp * 0.05

The reason why you would want to do it this way and not the common event method is because the common event method will not make the MP restore pop-up numbers appear. Will it work? Yes. Will it provide adequate feedback to your player? probably not.
Putting it into the formula will allow mp restore pop-up numbers to appear.
Works halfway
1684338587370.png
1684338600266.png
I would like such a formula
1684338692736.png
is it possible to make it show without decimals

Works halfwayView attachment 262103View attachment 262104 I would like such a formulaView attachment 262105 is it possible to make it show without decimals
a.gainMp(Math.ceil(a.mmp * .05))
a.gainMp(Math.ceil(a.mmp * .05))
1684339271570.png
not working
Copy what you have in the reply from me. The a. in a.mmp is missing In your formula box. A few seconds after I made the first post i edited it because my phone's autocorrect is a touch overaggressive and removed the a. Initially
Copy what you have in the reply from me. The a. in a.mmp is missing In your formula box. A few seconds after I made the first post i edited it because my phone's autocorrect is a touch overaggressive and removed the a. Initially
Thank you very much for your help Works perfectly

Overall thank you to everyone on this forum who helped me

Better than Iron_Brew's method and still without using a plugin, you can append it to the attack formula like so:
a.gainMp([insert formula to determine amount restored]); [after the semicolon, insert standard formula for determining damage of the attack]
5% mp would be a.mmp * 0.05

The reason why you would want to do it this way and not the common event method is because the common event method will not make the MP restore pop-up numbers appear. Will it work? Yes. Will it provide adequate feedback to your player? probably not.
Putting it into the formula will allow mp restore pop-up numbers to appear.
Thank you very much for your help
Unless you have a separate Attack skill that enemies use
My game does, so it was a oversight on my part, but I'm sure the OP would have figured that out pretty quickly anyways 😛
just add a restore mana event to the attack.

Original thread: https://forums.rpgmakerweb.com/threads/help-is-it-possible-to-make-the-basic-attack-deal-damage-to-enemy-and-restore-manna-points.157590/