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.

[XP] Exp Level Reset

Started by game_guy, June 10, 2010, 01:33:56 AM

0 Members and 1 Guest are viewing this topic.

game_guy

Exp Level Reset
Authors: game_guy
Version: 1.0
Type: Exp Add-On
Key Term: Actor Add-on


Introduction

After an actor levels up their experience goes back to 0 making it more  challenging to level up.
Example:
Old Way: Level 2 requires 25 exp. You get to level 2 and you keep that 25 experience.
This Way: Level 2 requires 25 exp. You get to level 2 but you go back to 0 exp making you get more experience until your next level up.


Features


  • Resets Exp after Level Up
  • Adds some challenge to your game


Screenshots

[spoiler][/spoiler]


Demo

N/A


Script

:O More Comments then Code
30 lines of Comments
20 lines of Code
[SPOILER]
#===============================================================================
# Exp Level Reset
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# After an actor levels up their experience goes back to 0 making it more
# challenging to level up.
# Example:
# Old Way: Level 2 requires 25 exp. You get to level 2 and you keep that
# 25 experience.
# This Way: Level 2 requires 25 exp. You get to level 2 but you go back to 0
# exp making you get more experience until your next level up.
#
# Features:
# Resets Exp after Level Up
# Adds some challenge to your game
#
# Instructions:
# Place below Scene_Debug but above everything else.
#
# Compatability:
# Not tested with SDK.
# Will work with any battle system.
# Overwrites Game_Actor's exp and level method.
#
# Credits:
# game_guy ~ for making it
# Branden ~ for testing it and listening to me blab on about the script
#===============================================================================
class Game_Actor
 def exp=(exp)
   @exp = exp
   while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
     @exp = @exp - @exp_list[@level+1]
     @level += 1
   end
   for j in $data_classes[@class_id].learnings
     if j.level == @level
       learn_skill(j.skill_id)
     end
   end
   @hp = [@hp, self.maxhp].min
   @sp = [@sp, self.maxsp].min
 end
 def level=(level)
   level = [[level, $data_actors[@actor_id].final_level].min, 1].max
   @exp = 0
 end
end
[/SPOILER]


Instructions

Place below Scene_Debug but above everything else.


Compatibility

Not tested with SDK.
Will work with any battle system.
Overwrites Game_Actor exp and level method.


Credits and Thanks


  • game_guy ~ for making it
  • Branden ~ for testing it and listening to me blab on about the script


Author's Notes

Enjoy!

IAMFORTE


game_guy

Perfect for a game that requires a lot of grinding :D

IAMFORTE

Hmmm I might just use this, only time will tell XD, seems like a good addition to my terrible drop rates XD.
Do you think this will work with ABS systems like XAS?

game_guy

Yup, tested with XAS, Blizz-Abs, and Tankentai Sideview battle system

cozziekuns

What about Cogwheel's RTAB?

Though it'd probably be compatible with that too, seeing how it doesn't seem to alter anything big.

game_guy

Never tested it with that, but this script only edits the Game_Actor class. If you press ctrl + f in the script editor and search for this
"def exp="
"def level="
If it doesnt appear in the cogwheel script it should work just fine. Let me know if you have troubles with it I'll fix it for you

shintashi

This is a nifty little script. I wonder if something like it could be used to make a skill tree.

IAMFORTE

Hi! So I decided to finnaly use this, only one problem, it overwrites a very important script, my level and stat breaker

this is it

#==============================================================================
#  Unlimit Levels v1                                            by: cybersam
#                                                               date: 14.09.06
#
# Fixed by: albertfish
# Date:     September 16, 2009
#
# What albertfish fixed:
#     - Removed the use of global variables
#     - Fixed the initial stat and growth problems
#         - Initial stats used to be too high
#         - Stats used to grow too fast
#     - Stats now follow the curve created in the data base
#         - After level 99 the stats increase by the same amount as they did
#           between level 98 and level 99
#------------------------------------------------------------------------------
#  here is a full working scripts for you to this... (i think there is
#  already one like this somewhere in the in the community...
#  i did one back then when i started in RPG Maker XP
#  some other guys did a few other script like this
#==============================================================================
# Must go ABOVE leveling with points to work
#----------------------------------------------------------------------------
# here you can set the max hp,sp,,str,dex,agi and int
#----------------------------------------------------------------------------

