This seemed like more of a script request than a script issue, so I'm sorry if this is in the wrong place.
I am trying to make my game show you what chapter you are on in the save screen. Nothing fancy, I just need to have the save files show which chapter you are on. I have a chapter variable, and I think I made the proper script call (or whatever it's called) and made the text script, but I'm having a problem with the script retrieving and reading the Chapter variable. I would appreciate the Chapter counter to be at the same spot as the playtime, but at the top rather than the bottom. (Or is the other way around?)
I'd also be thankful is the script were to say "Prologue" if the variable is equal to 0, "Epilogue" if it is equal to a specified number, and just be blank if it's in negatives or greater than the Epilogue variable.
Here's the edited Window_SaveFile code:
Sorry if this sounds too demanding, or if it's in the wrong spot, or if I'm breaking some other community guideline!
NOTE: Since the new update made everyone so busy, I'm gonna see if editing this will re-add it back into the thread list, because I'm too afraid to try posting this again or looking for a "delete thread" button.
I am trying to make my game show you what chapter you are on in the save screen. Nothing fancy, I just need to have the save files show which chapter you are on. I have a chapter variable, and I think I made the proper script call (or whatever it's called) and made the text script, but I'm having a problem with the script retrieving and reading the Chapter variable. I would appreciate the Chapter counter to be at the same spot as the playtime, but at the top rather than the bottom. (Or is the other way around?)
I'd also be thankful is the script were to say "Prologue" if the variable is equal to 0, "Epilogue" if it is equal to a specified number, and just be blank if it's in negatives or greater than the Epilogue variable.
Here's the edited Window_SaveFile code:
Code:
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :selected # selected
attr_reader :chapter # chapter number
#--------------------------------------------------------------------------
# * Object Initialization
# index : index of save files
#--------------------------------------------------------------------------
def initialize(height, index)
super(0, index * height, Graphics.width, height)
@file_index = index
refresh
@selected = false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(normal_color)
name = Vocab::File + " #{@file_index + 1}"
draw_text(4, 0, 200, line_height, name)
@name_width = text_size(name).width
draw_party_characters(152, 58)
draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
draw_chapter(0, contents.height - line_height, contents.width - 4, 2)
end
#--------------------------------------------------------------------------
# * Draw Party Characters
#--------------------------------------------------------------------------
def draw_party_characters(x, y)
header = DataManager.load_header(@file_index)
return unless header
header[:characters].each_with_index do |data, i|
draw_character(data[0], data[1], x + i * 48, y)
end
end
#--------------------------------------------------------------------------
# * 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)
end
#--------------------------------------------------------------------------
# * Draw Chapter
#--------------------------------------------------------------------------
def draw_chapter(x, y, width, align)
header = DataManager.extract_save_contents($game_variables)
return unless header
draw_text(x, y, width, line_height, header[:variables], 2)
end
#--------------------------------------------------------------------------
# * Set Selected
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor
end
#--------------------------------------------------------------------------
# * Update Cursor
#--------------------------------------------------------------------------
def update_cursor
if @selected
cursor_rect.set(0, 0, @name_width + 8, line_height)
else
cursor_rect.empty
end
end
end
Sorry if this sounds too demanding, or if it's in the wrong spot, or if I'm breaking some other community guideline!
NOTE: Since the new update made everyone so busy, I'm gonna see if editing this will re-add it back into the thread list, because I'm too afraid to try posting this again or looking for a "delete thread" button.