Restoring X MP per turn

Hello,

I would like a way for a state to restore "2 MP" per turn, regardless of the actor's max mp. The mp regeneration ex-parameter is based on a % value, so doesn't work if actors have different max MPs, or when armor and weapons increase or decrease an actor's MP. I could calculate the actor's max MP and then inflict them with one of many different states, but that seems extremely cumbersome. Any better ideas?

Thanks
You can use a troop event for that. Have your skill apply a state that does nothing then use a script call in your troop event (each turn at the end of turn). The script call should contain the following code:
Code:
$gameParty.members().forEach(function(member) {
  if (member.isStateAffected(state_id)) {
    member.gainMp(2);
  }
});
You should change "state_id" to be the id of your state.
Cheers mate, that looks like it should work.

Edit: Worked. Kind of embarrassed it didn't occur to me. I don't even need a troop event, I already have a common event that runs at the end of each turn thanks to a passive state and yanfly's plugins. I just needed to add that script in there.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/restoring-x-mp-per-turn.107744/