module UL_af_config
  FINAL_LVL  = 100
  MAX_HP     = 10000
  MAX_SP     = 1000
  MAX_STR    = 1000
  MAX_DEX    = 1000
  MAX_AGI    = 1000
  MAX_INT    = 1000
end

class Game_Actor
  #include UL_af_config

  #--------------------------------------------------------------------------
  # setting the levels...
  #--------------------------------------------------------------------------
  def final_level
   
    # here you can set the max level for your characters based on their ID's...
    # i set it so that 3 characters have different levels and the rest
    # have max lvl of 9999
    #
    # this settings is only to show you how to change the max setting for your
    # characters... same thing is for the parameters -> hp,sp,str,dex.agi,int
   
    case self.id
    when 1
      level = 200
    when 2
      level = 200
    when 8
      level = 200
    else
      level = FINAL_LVL
    end
    return level
  end
 
 
  #--------------------------------------------------------------------------
  # setting max hp...
  #--------------------------------------------------------------------------
  def max_hp

    case self.id
    when 1
      hp = 100000
    when 2
      hp = 100000
    when 8
      hp = 100000
    when 20
      hp = 100000
    else
      hp = MAX_HP
    end
    return hp
  end
  #--------------------------------------------------------------------------
  # setting max sp...
  #--------------------------------------------------------------------------
  def max_sp

    case self.id
    when 1
      sp = 100000
    when 2
      sp = 100000
    when 8
      sp = 100000
    else
      sp = MAX_SP
    end
    return sp
  end
  #--------------------------------------------------------------------------
  # setting max str...
  #--------------------------------------------------------------------------
  def max_str
    case self.id
    when 1
      str = 3000
    when 2
      str = 3000
    when 8
      str = 3000
    else
      str = MAX_STR
    end
    return str
  end
  #--------------------------------------------------------------------------
  # setting max dex...
  #--------------------------------------------------------------------------
  def max_dex
    case self.id
    when 1
      dex = 3000
    when 2
      dex = 3000
    when 8
      dex = 3000
    else
      dex = MAX_DEX
    end
    return dex
  end 
  #--------------------------------------------------------------------------
  # setting max agi...
  #--------------------------------------------------------------------------
  def max_agi
    case self.id
    when 1
      agi = 3000
    when 2
      agi = 3000
    when 8
      agi = 3000
    else
      agi = MAX_AGI
    end
    return agi
  end   
  #--------------------------------------------------------------------------
  # setting max int...
  #--------------------------------------------------------------------------
  def max_int
    case self.id
    when 1
      int = 3000
    when 2
      int = 3000
    when 8
      int = 3000
    else
      int = MAX_INT
    end
    return int
  end 
 
  #--------------------------------------------------------------------------
  # Creating the new EXP list
  # dont change anything from here on... (only if you know what you're doing)
  #--------------------------------------------------------------------------
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list = Array.new(final_level + 2)
    @exp_list[1] = 0
    pow_i = 2.4 + actor.exp_inflation / 1000.0
    for i in 2..final_level + 1
      if i > final_level
        @exp_list[i] = 0
      else
        n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
        @exp_list[i] = @exp_list[i-1] + Integer(n)
      end
    end
  end

  #--------------------------------------------------------------------------
  # setting parameters like hp, sp, str, dex, agi and int
  #--------------------------------------------------------------------------
  def maxhp
    n = [[base_maxhp + @maxhp_plus, 1].max, max_hp].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    end
    n = [[Integer(n), 1].max, max_hp].min
    return n
  end
 
  def base_maxhp
    af = $data_actors[@actor_id].parameters[0, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[0, 98] unless @level <= 98
    maxhp = af
    maxhp += ($data_actors[@actor_id].parameters[0, 99] - af) * (@level - 98) unless @level <= 98
    return maxhp
  end

  def base_maxsp
    af = $data_actors[@actor_id].parameters[1, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[1, 98] unless @level <= 98
    maxsp = af
    maxsp += ($data_actors[@actor_id].parameters[1, 99] - af) * (@level - 98) unless @level <= 98
    return maxsp
  end

  def base_str
    af = $data_actors[@actor_id].parameters[2, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[2, 98] unless @level <= 98
    n = af
    n += ($data_actors[@actor_id].parameters[2, 99] - af) * (@level - 98) unless @level <= 98
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    return [[n, 1].max, max_str].min
  end

  def base_dex
    af = $data_actors[@actor_id].parameters[3, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[3, 98] unless @level <= 98
    n = af
    n += ($data_actors[@actor_id].parameters[3, 99] - af) * (@level - 98) unless @level <= 98
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    return [[n, 1].max, max_dex].min
  end

  def base_agi
    af = $data_actors[@actor_id].parameters[4, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[4, 98] unless @level <= 98
    n = af
    n += ($data_actors[@actor_id].parameters[4, 99] - af) * (@level - 98) unless @level <= 98
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.agi_plus : 0
    n += armor1 != nil ? armor1.agi_plus : 0
    n += armor2 != nil ? armor2.agi_plus : 0
    n += armor3 != nil ? armor3.agi_plus : 0
    n += armor4 != nil ? armor4.agi_plus : 0
    return [[n, 1].max, max_agi].min
  end

  def base_int
    af = $data_actors[@actor_id].parameters[5, @level] if @level <= 98
    af = $data_actors[@actor_id].parameters[5, 98] unless @level <= 98
    n = af
    n += ($data_actors[@actor_id].parameters[5, 99] - af) * (@level - 98) unless @level <= 98
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.int_plus : 0
    n += armor1 != nil ? armor1.int_plus : 0
    n += armor2 != nil ? armor2.int_plus : 0
    n += armor3 != nil ? armor3.int_plus : 0
    n += armor4 != nil ? armor4.int_plus : 0
    return [[n, 1].max, max_int].min
  end

  def exp=(exp)
    @exp = [exp, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    while @exp < @exp_list[@level]
      @level -= 1
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end

  def level=(level)
    level = [[level, final_level].min, 1].max
    self.exp = @exp_list[level]
  end
end



#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler
  include UL_af_config

  def maxhp
    n = [[base_maxhp + @maxhp_plus, 1].max, MAX_HP].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAX_HP].min
    return n
  end

  def maxsp
    n = [[base_maxsp + @maxsp_plus, 0].max, MAX_SP].min
    for i in @states
      n *= $data_states[i].maxsp_rate / 100.0
    end
    n = [[Integer(n), 0].max, MAX_SP].min
    return n
  end

  def str
    n = [[base_str + @str_plus, 1].max, MAX_STR].min
    for i in @states
      n *= $data_states[i].str_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAX_STR].min
    return n
  end

  def dex
    n = [[base_dex + @dex_plus, 1].max, MAX_DEX].min
    for i in @states
      n *= $data_states[i].dex_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAX_DEX].min
    return n
  end

  def agi
    n = [[base_agi + @agi_plus, 1].max, MAX_AGI].min
    for i in @states
      n *= $data_states[i].agi_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAX_AGI].min
    return n
  end

  def int
    n = [[base_int + @int_plus, 1].max, MAX_INT].min
    for i in @states
      n *= $data_states[i].int_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAX_INT].min
    return n
  end

  def maxhp=(maxhp)
    @maxhp_plus += maxhp - self.maxhp
    @maxhp_plus = [[@maxhp_plus, - MAX_HP].max, MAX_HP].min
    @hp = [@hp, self.maxhp].min
  end

  def maxsp=(maxsp)
    @maxsp_plus += maxsp - self.maxsp
    @maxsp_plus = [[@maxsp_plus, - MAX_SP].max, MAX_SP].min
    @sp = [@sp, self.maxsp].min
  end

  def str=(str)
    @str_plus += str - self.str
    @str_plus = [[@str_plus, - MAX_STR].max, MAX_STR].min
  end

  def dex=(dex)
    @dex_plus += dex - self.dex
    @dex_plus = [[@dex_plus, - MAX_DEX].max, MAX_DEX].min
  end

  def agi=(agi)
    @agi_plus += agi - self.agi
    @agi_plus = [[@agi_plus, - MAX_AGI].max, MAX_AGI].min
  end

  def int=(int)
    @int_plus += int - self.int
    @int_plus = [[@int_plus, - MAX_INT].max, MAX_INT].min
  end
end


What i need you're script to do is recognize that the maximum level is 100, preventing anymore experience gain.

Thanks :D