The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Kenpachi11 on July 02, 2010, 04:29:24 AM

Title: [Solved] Experience needed to level
Post by: Kenpachi11 on July 02, 2010, 04:29:24 AM
Is there a script that lets you pick exactly how much exp is needed to level at each level?

Like at level 1 you need 500
at 2 you need 750
at 3 you need 1000
and so on...

Anyone either know of one or know how to make it?
Title: Re: Experience needed to level
Post by: Mr_Wiggles on July 02, 2010, 07:06:14 PM
here its a quick small code, let me know if you want anything added to it. Just paste it above main and bellow the default scripts. The way it works is that in order to get to say, level 2 you need this much exp.


class Game_Actor < Game_Battler 
  def actor_exp_rates(level, actor = 0)
    case actor
#==============================================================================
#   ** Config **
#==============================================================================
# Follow this template for your actors in your game to set their exp.
    when 1 # Actor ID
      exp = { # Exp for levels
      2 => 30,  # A => B
      3 => 40,  # A is level
      4 => 50   # B is EXP needed
      }
      return exp[level]
    when 2
      exp = {   # Because the levels 3 and 5 are not set here, the script will
      2 => 45,  # get the default values from the default settings.
      4 => 73,  # if the default setting is not set it will return 0 and the
      6 => 83   # actor will not be allowed to level up past that point.
      }
      return exp[level]
    else # These are the default exp requirements, if the actor id is not set
      # the required exp will be set to these values.
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
#==============================================================================
#   ** End Config **
#==============================================================================
    end
  end
 
  def get_exp_needed(level)
    exp = actor_exp_rates(level, @actor_id)
    exp = actor_exp_rates(level) if exp == nil
    exp = 0 if exp == nil
    return exp
  end

  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        @exp_list[i] = get_exp_needed(i)
      end
    end
  end
end
Title: Re: Experience needed to level
Post by: Kenpachi11 on July 02, 2010, 08:16:07 PM
Wow! Thank you so much this is exactly what I need.
Quick question though, how do I just make it all the same for everyone?
Title: Re: Experience needed to level
Post by: Mr_Wiggles on July 02, 2010, 10:51:38 PM
To make it easy for you just replace your code with this edited one.

class Game_Actor < Game_Battler 
  def actor_exp_rates(level, actor = 0)
#==============================================================================
#   ** Config **
#==============================================================================
# Follow this template for your actors in your game to set their exp.

# These are the default exp requirements, if the actor id is not set
# the required exp will be set to these values.
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
#==============================================================================
#   ** End Config **
#==============================================================================
  end
 
  def get_exp_needed(level)
    exp = actor_exp_rates(level, @actor_id)
    exp = actor_exp_rates(level) if exp == nil
    exp = 0 if exp == nil
    return exp
  end

  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        @exp_list[i] = get_exp_needed(i)
      end
    end
  end
end
Title: Re: Experience needed to level
Post by: Kenpachi11 on July 03, 2010, 06:00:30 AM
Thank you
Title: Re: [Resolved] Experience needed to level
Post by: Kenpachi11 on July 03, 2010, 06:06:47 PM
Actually the change you made causes an error because there is nothing before the actually exp definitions....

[spoiler]#==============================================================================
# Follow this template for your actors in your game to set their exp.
    when 1 # Actor ID
      exp = { # Exp for levels
      2 => 30,  # A => B
      3 => 40,  # A is level
      4 => 50   # B is EXP needed
      }
      return exp[level]
    when 2
      exp = {   # Because the levels 3 and 5 are not set here, the script will
      2 => 45,  # get the default values from the default settings.
      4 => 73,  # if the default setting is not set it will return 0 and the
      6 => 83   # actor will not be allowed to level up past that point.
      }
      return exp[level]
    else # These are the default exp requirements, if the actor id is not set
      # the required exp will be set to these values.
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
[/spoiler]
[spoiler]{Something should be here right?}   
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level][/spoiler]
Title: Re: [Bugged] Experience needed to level
Post by: Mr_Wiggles on July 03, 2010, 08:48:57 PM
no, script works fine as is.. your missing the bigger picture..

  def actor_exp_rates(level, actor = 0)
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
  end
