Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Lazy Recovery VXP

Lazy Recovery XP - VX
by Kyonides-Arkanthos


Features

It lets your hero(es) start recovering some HP and SP (continuously) if you don't move your character for a couple of frames. The more you wait the more you recover. The character will also change to reflect his laziness.

Instructions

Make sure you got a 001-Some_actor_resting.png sprite in your Characters folder so you won't get any error messages... or look for the CHANGE_ENABLED Constant and set its value to false so your hero sprite won't ever change.

SCRIPTS

XP
[rgss]#  Lazy Recovery XP - LR-XP
#  by Kyonides-Arkanthos
#  08.23.2010
 
class Game_Player
  CHANGE_ENABLED = true
  FRAMES = [240, 40]
  attr_writer :char_name
  alias kyon_sitdown_gm_player_init initialize
  alias kyon_sitdown_gm_player_upd update
  def initialize
    kyon_sitdown_gm_player_init
    @frame_count = [0, FRAMES[0]]
  end
 
  def update
    change_state_graphic
    kyon_sitdown_gm_player_upd
  end
 
  def change_state_graphic
    if moving? or @move_route_forcing or $game_temp.message_window_showing
      return if @frame_count[1] == FRAMES[0]
      @character_name = @char_name if CHANGE_ENABLED
      @frame_count = [0, FRAMES[0]]
    else
      if @character_name != @char_name + '_resting'
        @frame_count[1] -= 1
      else
        @frame_count[0] += 1
        return unless @frame_count[0] == FRAMES[1]
        $game_party.actors.each {|a| a.recover}
        @frame_count[0] = 0
      end
      return unless @frame_count[0] == @frame_count[1]
      @character_name = @char_name + '_resting' if CHANGE_ENABLED
    end
  end
end
 
class Game_Actor
  def recover
    return if @hp == 0
    hp, sp = self.maxhp / 200, self.maxsp / 200
    @hp, @sp = [@hp + hp, self.maxhp].min, [@sp + sp, self.maxsp].min
  end
end
 
class Scene_Title
  alias kyon_sitdown_scn_title_cng command_new_game
  def command_new_game
    kyon_sitdown_scn_title_cng
    $game_player.char_name = $game_party.actors[0].character_name
  end
end
[/rgss]

VX
[rgss]#  Lazy Recovery VX - LR-VX
#  by Kyonides-Arkanthos
#  08.23.2010
 
class Game_Player
  CHANGE_ENABLED = true
  FRAMES = [240, 40]
  attr_writer :char_name
  alias kyon_sitdown_gm_player_init initialize
  alias kyon_sitdown_gm_player_upd update
  def initialize
    kyon_sitdown_gm_player_init
    @frame_count = [0, FRAMES[0]]
  end
 
  def update
    change_state_graphic
    kyon_sitdown_gm_player_upd
  end
 
  def change_state_graphic
    if moving? or @move_route_forcing or $game_message.visible
      return if @frame_count[1] == FRAMES[0]
      @character_name = @char_name if CHANGE_ENABLED
      @frame_count = [0, FRAMES[0]]
    else
      if @character_name != @char_name + '_resting'
        @frame_count[1] -= 1
      else
        @frame_count[0] += 1
        return unless @frame_count[0] == FRAMES[1]
        $game_party.members.each {|a| a.recover}
        @frame_count[0] = 0
      end
      return unless @frame_count[0] == @frame_count[1]
      @character_name = @char_name + '_resting' if CHANGE_ENABLED
    end
  end
end
 
class Game_Actor
  def recover
    return if @hp == 0
    hp, mp = self.maxhp / 200, self.maxmp / 200
    @hp, @mp = [@hp + hp, self.maxhp].min, [@mp + mp, self.maxmp].min
  end
end
 
class Scene_Title
  alias kyon_sitdown_scn_title_cng command_new_game
  def command_new_game
    kyon_sitdown_scn_title_cng
    $game_player.char_name = $game_party.members[0].character_name
  end
end
[/rgss]

Author's Notes

I know this can be easily evented, but who cares? Besides I'm lacking of inspiration lately.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top