Main Menu
  • Welcome to The RPG Maker Resource Kit.

[REQUEST] recover when you level up

Started by Code Geass, June 05, 2008, 08:21:26 PM

0 Members and 1 Guest are viewing this topic.

Code Geass

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?

Irock


Code Geass

it won't work as it doesn't work with... exotic? CBSs

I'm using minkoff's, but I guess it's not compatible.

Falcon


drakenkanon

#4
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

ahref

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