Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Changing character's MAX Lv problem!!

Hi! I have encountered a really odd thing working in RPG Maker XP (well, yes it's actually a bug in RMXP!)

First I had the final level for all characters set to 50. Then I realised the party would be at 50 already half through the storyline, and CHANGED all characters final level to 99 insthead. The problem is when I load a game file, 50 is STILL the max level. And when checking "EXP for next level" it's just underlined, no digits. So I wonder how do you change the party's MAX / final level (I want it to be 99) so it works even in teh already saved files? How do you get that to work with a party that have reached the EARLIER max Lv (50)? I can't fin any way, it keeps saying MAX Lv even if I changed it to 99.

Here's a picture of my problem:

http://imageshack.us/photo/my-images/849/experror.png/

Please help!
 
I think you'd have to "update" the old save files.
In the load game script, you should write a method that changes all the players max levels to 99. I dont' know if it's as straightforward as that, considering "final_level" is not a variable.
 
This is an intriguing issue, especially since $data_actors is freshly loaded when you visit the title screen and isn't directly related to your save file. When I was thinking "Oh, its just one of his custom scripts," I went ahead and did a max level change test myself to find the same thing. While my test event is printing the changed final_level value for the test actor successfully, the menu is still saying that I'm maxed at level 16, which is what it was set to when I originally saved.

Doing a search through the scripts, something tells me Game_Actor.make_exp_list might contain the root of the problem, since it is called when the Game_Actor object is created. The solution...

Code:
#===============================================================================

# ** Game_Actors

#===============================================================================

 

class Game_Actors

  #-----------------------------------------------------------------------------

  # * Name      : Each

  #   Info      : Adds an 'each' method to $game_actors

  #   Author    : Kain Nobel

  #   Call Info : Any normal way you'd use an 'each' method from an object

  #-----------------------------------------------------------------------------

  def each(&block)

    @data.each(&block)

  end

end

 

#===============================================================================

# ** Scene_Load

#===============================================================================

 

class Scene_Load

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :actorsmaxlvlfix_scnload_readsavedata, :read_save_data

  #-----------------------------------------------------------------------------

  # * Read Save Data

  #-----------------------------------------------------------------------------

  def read_save_data(file)

    # The usual

    actorsmaxlvlfix_scnload_readsavedata(file)

    # For each actor

    $game_actors.each {|actor| actor.make_exp_list if actor}

  end

end

Yup, that appears to do the trick. Calling the make_exp_list method after the game is loaded will ensure that final level is reset to the latest database settings. Without that snippet, your players would have to start a New Game to fix the issue.
 
Shall I copy that piece of script? And where shall I paste it?

I know the variable but in which script?

BTW I have actually used a custom savefile script (But just copy and pasted, NOT edited): here is it:

Code:
module SaveFile

  #--------------------------------------------------------------------------

  # * Get Load Code

  #--------------------------------------------------------------------------

  def self.load_code

    # Return the code required to load a save file

    return "game_0"

  end

  #--------------------------------------------------------------------------

  # * Get Lock Bypass Flag

  #--------------------------------------------------------------------------

  def self.lock_bypass

    # Return false to prevent bypassing locks

    return false

  end

  #--------------------------------------------------------------------------

  # * Get Save Text

  #--------------------------------------------------------------------------

  def self.text

    # Return the text displayed with the save file

    return @text

  end

  #--------------------------------------------------------------------------

  # * Get Save Text Color

  #--------------------------------------------------------------------------

  def self.text_color

    # Return the color of the text displayed with the save file

    return @text_color

  end

  #--------------------------------------------------------------------------

  # * Get Lock Code

  #--------------------------------------------------------------------------

  def self.lock_code

    # Return the code used to lock the save file

    return @lock_code

  end

  #--------------------------------------------------------------------------

  # * Get Save File WindowSkin

  #--------------------------------------------------------------------------

  def self.windowskin

    # Return the windowskin used fore the save file

    return @windowskin

  end

  #--------------------------------------------------------------------------

  # * Get Save File Icons

  #--------------------------------------------------------------------------

  def self.icons(*args)

    # If there are no arguments

    if args.empty?

      # Return the whole array

      return @icons

    # If there is an argument

    else

      # Return the specified icon

      return @icons[args[0]]

    end

  end

  #--------------------------------------------------------------------------

  # * Set Save Text

  #--------------------------------------------------------------------------

  def self.text=(new_value)

    # Set the text displayed with the save file

    @text = new_value

  end

  #--------------------------------------------------------------------------

  # * Set Save Text Color

  #--------------------------------------------------------------------------

  def self.set_text_color(*args)

    # If there is one argument

    if args.size == 1

      # Set the save file's text string color to the given color

      @text_color = args[0]

    # If there are four arguments

    elsif args.size == 4

      # Set a color with the specified values

      color = Color.new(args[0], args[1], args[2], args[3])

      # Set the save files's text string color to the given color

      @text_color = color

    end

  end

  #--------------------------------------------------------------------------

  # * Set Lock Code

  #--------------------------------------------------------------------------

  def self.lock_code=(new_value)

    # Set the code used to lock the save file

    @lock_code = new_value

  end

  #--------------------------------------------------------------------------

  # * Set Save File WindowSkin

  #--------------------------------------------------------------------------

  def self.windowskin=(new_value)

    # Set the windowskin used fore the save file

    @windowskin = new_value

  end

  #--------------------------------------------------------------------------

  # * Set Save File Icons

  #--------------------------------------------------------------------------

  def self.set_icons(*args)

    # If there is one argument

    if args.size == 1

      # Set the whole array

      @icons = args[0]

    # If there are two arguments

    else

      # Set the specified icon

      @icons[args[0]] = args[1]

    end

  end

  #--------------------------------------------------------------------------

  # * Initialize

  #--------------------------------------------------------------------------

  begin

    @text       = ""  # Text to display with a save file

    @text_color = nil # Color of the text displayed with the save file

    @lock_code  = nil # Code to lock a save file

    @windowskin = ""  # Windowskin to use for the save file

    @icons      = []  # Icons to display with the save file

  end

end

 

#==============================================================================

# ** Interpreter

#------------------------------------------------------------------------------

#  This interpreter runs event commands. This class is used within the

#  Game_System class and the Game_Event class.

#==============================================================================

 

class Interpreter

  #--------------------------------------------------------------------------

  # * Set Save Text

  #     string : Text to display in save window

  #--------------------------------------------------------------------------

  def set_save_text(string)

    # Set the save file's text string

    SaveFile.text = string

  end

  #--------------------------------------------------------------------------

  # * Set Save Text Color

  #--------------------------------------------------------------------------

  def set_save_text_color(*args)

    # If there is one argument

    if args.size == 1

      # Set the save file's text string color to the given color

      SaveFile.text_color = args[0]

    # If there are four arguments

    elsif args.size == 4

      # Set a color with the specified values

      color = Color.new(args[0], args[1], args[2], args[3])

      # Set the save files's text string color to the given color

      SaveFile.text_color = color

    end

    # Return true

    return true

  end

  #--------------------------------------------------------------------------

  # * Set Save Windowskin

  #     filename : Windowskin name

  #--------------------------------------------------------------------------

  def set_save_skin(filename)

    # Set the save file's windowskin

    SaveFile.windowskin = filename

  end

  #--------------------------------------------------------------------------

  # * Clear Save Text

  #--------------------------------------------------------------------------

  def clear_save_text

    # Clear the save file's text

    SaveFile.text = ""

  end

  #--------------------------------------------------------------------------

  # * Reset Save Text Color

  #--------------------------------------------------------------------------

  def clear_save_text_color

    # Clear the save file's text color

    SaveFile.text_color = nil

  end

  #--------------------------------------------------------------------------

  # * Remove Save Skin

  #--------------------------------------------------------------------------

  def clear_save_skin

    # Clear the save file's windowskin

    SaveFile.windowskin = nil

  end

  #--------------------------------------------------------------------------

  # * Lock Save File

  #     code : Key to lock and unlock the save file

  #--------------------------------------------------------------------------

  def lock_save_file(code)

    # Lock a save file with the code

    SaveFile.lock_code = code

  end

  #--------------------------------------------------------------------------

  # * Unlock Save File

  #--------------------------------------------------------------------------

  def unlock_save_file

    # Unlock the save file

    SaveFile.lock_code = nil

  end

  #--------------------------------------------------------------------------

  # * Set Save Icon

  #     slot     : Icon slot (integer values from 1 to 8 accepted)

  #     filename : Icon filename (Must be an image in the Icons folder)

  #--------------------------------------------------------------------------

  def set_save_icon(slot, filename)

    # If the slot is out of range

    if slot > 8 or slot <= 0

      # Print an arror message

      print "Error: SaveIcon slot out of range.\nOnly accepts 1-8. " +

        slot.to_s + " is not a valid slot. [Operation: Set]"

        # Return true

      return true

    end

    # Set the save file's icon

    SaveFile.set_icons((slot - 1), filename)

  end

  #--------------------------------------------------------------------------

  # * Remove Save Icon

  #     slot : Icon slot (integer values from 1 to 8 accepted)

  #--------------------------------------------------------------------------

  def clear_save_icon(slot)

    # If the slot is out of range

    if slot > 8 or slot <= 0

      # Print an arror message

      print "Error: SaveIcon slot out of range.\nOnly accepts 1-8. " +

        slot.to_s + " is not a valid slot. [Operation: Set]"

        # Return true

      return true

    end

    # Clear the save icon

    SaveFile.set_icons((slot - 1), nil)

  end

  #--------------------------------------------------------------------------

  # * Clear All Save Icons

  #--------------------------------------------------------------------------

  def clear_all_save_icons

    # Iterate through all save icons

    for i in 0...SaveFile.icons.size

      # Clear the save icon

      SaveFile.set_icons(i, nil)

    end

  end

end

 

#==============================================================================

# ** Window_SaveFile

#------------------------------------------------------------------------------

#  This window displays save files on the save and load screens.

#==============================================================================

 

class Window_SaveFile < Window_Base

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  alias glitch_window_savefile_initialize initialize

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     file_index : save file index (0-3)

  #     filename   : file name

  #--------------------------------------------------------------------------

  def initialize(file_index, filename)

    # Check for file

    file_exist = FileTest.exist?(filename)

    # If the file exists

    if file_exist

      # Open the file

      file = File.open(filename, "r")

      # Load the file data

      load_data = read_save_data(file)

      if !load_data

        # Set save string

        @text = ''

        # Set save string color

        @text_color = nil

        # Set save file windowskin

        @windowskin = ''

        # Set save file icons

        @icons = []

        # Close the file

        file.close

      end

    end

    # Call the original initialize method

    glitch_window_savefile_initialize(file_index, filename)

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    # Draw file number

    self.contents.font.color = normal_color

    name = "File#{@file_index + 1}"

    self.contents.draw_text(4, 0, 600, 32, name)

    @name_width = contents.text_size(name).width

    # If save file exists

    if @file_exist

      # Change windowskin if set

      if @windowskin != nil && @windowskin != ""

        self.windowskin = RPG::Cache.windowskin(@windowskin)

      end

      # Draw character

      for i in [email=0...@characters.size]0...@characters.size[/email]

        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])

        cw = bitmap.rect.width / 4

        ch = bitmap.rect.height / 4

        src_rect = Rect.new(0, 0, cw, ch)

        x = 300 - @characters.size * 32 + i * 64 - cw / 2

        self.contents.blt(x, 68 - ch, bitmap, src_rect)

      end

      # Draw save string

      if @text != nil && @text != ""

        if @text_color.instance_of?(Color)

          self.contents.font.color = @text_color

        else

          self.contents.font.color = normal_color

        end

        self.contents.draw_text(4, 0, 600, 32, @text, 2)

      end

      # Iterate through icons

      for i in [email=0...@icons.size]0...@icons.size[/email]

        # Set temporary icon variable

        icon = @icons[i]

        # Skip if the variable is nil

        next if icon == nil

        # Load icon bitmap

        bitmap = RPG::Cache.icon(icon)

        # Set bitmap x

        x = ((i % 4) * 32)

        x += 16 if i >= 4

        # Set bitmap y

        y = (i < 4) ? 32 : 48

        # Draw bitmap

        self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))

      end

      # Draw play time

      hour = @total_sec / 60 / 60

      min = @total_sec / 60 % 60

      sec = @total_sec % 60

      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)

      self.contents.font.color = normal_color

      self.contents.draw_text(4, 22, 600, 32, time_string, 2)

      # Draw timestamp

      self.contents.font.color = normal_color

      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")

      self.contents.draw_text(4, 44, 600, 32, time_string, 2)

    end

  end

  #--------------------------------------------------------------------------

  # * Read Save Data

  #     file : file object for reading (opened)

  #--------------------------------------------------------------------------

  def read_save_data(file)

    # Read character data for drawing save file

    characters = Marshal.load(file)

    # Read frame count for measuring play time

    frame_count = Marshal.load(file)

    # Read each type of game object

    game_system        = Marshal.load(file)

    game_switches      = Marshal.load(file)

    game_variables     = Marshal.load(file)

    game_self_switches = Marshal.load(file)

    game_screen        = Marshal.load(file)

    game_actors        = Marshal.load(file)

    game_party         = Marshal.load(file)

    game_troop         = Marshal.load(file)

    game_map           = Marshal.load(file)

    game_player        = Marshal.load(file)

    # If the end of file has not been reached

    unless file.eof?

      # Load temporary save string

      text = Marshal.load(file)

      # Return if not a string

      return false if text.class != String

      # Return false if the end of file has been reached

      return false if file.eof?

      # Load temporary save string color

      text_color = Marshal.load(file)

      # Return if not a color

      return false if text_color.class != Color

      # Return false if the end of file has been reached

      return false if file.eof?

      # Load temporary lock code

      lock_code = Marshal.load(file)

      # Return false if the end of file has been reached

      return false if file.eof?

      # Load temporary save windowksin

      windowskin = Marshal.load(file)

      # Return if not a string

      return false if windowskin.class != String

      # Return false if the end of file has been reached

      return false if file.eof?

      # Load temporary save icons

      icons = Marshal.load(file)

      # Return if not an array

      return false if icons.class != Array

      # Set save string

      @text = text

      # Set save string color

      @text_color = text_color

      # Set save file lock code

      @lock_code = lock_code

      # Set save file windowskin

      @windowskin = windowskin

      # Set save file icons

      @icons = icons

    end

  end

