Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - [Request]auto heal when level up

The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: D3wil666 on March 03, 2009, 04:47:23 PM

Title: [Request]auto heal when level up
Post by: D3wil666 on March 03, 2009, 04:47:23 PM
i need script as lv up hp and sp restore.
Title: Re: [Request]auto heal when level up
Post by: tSwitch on March 03, 2009, 05:10:10 PM
Tons of Addons (http://forum.chaos-project.com/index.php?topic=105.0)

learn to use google.
5th result down when searching for 'Actor heal on Level up RMXP'
Title: Re: [Request]auto heal when level up
Post by: 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
Title: Re: [Request]auto heal when level up
Post by: tSwitch on March 03, 2009, 08:47:33 PM
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.
Title: Re: [Request]auto heal when level up
Post by: 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.

[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]
Title: Re: [Request]auto heal when level up
Post by: tSwitch on March 05, 2009, 01:47:14 PM
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 :(