#-------------------------------------------------------------------------------
#- More Informative Saves v1.01
#-- Customizable save slots capable of holding all sorts of data
#-- By mjshi
#-- OK for use in all projects with credit
#-------------------------------------------------------------------------------
# Installation: Put above Main.
# Changelog: Added support for showing equipment icons.
#-------------------------------------------------------------------------------
module MISav
#-----------------------------------------------------------------------------
# **CONFIGURATION**
#-----------------------------------------------------------------------------
# Save Menu Configuration
#
FileName = "File"
ShiftX = 48
ShiftY = 32
Window_Width = 544 #Graphics.width #100% width
Max_Savefiles = 12
# Number of savefiles to show at once
Number_Viewable = 4
#
# Show save/load messages? (true/false)
Show_Msg = true
MsgWindow_ShiftX = ShiftX #makes the msgwindow move with the savefiles
MsgWindow_ShiftY = ShiftY #makes the msgwindow move with the savefiles
MsgWindow_Width = Graphics.width #100% width
#
SaveMsg = "Save to which file?"
LoadMsg = "Load which file?"
#
#-----------------------------------------------------------------------------
# Should we show the player's party on the save file?
#
Show_Party = true
#
# Where should we show the party members?
PARTY_X = 152
PARTY_Y = 58
PARTY_SPACING = 12 #default is 12
#
#-----------------------------------------------------------------------------
# Should we show the player's face images on the save file?
#
Show_Faces = false
FACE_X = 0
FACE_Y = 0
FACE_SPACING = 10
#
#-----------------------------------------------------------------------------
# Should we show the party's equipped items?
#
Show_Equipment = false
# If nothing is equipped in the slot, do not show blank space for it
Equipment_Collapse = false
#
EQUIP_X = 0
EQUIP_Y = 0
# Spacing between equipment of the same character (e.g. A A A)
EQUIP_SPACING = 1
# Spacing between equipment of different characters (e.g. AAA BBB CCC)
EQUIP_SET_SPACING = 5
#
TEXT = [
#-----------------------------------------------------------------------------
# Text to show on the save/load screen.
# Format:
# ["text", x position or align, line number],
#-----------------------------------------------------------------------------
#-"text" is what you want to display
#-align can be 0 (left), 1 (center), or 2 (right). Anything larger than a 2
# will be treated as a specific x coordinate.
#-line number can range from 0 to 2, 0 is the first line, 2 is the last,
# and decimals are OK.
#-----------------------------------------------------------------------------
# Put a # in front of the ones you don't want to show
# **Don't forget the comma after each []!**
["Some Text Here", 300, 1.8],
]
THINGS = [
#-----------------------------------------------------------------------------
# Variables to show on the save/load screen.
# Format:
# ["name", "value", x position or align, line number],
#-----------------------------------------------------------------------------
#-"name" can be called whatever you want, as long as there are no spaces.
# I'd recommend naming it something useful so you know what it is, and to
# put "_s" (for save) at the end so there are no conflicts with other things.
#-"value" is any bit of game data that you want to show up on the save.
#-----------------------------------------------------------------------------
# Put a # in front of the ones you don't want to show
# **Don't forget the comma after each []!**
["playtime_s", "$game_system.playtime_s", 2, 0],
["location_s", "$game_map.display_name", 2, 1],
#["gamevariable1", "$game_variables[1]", 2, 2],
]
#
# These are safety locks to make sure that nothing goes offscreen. Comment
# them out if you'd rather not have them.
if (Window_Width + ShiftX) > Graphics.width
Window_Width -= ShiftX
end
if (MsgWindow_Width + MsgWindow_ShiftX) > Graphics.width
MsgWindow_Width -= MsgWindow_ShiftX
end
#-----------------------------------------------------------------------------
# **END OF CONFIGURATION**
#-----------------------------------------------------------------------------
end
#--------------------------------------------------------------------#
# !!! Beware of crashes and errors if you edit beyond this point !!! #
#--------------------------------------------------------------------#
module DataManager
def self.make_save_header
header = {}
header[:faces] = $game_party.faces_for_savefile
header[:characters] = $game_party.characters_for_savefile
header[:equipicons] = $game_party.equippedicons_for_savefile
MISav::THINGS.each do |item|
header[item[0].to_sym] = eval item[1]
end
header
end
def self.savefile_max
return MISav::Max_Savefiles
end
end
module Vocab
SaveMessage = MISav::SaveMsg
LoadMessage = MISav::LoadMsg
File = MISav::FileName
end
class Game_Party
def faces_for_savefile
battle_members.collect do |actor|
[actor.face_name, actor.face_index]
end
end
def equippedicons_for_savefile
battle_members.collect do |actor|
equipped = []
actor.equips.each do |item|
if defined? item.icon_index
equipped.push(item.icon_index)
else
equipped.push(0)
end
end
equipped
end
end
end
class Window_SaveFile
include MISav
def initialize(height, index)
super(ShiftX, index * height + ShiftY, Window_Width, height)
@file_index = index
refresh
@selected = false
end
def refresh
contents.clear
draw_party_characters(PARTY_X, PARTY_Y, PARTY_SPACING) if Show_Party
draw_face_characters(FACE_X, FACE_Y, FACE_SPACING) if Show_Faces
draw_custom_items
draw_equipped(EQUIP_X, EQUIP_Y, EQUIP_SPACING, EQUIP_SET_SPACING) if Show_Equipment
change_color(normal_color)
name = Vocab::File + " #{@file_index + 1}"
draw_text(4, 0, 200, line_height, name)
@name_width = text_size(name).width
end
def draw_party_characters(x, y, spacing)
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 * (32 + spacing), y)
end
end
def draw_face_characters(x, y, spacing)
header = DataManager.load_header(@file_index)
return unless header && header[:faces]
header[:faces].each_with_index do |data, i|
draw_face(data[0], data[1], x + i * (96 + spacing), y)
end
end
def draw_equipped(x, y, space, set_space)
header = DataManager.load_header(@file_index)
return unless header && header[:equipicons]
offset = 24 + space
space_set = 24 + set_space
header[:equipicons].each_with_index do |equips, set|
if Equipment_Collapse
one = 0
equips.each do |icon_index|
next if icon_index == 0
draw_icon(icon_index, x + set * space_set * 4 + one * offset, y)
one += 1
end
else
equips.each_with_index do |icon_index, one|
next if icon_index == 0
draw_icon(icon_index, x + set * space_set * 4 + one * offset, y)
end
end
end
end
def draw_custom_items
header = DataManager.load_header(@file_index)
return unless header
lh = line_height
TEXT.each do |item|
if item[1] > 2
draw_text(item[1], lh * item[2], contents.width - 4, lh, item[0])
else
draw_text(0, lh * item[2], contents.width - 4, lh, item[0], item[1])
end
end
THINGS.each do |item|
data = header[item[0].to_sym]
if item[2] > 2
draw_text(item[2], lh * item[3], contents.width - 4, lh, data)
else
draw_text(0, lh * item[3], contents.width - 4, lh, data, item[2])
end
end
end
end
class Scene_File
def start
super
create_help_window if MISav::Show_Msg
create_savefile_viewport
@savefile_viewport.rect.height -= 32
create_savefile_windows
init_selection
end
def create_help_window
@help_window = Window_Help.new(1)
@help_window.set_text(help_window_text)
@help_window.x = MISav::ShiftX
@help_window.y = MISav::ShiftY
@help_window.width = MISav::Window_Width
end
def visible_max
MISav::Number_Viewable
end
def savefile_height
@savefile_viewport.rect.height/visible_max - MISav::ShiftY/visible_max
end
end