################################################################################ #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓# #↓ ↓# #↓ Named Save Profiles: Version 0.1 ↓# #↓ ↓# #↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕# #↑ ↑# #↑ Written By: Joseph Hale ↑# #↑ Last Edited: November 12, 2014 ↑# #↑ ↑# #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑# ################################################################################ #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙ ** Disclaimer ◙# #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙# #◙ ◙# #◙ This script is not for commercial use. If you wish to use this script in a ◙# #◙ game please PM me. All credit is to be given to me as the author of this ◙# #◙ script. Do not remove or edit any tags. ◙# #◙ ◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙ ** How To Use ◙# #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙# #◙ ◙# #◙ * Set-up area below. ◙# #◙ ◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙ ** Updates / Version Notes ◙# #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙# #◙ ◙# #◙ v0.1 ◙# #◙ ~◄◙◙◙◙►~ ◙# #◙ * This script allows you to name your save file a custom name. ◙# #◙ ◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# ################################################################################ #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓# #↓ ↓# #↕ Named Save Profiles: Version 0.1 ↕# #↑ ↑# #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑# ################################################################################ #============================================================================== # ** Named Save Profiles #------------------------------------------------------------------------------ # This module manages the customizable and function modules. #============================================================================== module Named_Save_Profiles #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# Default_Profile_Name = "New Profile" Max_Characters = 14 #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙End Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙# end #============================================================================== # ** 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 #-------------------------------------------------------------------------- # * Create Save Header #-------------------------------------------------------------------------- def self.make_save_header header = {} header[:characters] = $game_party.characters_for_savefile header[:playtime_s] = $game_system.playtime_s header[:party_name] = $game_party.party_name header 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 #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :party_name # Party's Name #-------------------------------------------------------------------------- # * Aliasing Method: Object Initialization #-------------------------------------------------------------------------- alias :gpi06546132004064 :initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize gpi06546132004064() @party_name = nil end end #============================================================================== # ** Window_SaveFile #------------------------------------------------------------------------------ # This window displays save files on the save and load screens. #============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear change_color(normal_color) name = save_file_headers(:party_name) ? save_file_headers(:party_name) : Named_Save_Profiles::Default_Profile_Name + " " + (@file_index + 1).to_s 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) end #-------------------------------------------------------------------------- # * Draw Play Time #-------------------------------------------------------------------------- def save_file_headers(header) headers = DataManager.load_header(@file_index) return unless headers value = headers[header] value end end #============================================================================== # ** Window_NameEdit #------------------------------------------------------------------------------ # This window is used to edit an actor's name on the name input screen. #============================================================================== class Window_ProfileNameEdit < Window_Base #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :name # name attr_reader :index # cursor position attr_reader :max_char # maximum number of characters #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(max_char) x = (Graphics.width - 360) / 2 y = (Graphics.height - (fitting_height(4) + fitting_height(9) + 8)) / 2 super(x, y, 360, fitting_height(4)) @max_char = max_char @default_name = Named_Save_Profiles::Default_Profile_Name + " " + (DataManager.last_savefile_index + 1).to_s @name = @default_name @index = @name.size deactivate refresh end #-------------------------------------------------------------------------- # * Revert to Default Name #-------------------------------------------------------------------------- def restore_default @name = @default_name @index = @name.size refresh return !@name.empty? end #-------------------------------------------------------------------------- # * Add Text Character # ch : character to add #-------------------------------------------------------------------------- def add(ch) return false if @index >= @max_char @name += ch @index += 1 refresh return true end #-------------------------------------------------------------------------- # * Go Back One Character #-------------------------------------------------------------------------- def back return false if @index == 0 @index -= 1 @name = @name[0, @index] refresh return true end #-------------------------------------------------------------------------- # * Get Coordinates of Left Side for Drawing Name #-------------------------------------------------------------------------- def left name_center = contents_width / 2 name_width = (@max_char + 1) * char_width return [name_center - name_width / 2, contents_width - name_width].min end #-------------------------------------------------------------------------- # * Get Character Width #-------------------------------------------------------------------------- def char_width text_size($game_system.japanese? ? "あ" : "A").width end #-------------------------------------------------------------------------- # * Get Rectangle for Displaying Item #-------------------------------------------------------------------------- def item_rect(index) Rect.new(left + index * char_width, 36, char_width, line_height) end #-------------------------------------------------------------------------- # * Get Underline Rectangle #-------------------------------------------------------------------------- def underline_rect(index) rect = item_rect(index) rect.x += 1 rect.y += rect.height - 4 rect.width -= 2 rect.height = 2 rect end #-------------------------------------------------------------------------- # * Get Underline Color #-------------------------------------------------------------------------- def underline_color color = normal_color color.alpha = 48 color end #-------------------------------------------------------------------------- # * Draw Underline #-------------------------------------------------------------------------- def draw_underline(index) contents.fill_rect(underline_rect(index), underline_color) end #-------------------------------------------------------------------------- # * Draw Text #-------------------------------------------------------------------------- def draw_char(index) rect = item_rect(index) rect.x -= 1 rect.width += 4 change_color(normal_color) draw_text(rect, @name[index] || "") end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear @max_char.times {|i| draw_underline(i) } @name.size.times {|i| draw_char(i) } cursor_rect.set(item_rect(@index)) end end #============================================================================== # ** Scene_Name #------------------------------------------------------------------------------ # This class performs name input screen processing. #============================================================================== class Scene_ProfileName < Scene_MenuBase #-------------------------------------------------------------------------- # * Prepare #-------------------------------------------------------------------------- def prepare(max_char) @max_char = max_char end #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super @edit_window = Window_ProfileNameEdit.new(@max_char) @input_window = Window_NameInput.new(@edit_window) @input_window.set_handler(:ok, method(:on_input_ok)) end #-------------------------------------------------------------------------- # * Input [OK] #-------------------------------------------------------------------------- def on_input_ok $game_party.party_name = @edit_window.name $game_map.autoplay SceneManager.goto(Scene_Map) end end #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs the title screen processing. #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * [New Game] Command #-------------------------------------------------------------------------- def command_new_game DataManager.setup_new_game create_profile_name end #-------------------------------------------------------------------------- # * Create Profile Nameing Window #-------------------------------------------------------------------------- def create_profile_name SceneManager.call(Scene_ProfileName) SceneManager.scene.prepare(Named_Save_Profiles::Max_Characters) end end