RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Request]auto heal when level up

Started by D3wil666, March 03, 2009, 04:47:23 PM

0 Members and 1 Guest are viewing this topic.

D3wil666

i need script as lv up hp and sp restore.

tSwitch

Tons of Addons

learn to use google.
5th result down when searching for 'Actor heal on Level up RMXP'


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

SolstICE

really big script for just that. might break lots other stuff. what you want is only one line in game_actor. "restore_all" in the gain exp section

tSwitch

Quote from: SolstICE on March 03, 2009, 08:00:02 PM
really big script for just that. might break lots other stuff. what you want is only one line in game_actor. "restore_all" in the gain exp section

Tons of Addons is pretty much compatible with everything, and it's not just that one scriptlet, lol.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

Shinami

Falcon is so going to kick your ass for not putting this in the request section.

[spoiler="Clicky!"]
Place it somewhere above Main and below Game_Actor. I did it right before going to bed and I haven't worked with RMXP in a while but it'll work.

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    old_level=@level
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
    if old_level == @level
      self.hp = self.maxhp
      self.sp = self.maxsp
    end
  end
end

[/spoiler]

tSwitch

Quote from: Shinami on March 05, 2009, 05:19:48 AM
Falcon is so going to kick your ass for not putting this in the request section.

falcon hasn't been around for a few months :(


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon