Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Solved] Experience needed to level

Started by Kenpachi11, July 02, 2010, 04:29:24 AM

0 Members and 1 Guest are viewing this topic.

Kenpachi11

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?

Mr_Wiggles

#1
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
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]

Kenpachi11

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?

Mr_Wiggles

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
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]

Kenpachi11


Kenpachi11

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]

Mr_Wiggles

#6
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
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]

Kenpachi11

It was the case actor thing that was giving me a syntax error, ok thanks sorry
this is exactly what I want

shintashi

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

Mr_Wiggles

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
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]

shintashi

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!