end

 

#==============================================================================

# ** Scene_Save

#------------------------------------------------------------------------------

#  This class performs save screen processing.

#==============================================================================

 

class Scene_Save < Scene_File

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  alias glitch_scene_save_write_save_data write_save_data

  #--------------------------------------------------------------------------

  # * Write Save Data

  #     file : write file object (opened)

  #--------------------------------------------------------------------------

  def write_save_data(file)

    # Call aliased method

    glitch_scene_save_write_save_data(file)

    # Write save file string

    Marshal.dump(SaveFile.text, file)

    # Write save file string color

    Marshal.dump(SaveFile.text_color, file)

    # Write save file lock code

    Marshal.dump(SaveFile.lock_code, file)

    # Write save file windowskin

    Marshal.dump(SaveFile.windowskin, file)

    # Write save file icons

    Marshal.dump(SaveFile.icons, file)

  end

end

 

#==============================================================================

# ** Scene_Load

#------------------------------------------------------------------------------

#  This class performs load screen processing.

#==============================================================================

 

class Scene_Load < Scene_File

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  alias glitch_scene_load_on_decision on_decision

  alias glitch_scene_load_read_save_data read_save_data

  #--------------------------------------------------------------------------

  # * Decision Processing

  #--------------------------------------------------------------------------

  def on_decision(filename)

    # If file doesn't exist

    unless FileTest.exist?(filename)

      # Play buzzer SE

      $game_system.se_play($data_system.buzzer_se)

      return

    end

    # Open save file

    file = File.open(filename, "r")

    # Read character data for drawing save file

    characters = Marshal.load(file)

    # Read frame count for measuring play time

    frame_count = Marshal.load(file)

    # Read each type of game object

    game_system        = Marshal.load(file)

    game_switches      = Marshal.load(file)

    game_variables     = Marshal.load(file)

    game_self_switches = Marshal.load(file)

    game_screen        = Marshal.load(file)

    game_actors        = Marshal.load(file)

    game_party         = Marshal.load(file)

    game_troop         = Marshal.load(file)

    game_map           = Marshal.load(file)

    game_player        = Marshal.load(file)

    # Read custom save data

    read_save_data(file, true)

    # (If the lock is not being bypassed

    if !SaveFile.lock_bypass

      # If the lock code is not empty

      if SaveFile.lock_code != nil && SaveFile.lock_code != ""

        # If the lock code does not match the load code

        if SaveFile.lock_code != SaveFile.load_code

          # Play buzzer SE

          $game_system.se_play($data_system.buzzer_se)

          return

        end

      end

    end

    file.close

    # Play load SE

    glitch_scene_load_on_decision(filename)

  end

  #--------------------------------------------------------------------------

  # * Read Save Data

  #     file : file object for reading (opened)

  #--------------------------------------------------------------------------

  def read_save_data(file, skip = false)

    # Read default save data

    glitch_scene_load_read_save_data(file) if !skip

    # If the end of file has not been reached

    unless file.eof?

      # Load temporary save string

      text = Marshal.load(file)

      # Return if not a string

      return if text.class != String

      # Return if the end of file has been reached

      return if file.eof?

      # Load temporary save string color

      text_color = Marshal.load(file)

      # Return if not a color

      return if text_color.class != Color

      # Return if the end of file has been reached

      return if file.eof?

      # Load temporary lock code

      lock_code = Marshal.load(file)

      # Return if the end of file has been reached

      return if file.eof?

      # Load temporary save windowksin

      windowskin = Marshal.load(file)

      # Return if not a string

      return if windowskin.class != String

      # Return if the end of file has been reached

      return if file.eof?

      # Load temporary save icons

      icons = Marshal.load(file)

      # Return if not an array

      return if icons.class != Array

      # Set save string

      SaveFile.text = text

      # Set save string color

      SaveFile.text_color = text_color

      # Set save file lock code

      SaveFile.lock_code = lock_code

      # Set save file windowskin

      SaveFile.windowskin = windowskin

      # Set save file icons

      SaveFile.set_icons(icons)

    end

  end

end
 

Atoa

Member

Just to clarify the question, final_level isn't a variable, but the exp_list is, and it's set on the actor.setup (I.E: When you start a new game or when you add a new character with initial status box checked)
And as Kain posted, remaking the exp list solves this.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top