I have a simple MP regen perk that uses vanilla events to function I suddenly realized today that it's not working and I'm stumped because this was working fine when I tested it a while ago. The perk is supposed to restore 14% of the characters MP at the start of every battle but instead it's setting their MP to 14% of their Max MP. Merry Christmas :hhappy:
MV MP regen perk
RPG Maker MV SupportPresumably it was always broken. Your formula is as follows:
Look closely. The first and third terms cancel out, and you're left with just:
Thus, no matter what, their MP is set to exactly 14% of their max MP.
If you want them always gain amount equal to exactly 14% of their max MP, then just delete the
Code:
Ace.mp = Ace.mp + (((Ace.mmp * 14) / 100) - Ace.mp)
Ace.mp = Ace.mp + (Ace.mmp * 0.14) - Ace.mp
Look closely. The first and third terms cancel out, and you're left with just:
Code:
Ace.mp = (Ace.mmp * 0.14)
Thus, no matter what, their MP is set to exactly 14% of their max MP.
If you want them always gain amount equal to exactly 14% of their max MP, then just delete the
-= MP of Ace part.To explain it with other words, you are doing :
- MP Regen = Ace MP (Say 100)
- MP Regen = 100 * 14 (1400)
- MP Regen = 1400 / 100 (14)
- MP Regen = 14 - 100 (-86)
Then you apply the change :
- Change MP => Ace MP (100) + MP Regen (-86)
=> 100 + -86 = 14
It's the same as Solar Flare said, but presented as you put it in your event, to give you the general idea.
The last part is too much :
- MP Regen = 14 - 100 (-86) => (Mp Regen - Ace Mp)
You are using the MP regen to calculate how much MP should be given, the result does not need to be corrected at the end.
- MP Regen = Ace MP (Say 100)
- MP Regen = 100 * 14 (1400)
- MP Regen = 1400 / 100 (14)
- MP Regen = 14 - 100 (-86)
Then you apply the change :
- Change MP => Ace MP (100) + MP Regen (-86)
=> 100 + -86 = 14
It's the same as Solar Flare said, but presented as you put it in your event, to give you the general idea.
The last part is too much :
- MP Regen = 14 - 100 (-86) => (Mp Regen - Ace Mp)
You are using the MP regen to calculate how much MP should be given, the result does not need to be corrected at the end.
It worked, thanks.
Original thread: https://forums.rpgmakerweb.com/threads/mp-regen-perk.181605/