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.

heal upon lvl up [RESOLVED]

Started by ryuzaki95, August 24, 2009, 11:57:07 PM

0 Members and 1 Guest are viewing this topic.

ryuzaki95

i dont know whether to put this in troubleshooting or script request but instead of using a script to auto heal your char when he lvls up i heard you can change something in game_actor. im terrible with scripting so can someone tell me what to change in game_actor to auto heal your character when he lvls up?

Kokowam

#1
http://rmrk.net/index.php/board,108.0.html

I suppose looking at the description that says "Discussion on Scripts for the RPG Maker XP" doesn't mean anything to you either.

http://rmrk.net/index.php/topic,18051.0.html

This sticky doesn't mean anything, either, I suppose.

Also, I'll see if I can help, but next time, post in the right place.

EDIT: Eh. I'm too lazy to do this. I probably could do this but only with quite a bit of work and searching for syntax because I'm not very good with scripting.

modern algebra

How modifying Game_Actor is "instead of using a script" I can't figure out, but all you need to change is the exp= method of Game_Actor.

Around line 454 you'll see:


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



Where you have:


    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1


add recover_all, so:


    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      recover_all


I think that will work.

ryuzaki95

it works thank you so much for your help :)