The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Code Geass on June 05, 2008, 08:21:26 PM

Title: [REQUEST] recover when you level up
Post by: Code Geass on June 05, 2008, 08:21:26 PM
I thought this would be easier to find, but I can't seem to find one.

Does anyone know of a simple script that will recover the actor's hp/mp/state when he levels up?
Title: Re: recover when you level up
Post by: Irock on June 05, 2008, 08:39:47 PM
Blizzard's Tons of Add-Ons (http://forum.chaos-project.com/index.php?topic=105.0) has that feature.
Title: Re: recover when you level up
Post by: Code Geass on June 05, 2008, 09:14:10 PM
it won't work as it doesn't work with... exotic? CBSs

I'm using minkoff's, but I guess it's not compatible.
Title: Re: recover when you level up
Post by: Falcon on June 07, 2008, 02:10:00 AM
Strike 1, use the damn tags.
Title: Re: [REQUEST] recover when you level up
Post by: drakenkanon on July 15, 2008, 03:40:36 PM
there is one (or more) in the rpgvx database dat should work for rpgxp too, i dont know or these will work for rpgxp but you can give it a try (i am on holiday now so i cant test it):
http://rmrk.net/index.php/topic,27610.0.html
Title: Re: [REQUEST] recover when you level up
Post by: ahref on July 17, 2008, 06:58:32 AM
this wont work for xp theres no  def levelup in xp. ive quickely knocked this up using the ideals of the one you linked this should work in xp although it may be uncompatible with another script if it also messes with the exp method:


#===============================================================================
# Recover Hp/Sp/State on levelup
#-------------------------------------------------------------------------------
# Version 1.0
#-------------------------------------------------------------------------------
# By ahref. Based on the ideas of the vx version by worale
#===============================================================================
class Game_Actor < Game_Battler
  #You can change these values!!!
  RECOVER_HP = true # recover hp when you level up true/false
  RECOVER_SP = true # recover sp when you level up true/false
  RECOVER_STATE = true #recover state when you level up
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      @hp = self.maxhp if RECOVER_HP
      @sp = self.maxsp if RECOVER_SP
      @states.clear if RECOVER_STATE
      # 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
  end
end