Title: Re: [Bugged] Experience needed to level
Post by: Kenpachi11 on July 03, 2010, 09:02:42 PM
It was the case actor thing that was giving me a syntax error, ok thanks sorry
this is exactly what I want
Title: Re: [Solved] Experience needed to level
Post by: shintashi on December 16, 2010, 09:31:25 PM
*Casts Animate Zombie Thread*

This is a hash right? How do you get the tables to change when you change character classes, like from fighter to Mage?
Title: Re: [Solved] Experience needed to level
Post by: Mr_Wiggles on December 20, 2010, 09:44:29 PM
here you are.


class Game_Actor < Game_Battler
  def actor_exp_rates(level)
    case @class_id
#==============================================================================
#   ** Config **
#==============================================================================
# Follow this template for your actors in your game to set their exp.
    when 0 # Class ID
      exp = { # Exp for levels
      2 => 30,  # A => B
      3 => 40,  # A is level
      4 => 50   # B is EXP needed
      }
      return exp[level]
    when 1
      exp = {   # Because the levels 3 and 5 are not set here, the script will
      2 => 45,  # get the default values from the default settings.
      4 => 73,  # if the default setting is not set it will return 0 and the
      6 => 83   # actor will not be allowed to level up past that point.
      }
      return exp[level]
    else # These are the default exp requirements, if the actor id is not set
      # the required exp will be set to these values.
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
#==============================================================================
#   ** End Config **
#==============================================================================
    end
  end

  def get_exp_needed(level)
    exp = actor_exp_rates(level)
    exp = actor_exp_rates(level) if exp == nil
    exp = 0 if exp == nil
    return exp
  end

  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        @exp_list[i] = get_exp_needed(i)
      end
    end
  end
 
  def class_id=(class_id)
    if $data_classes[class_id] != nil
      @class_id = class_id
      make_exp_list
      unless equippable?($data_weapons[@weapon_id])
        equip(0, 0)
      end
      unless equippable?($data_armors[@armor1_id])
        equip(1, 0)
      end
      unless equippable?($data_armors[@armor2_id])
        equip(2, 0)
      end
      unless equippable?($data_armors[@armor3_id])
        equip(3, 0)
      end
      unless equippable?($data_armors[@armor4_id])
        equip(4, 0)
      end
    end
  end
 
end
Title: Re: [Solved] Experience needed to level
Post by: shintashi on December 30, 2010, 06:50:21 PM
Quote from: Mr_Wiggles on December 20, 2010, 09:44:29 PM
here you are.


class Game_Actor < Game_Battler
  def actor_exp_rates(level)
    case @class_id
#==============================================================================
#   ** Config **
#==============================================================================
# Follow this template for your actors in your game to set their exp.
    when 0 # Class ID
      exp = { # Exp for levels
      2 => 30,  # A => B
      3 => 40,  # A is level
      4 => 50   # B is EXP needed
      }
      return exp[level]
    when 1
      exp = {   # Because the levels 3 and 5 are not set here, the script will
      2 => 45,  # get the default values from the default settings.
      4 => 73,  # if the default setting is not set it will return 0 and the
      6 => 83   # actor will not be allowed to level up past that point.
      }
      return exp[level]
    else # These are the default exp requirements, if the actor id is not set
      # the required exp will be set to these values.
      exp = {
      2 => 30,
      3 => 50,
      4 => 65,
      5 => 70,
      6 => 90
      }
      return exp[level]
#==============================================================================
#   ** End Config **
#==============================================================================
    end
  end

  def get_exp_needed(level)
    exp = actor_exp_rates(level)
    exp = actor_exp_rates(level) if exp == nil
    exp = 0 if exp == nil
    return exp
  end

  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        @exp_list[i] = get_exp_needed(i)
      end
    end
  end
 
  def class_id=(class_id)
    if $data_classes[class_id] != nil
      @class_id = class_id
      make_exp_list
      unless equippable?($data_weapons[@weapon_id])
        equip(0, 0)
      end
      unless equippable?($data_armors[@armor1_id])
        equip(1, 0)
      end
      unless equippable?($data_armors[@armor2_id])
        equip(2, 0)
      end
      unless equippable?($data_armors[@armor3_id])
        equip(3, 0)
      end
      unless equippable?($data_armors[@armor4_id])
        equip(4, 0)
      end
    end
  end
 
end


Worked like magic for both my game and my roomate's game. Awesome!