Heal HP/MP every X step.

Ok so title says all.

I`ve been crackin my head trying to make this by events by touching variables and conditions.

Im pretty sure it can be done via events but I cant seem to find a way.

What I`m looking for is to make characters heal fixed x ammount by every y steps. (Not %)

Any help for this poor fella here would be great.
I managed to set it up so that everyone regenerated 1 MP per combat round with this code.

Spoiler
 class Game_Battler < Game_BattlerBase #MP Regen Overwrite. This overwrites the MP Regen system so everyone gains #1 MP per round of combat. def regenerate_mp @result.mp_damage = -(mmp * mrg).to_i @result.mp_damage -= 1 self.mp -= @result.mp_damage endend
This sets it up so that the default MPRegen for % based is still there (for equips and such), and then you change 1 to whatever you want for MP.

Since the game treats it as one combat round passes after x steps (15 or 20 I think?) this would effectively make it so that MP regenerates by 1 every x steps. A similar edit to the def hp_regenerate command would do the same with hp.

Note this also kicks in during combat! If you want it only outside of combat, that would take a much more advanced edit (and one I'm not sure how to do, though maybe just a check of if you are in battle before applying the last line would do it?).
I managed to set it up so that everyone regenerated 1 MP per combat round with this code.

Spoiler
 class Game_Battler < Game_BattlerBase #MP Regen Overwrite. This overwrites the MP Regen system so everyone gains #1 MP per round of combat. def regenerate_mp @result.mp_damage = -(mmp * mrg).to_i @result.mp_damage -= 1 self.mp -= @result.mp_damage endend
Spoiler
This sets it up so that the default MPRegen for % based is still there (for equips and such), and then you change 1 to whatever you want for MP.

Since the game treats it as one combat round passes after x steps (15 or 20 I think?) this would effectively make it so that MP regenerates by 1 every x steps. A similar edit to the def hp_regenerate command would do the same with hp.

Note this also kicks in during combat! If you want it only outside of combat, that would take a much more advanced edit (and one I'm not sure how to do, though maybe just a check of if you are in battle before applying the last line would do it?).
I appreciate your help sir but what Im looking for is x heal for y steps outside battle.

I messed  with if $game_party.in_battle but no luck.
def regenerate_mp @result.mp_damage = -(mmp * mrg).to_i if(in battle) @result.mp_damage -= 1 end self.mp -= @result.mp_damage endThe idea will work with some edits. I don't remember the command for seeing if the party is in battle or not either right now, but once we know it, replace where I put in_battle in the code with the correct script code, it should then work only outside of battle (the lines above it are the default code, so we want that unchanged). Then change 1 to whatever you want the fixed MP regenerate to be.
No errors happened whoever no regen happened either (outside and inside battle)

  def regenerate_mp
    @result.mp_damage = -(mmp * mrg).to_i
    if($game_party.in_battle)
      @result.mp_damage -= 1
    end
    self.mp -= @result.mp_damage
  end


btw, what to_i means?
to_I means convert the result to an integer. Without it, you would see people regenerate 0.65 MP.

Ok, the way you entered it, it will only regenerate 1 MP when in battle. We need the opposite of the party in battle. My bad. Will

!$game_party.in_battle work?
You don't need a script to do this.  Just have a common event set to Parallel Process and conditioned by a switch that's turned on at the beginning of the game:

Control Variables: [0055: Player Steps] = Game Data > Other > StepsConditional Branch: Variables [0055: Player Steps] <> Variables [0056: Last Player Steps]  Control Variables: [0056: Last Player Steps] = Variable [0055: Player Steps]  Control Variables: [0055: Player Steps] /= 3  Conditional Branch: Variables [0055: Player Steps] == 0    Change HP: Entire Party: + 1  Branch EndBranch EndWait 10 Frames
What's happening here is that it's keeping track of # steps in 2 variables.  One is the current step count each time this check is done, and the other is the "old" step count.  They are compared, to see if the player has actually taken a step.  If they have, the "old" counter is updated, and the "new" counter then just becomes a variable to muck around with.  It does a /= 3 (mod 3) to see if 3 steps have been taken, and if they have, adds 1 HP to all party members.

Change the 3 to however many steps you want the player to take before HP is increased.  Change the +1 to however many HP you want to give at that step count.  And replace variables 55 and 56 with whatever you have available.
I made a few adjustments and everything is working fine, thanks guys!

Solved.
If you or someone else want a kick solution, just insert this script:

Code:
class Game_Party    alias leregenpersteps_increase_steps increase_steps  def increase_steps    leregenpersteps_increase_steps    return unless @steps % X == 0 # <---- X is number of steps    $game_party.members.each { |m|      m.hp += Y # <--- Y is HP regen      m.mp += Z # <--- Z is MP regen    }  end  end
Nice add Lecode, looks very simple, thanks!

The thing is that characters get revived with your regen.

What can i do to make characters not regen when they are dead?
use $game_party.alive_members instead of $game_party.members
All working, I hope this script helps people who need the same thing as I did.

Thanks for everything guys!

Original thread: https://forums.rpgmakerweb.com/threads/heal-hp-mp-every-x-step.45180/