The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: &&&&&&&&&&&&& on October 19, 2013, 07:07:30 AM

Title: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: &&&&&&&&&&&&& on October 19, 2013, 07:07:30 AM
Hello there. I can't really think of anything to say, so I'll keep it simple.

I'm currently messing around with the save file script to get it how I like.

[spoiler=Mockup]
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FQ98NcKm.png&hash=a7ba39e4c61b3fbc672ec887adfb36f1cc15c12a)
[/spoiler]

One of the biggest problems I'm facing right now, is that I don't know where the locations are controlled. I tried changing some stuff in Window_Savefile -

  #--------------------------------------------------------------------------
  # * Draw Play Time
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    header = DataManager.load_header(@file_index)
    return unless header
    draw_text(x, y, width, line_height, header[:playtime_s], 2)


I tried changing x and y to numbers...

draw_text(x, y, width, line_height, header[:playtime_s], 2)

to

draw_text(100, 90, width, line_height, header[:playtime_s], 2)

That didn't move it. It doesn't even seem like changing those does anything.

AlsoIdon'treallyknowhowtoscript.
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: D&P3 on October 19, 2013, 07:51:23 PM
See I read the post the first time, and thought you meant you wanted the map location to be displayed. Then after I had written the code for that and came back I had re-read and discovered the issue. So I'm just gonna pretend you wanted the initial thought and post the code with absolutely no explanation behind how it works.

[spoiler]#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
#  This module manages the database and game objects. Almost all of the
# global variables used by the game are initialized by this module.
#==============================================================================

module DataManager
  class << self
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias boe_location_datamanager_makesaveheader08yh          make_save_header
    #--------------------------------------------------------------------------
    # * Aliased Method: Create Save Header
    #--------------------------------------------------------------------------
    def make_save_header( *args )
      header            = boe_location_datamanager_makesaveheader08yh( *args )
      header[:location] = $game_map.display_name
      return header
    end
  end
end


#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
#  This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias boe_location_windowsavefile_refresh08yh                       refresh
  #--------------------------------------------------------------------------
  # * Aliased Method: Refresh
  #--------------------------------------------------------------------------
  def refresh( *args )
    boe_location_windowsavefile_refresh08yh( *args )
    draw_location()
  end
  #--------------------------------------------------------------------------
  # * New Method: Draw Location
  #--------------------------------------------------------------------------
  def draw_location
    header = DataManager.load_header(@file_index)
    draw_text(0, 0, contents.width - 4, line_height, header[:location], 2) unless header.nil?
  end
end
[/spoiler]



Change the 2 to a 0. No, really, it's as simple as that:

draw_text(x, y, width, line_height, header[:playtime_s], 0)


See that number represents the alignment factor, 0 means the text will be aligned to the left, 1 = center, and 2 = right. So by changing it to a zero it'll go back to the left.
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: Gump on October 19, 2013, 08:15:58 PM
Also the X and Y settings do matter, but the alignment setting matters a lot more. Unless I'm mistaken text position is first set based on line height setting and alignment, then offset by the X and Y setting.

Edit: Damn D&P3, dat signature...
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: &&&&&&&&&&&&& on October 19, 2013, 09:07:25 PM
Thank you. :D

I think I'm making progress on another part of the script. I'm trying to display the "reserve" party members. I want to to show all the characters that have joined the party and not just the active ones.
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: Gump on October 19, 2013, 09:39:36 PM
Quote from: Cuttershy on October 19, 2013, 09:07:25 PM
Thank you. :D

I think I'm making progress on another part of the script. I'm trying to display the "reserve" party members. I want to to show all the characters that have joined the party and not just the active ones.

There are a few different ways you can go about this, I personally would probably do it via aliasing make_save_header in data manager.

This works here (used D&P3's datamanager, thanks):
[spoiler]

#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
#  This module manages the database and game objects. Almost all of the
# global variables used by the game are initialized by this module.
#==============================================================================

module DataManager
  class << self
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias boe_location_datamanager_makesaveheader08yh          make_save_header
    #--------------------------------------------------------------------------
    # * Aliased Method: Create Save Header
    #--------------------------------------------------------------------------
    def make_save_header( *args )
      header            = boe_location_datamanager_makesaveheader08yh( *args )
      header[:location] = $game_map.display_name
      header[:partynames] = $game_party.all_members_names
      return header
    end
  end
end


#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles parties. Information such as gold and items is included.
# Instances of this class are referenced by $game_party.
#==============================================================================

class Game_Party < Game_Unit
  def all_members_names
    names = []
    party = all_members
    party.each do |actor|
      names << actor.name
    end
    return names
  end
end

[/spoiler]

Insert that script and you'll have a new save header (:partynames) to access via the load file scene, its an array of all actor names in the party from the save files, in proper order. Index 0 = party leader. If you are using D&P3's script above, you'll need to overwrite his included datamanager code with what I have put there.
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: &&&&&&&&&&&&& on October 24, 2013, 11:48:48 PM
I suck at this stuff.
I tried to used it, but I just make crashes.

I added -

  #--------------------------------------------------------------------------
  # * Draw More Party Characters
  #--------------------------------------------------------------------------
  def draw_party_names(x, y)
    header = $game_party.all_members_names
    return unless header
    header[:partynames].each_with_index do |data, i|
      draw_character(data[0], data[1], x + i * 48, y)
    end
  end


To "Window_SaveFile"... and It makes crashes.

Also, does this add their names, or their sprites. I was looking to add all the character sprites. (As shown in my MSPaint mock up.)
Title: Re: ITT: Boe begs for help. [RMVXA] (Save Menu)
Post by: Gump on October 27, 2013, 08:17:45 PM
Quote from: Cuttershy on October 24, 2013, 11:48:48 PM
I suck at this stuff.
I tried to used it, but I just make crashes.

I added -

  #--------------------------------------------------------------------------
  # * Draw More Party Characters
  #--------------------------------------------------------------------------
  def draw_party_names(x, y)
    header = $game_party.all_members_names
    return unless header
    header[:partynames].each_with_index do |data, i|
      draw_character(data[0], data[1], x + i * 48, y)
    end
  end


To "Window_SaveFile"... and It makes crashes.

Also, does this add their names, or their sprites. I was looking to add all the character sprites. (As shown in my MSPaint mock up.)

The header itself I added is a simple array of all the actor names in the party. The array is in order, with index 0 being the party leader. No other actor data is stored in that simple header. I think you're accessing it incorrectly in your code snippet there, I don't think you need to touch $game_party.all_members_names right there. No, thats probably the glitch right there. Stahp it.