#============================================================================== # Improved Save # By gerkrt/gerrtunk # Version: 1 # License: GPL, credits #============================================================================== =begin ----INTRODUCTION AND SCRIPT DESCRIPTION----- This script has been created with the idea to give the maxium freedom and possibilities to the creator. I think this system open many new ways, but i may take some work for you. Anyway the script comes with a working default configuration for each feature and also have the option to make autoconfigurations. Turning on/off a feature only needs to changue one option. Main systems: -Autosave system with temporizer or/and map script calls. The autosave warns you activating a switch everytime is autosaved. Use a reserved slot for this system that can be protected. -Quicksave system. This lets the player to save everywhere, with the condition that the quick savegame will be erased. Use a reserved slot for this system, that can be protected. It have a must load option that protect agains cheaters. -One slots modes. They make all the save and load process automatically. Also exist a Quicksaving one slot mode that works like roguelikes ones. -Complete event save control system. You can now save, load, erase, check if savegame exist, keep savegame information in event variables, quick save and autosave with simple script calls. It also have a function to call the load game menu. -Very complex and complete graphic personalitzation. Now savegames can show: steps map description(based on maps id) map name gameplay time date description(a text thats saved with the game. Ex: "Chapter I") money completed game(based on event variable) actors names actors levels actors graphics actors faces There are two graphic configuration modes. With the automatic you can set all that things in two lines, but with the advanced you can select also every option position. and other extra things. It also add the follow features: -Backwindows and backscene based on images -You can configurate windows transparencys and visibility. -Some control over the fonts. -Other features: -You can select savegame folder, savegames names and extensions. -Warning messages. -Main menu quicksave entry -Configurable slot number. -Extended vocabulary configuration -High compatibality. You can disable individually the changues to game_system, title, end or main menu. -In progress features: -Slot sort system -Graphic mode with one actor games in mind. -Improved slot visually identification. -Definition of font for each text. -Some compatibility improvements -Planned features: -Use of icons -New base graphic styles -More complex save scene -Screen captures -Extended roguelike style support ----IMPORTANT INFORMATION----- -Activate or desactive the first value of a system desactive all the other options. You dont have to changue nothing. -You dont need to configurate nothing, it will just work in the more standard way. -The configuration options are sorted by importance. -You will find the configuration module after each module instructions. This is the module index: -Quicksave -Autosave -One slot modes -Graphic options -General options -Save controlled by events -Vocabulary -Compatibality -----QUICKSAVE------- To enable: Quicksave = true After_quicksave: If 0 the game will quit, if 1 it will go to title. Quicksave_sep_slot: Protect the slot making that it cant be saved via save menu Main_menu_quicksave: Enables the main menu quicksave entry. Quicksave_warning_message: It will show a warning message telling that the quicksave have been compelted with exit. Must_load: This make that if exist a quicksave slot, it will automatically load and erase it. The load menu is skipped. $game_system.disabled_quicksave = true : This script call will disable the quicksave main menu entry. $game_system.disabled_quicksave = false : This script call will enable the quicksave main menu entry. =end module Wep # Quicksave Quicksave = true After_quicksave = 0 Must_load = true Quicksave_slot = 1 Quicksave_warning_message = true Quicksave_sep_slot = true Main_menu_quicksave = true end =begin -----AUTOSAVE------- To enable: Autosave = true Autosave_type: Define the autosave work mode. If its 0 it will be automatically saved and also you can call script $game_system.map_autosave to force a autosave. If its 1 it will use script calls. Switch_info: Defines the switch that its actived when the automatic save(with timer) is done. Autosave_time: Frames between each autosave. Uses the same measure that wait command. 2 frames x second.` Autosave_sep_slot: Protect autosave slot to being saved via menu. $game_system.disabled_autosave = true : This script call will stop autosave timer. $game_system.disabled_autosave = false : This script call will start autosave timer. $game_system.restart_auto_save_count : This script call will restart autosave timer. =end module Wep # Autosave system Autosave = true Autosave_type = 0 # 0: Time and calls. 1: Only user defined map calls Autosave_time = 30 Switch_info = 1 Autosave_slot = 2 Autosave_sep_slot = true end =begin -----ONE SLOT MODE------- To active: One_slot_mode = true This mode was created with games that only need one slot. They can be cinematic, lineal or whatever... the good thing is that with this system save and load are done automatically in the slot you defined, withou accesing any save meu. One_slot_mode_slot: Here you define the sot where the game is saved in this mode. -----QUICKSAVING ONE SLOT MODE------- To active: One_slot_mode_quicksaving = true This mode work like the first, but the savegame will be erased when loaded. This system is used for example in roguelikes where you can only die one time, but you can save as long you dont die. After_quicksaving: Defines the behavior of the post quicksave. 0 will quit, 1 will return to title. Quicksaving_warning_message: Actives a warning message that says that the save have done correctly. This script will use the normal save vocabulary, but the internal functions are quicksave ones. =end module Wep # One slot modes One_slot_mode = false One_slot_mode_quicksaving = false After_quicksaving = 0 #Quit, scene end,scene tittle Quicksaving_warning_message = true One_slot_mode_slot = 2 end =begin ------GRAPHIC CONFIGURATION-------- ######################### ######## INDEX ########## ######################### 1- Image based back windows and general scene 2- Windows transparency 3- Font options 4- Other options 5- Save slot options to show 5.A- Novice(Automatic mode) 5.B- Advanced 6- Map descriptions, completed game % and textual description 7- Faces configuration Advice: The normal will be that just using basic and novice options you are ok. You dont need to read or use the rest. If you only need to configure the options to show in savegames go to 6. ################################################################# ######## 1- Image based back windows and general scene ########## ################################################################# Save_windows_background, Help_windows_background Scene_background. They should use the same sizes of the windows that default are: Save: 640,104 Help: 640, 64 General scene: 640, 480 To load a picture you have to changue the name in something different than "": Scene_background = "Scene.png" Think that this images cant be showed if you dont adjust windws transparencys. ########################################### ######## 2- Windows transparency ########## ########################################### The variables are: Save_windows_opacity = 255 Save_windows_back_opacity = 255 Help_windows_opacity = 255 Help_windows_back_opacity = 255 The value must be in 0-255 range. 255 means totally shown. The difference betwen opacity and back opacity is that back opacity only defines the back part of the window and normal opcity also defines the windows borders. ################################## ######## 3- Font options ######### ################################## The variables are: Basic_color: Defines the default color used for all normal texts. Description_color: This is used to improve the aestethics, for example, defines the color of the text "Steps" that goes before the steps number. The default color is based on the internal rgss system color. Description_bold: This option defines if it also uses a bold font. Save_window_font_name: Self explanatory Help_window_font_name: Self explanatory Slot_window_font_name: This defines the font of the small window that shows slot number. General_info_font_size: Defines the font size of all the texts of general informtion(like steps, gold...) Actor_info_font_size: Defines the font size of all the texts of actors informtion(name and level) If you put "" in a font name it will use the default one. Creating colors: Basic_color = Color.new(255, 255, 255, 255) It means: Basic_color = Color.new(red, green, blue, alpha). Values beyond 0-255. ################################### ######## 4- Other options ######### ################################### Warning_message_position = Warning messages position. x,y ยด Identifier_text_position = The texts that are drawn in empty slots positions. x,y Help_window_visible: Defines if the help window is visible or not. ############################################# ######## 5- Save slot options to show ####### ############################################# ############################################# ######## 5.A- Novice(Automatic mode) ######## ############################################# You only need to define what options do you want: Quick_general_info = ['steps', 'map_description', 'time', 'description'] This will show the step number, map based description, gameplay time and a textual description. They will be draw in that order. All the other things are automatic, and with this modes you cant define any postion. You can put less than 4 options or leave one blank writing the code '' Code list: steps map_description: map based description(read more above) map_name time date description: textual description (read more above) money completed_game: % of completed game(read more above) Quick_actors_info = ['name', 'level', 'face'] This will show actors names, levels and faces(read more above). There is an extra option called 'graphic' that will show the actor map character graphic. The graphic and face options are incompatible. Works like the first quick setting but with any order. The only configuration that you can do in this mode are: Face_transparency Face_separation ################################# ######## 5.B- Advanced ########## ################################# First you must know that you can use one of the two quick settings. Ex: If you define Quick_actors_info you will can define each option for general info. To put a quick setting of: Quick_actors_info = false Activating options and configurating positions: Show_name = true Name_position = [108,4] Now it enables show name and it will be drawed in the position x=108, y=4. All the options are explained in the config module. Advices to edit positions: -In loop: The actor information is show with a loop. This means that the position x is relative, and that is value is defined by a complex formula that you can somewhat influence. As a basis the x is multiplied for the index of the actor in the party(starting by 0) to show one before other. -You can use negative values in the positions. -You can use blank spaces in the vocabulary to control the distance between them. -All default values are the same that areused internally by the automatic mode. -The y position of the general informations is calculated this way: When first option the y is -9 When second option the y is 11 When third option the y is 30 When four option the y is 46 ################################################################################# ######## 6- Map descriptions, completed game % and textual description ########## ################################################################################# Map descriptions: To add new descriptions you have to add a newline like this: [[7,8,9,10,11], "Last boss"], The first are the maps ids, the second the description for they. The last line cant have the , at the end. And must have a closing ] Map_descriptions = ["Default description",[[1,2,3], "Ahmbra forest"], [[4,5,6], "Dragon dungeon"]] The default description will be used for all the maps that you dont specify a new description. In this example it will have to be like this: Map_descriptions = ["Default description",[[1,2,3], "Ahmbra forest"], [[4,5,6], "Dragon dungeon"], [[7,8,9,10,11], "Last boss"]] Completed game %: Variable_completed_game: This is the id of event variable in wich is based this option. Textual description: This a text that is going to be saved in the savegame. A phrase. It can have a lot of uses, for example, a game that works with argumental chapters can also show they here. To define the text call this script: text = "Chapter I" $game_system.save_description = text You can changue it anytime you want, and the value isnt reset when you quit the game. ########################################## ######## 7- Faces configuration ########## ########################################## To load faces you will need to add pictures for each actor called Saveface_actorname Ex: Alexis--> Saveface_Alexis.png The image can have any size between heigh 0-96 and width 0-96. Something like 96x96 is the standard. Face_transparency: This defines the grade of opaciry of the image Face_separation: A value in wich is based face image separation algorithm. You might want to use it when you are using faces with stranfe sizes. =end module Wep # General Scene_background = "" # Warning_message_position = [220,200] Identifier_text_position = [4,20] # Save windows Save_windows_opacity = 255 Save_windows_back_opacity = 255 Save_windows_background = "" # Help windows Help_windows_opacity = 255 Help_windows_back_opacity = 255 Help_window_background = "" Help_window_visible = true # Font Basic_color = Color.new(255, 255, 255, 255) Description_color = Color.new(192, 224, 255, 255) Description_bold = true Save_window_font_name = "Times New Roman" Help_window_font_name = "Times New Roman" Slot_window_font_name = "Times New Roman" General_info_font_size = 22 Actor_info_font_size = 22 # Quick configurators Quick_general_info = ['steps', 'description', 'time', 'map_description'] Quick_actors_info = ['name', 'level', 'graphic'] # Advanced configurator # Actors information Show_name = true # Names Name_position = [108,48] Show_level = true # Levels Level_position = [108,30] Show_faces = true # Faces Face_transparency = 75 Face_separation = 105 Face_position = [0,68] Show_graphic = false # Characters map graphics Graphic_position = [160,54] # General information Show_time = true # Gameplay time Time_position = [0,-9] Show_steps = false # Steps Steps_position = [0,-9] Show_date = false # Date Date_position = [0,11] Show_money = false # Money Money_position = [0,11] Show_map_name = false # Map name Map_name_position = [0,30] Show_map_description = true # Map description Map_description_position = [0,30] Map_descriptions = ["Default description",[[1,2,3], "Ahmbra forest"], [[4,5,6], "Dragon dungeon"]] Show_completed_game = true # Completed game % Completed_game_position = [0,47] Variable_completed_game = 1 Show_description = true # Textual description Description_position = [0,47] end =begin ------GENERAL OPTIONS-------- Save_folder: The name of the directory for save slots. Save_folder = "" Max slots: Maxium slots to use. Max is 1000. File_name: The name of the files created by the program. Saves_extension: Defines the save files extension. =end module Wep # General options Max_slots = 7 Save_folder = "Saves" File_name = "Ranura" Saves_extension = ".rxdata" end =begin -----EVENT SAVE CONTROL------- Scripts calls: $game_system.map_quicksave : Save the game in the quicksave slot. $game_system.map_autosave : Save the game in the autosave slot. $game_system.load_slot(X) : Load the game in slot X. $game_system.save_slot(X) : Save the game in slot X. $game_system.erase_slot(X) : Erase the game in slot X. $game_system.slot_exist(X) : It tells you if slot X exist. Have two uses_: 1-The script returns true/false, you can use it in a conditional branch script option. 2-Script also saves true/fase in the switch defined by Sw_file_exist. $game_system.slot_info(X) : It save the slot information in the slots you defined. -Date -Time -Steps -Gold -Group actors ids -Group actors levels $scene = Scene_Load.new(true): Call load menu in a map. =end module Wep Sw_file_exist = 2 Vars_actors_ids = [1,2,3,4] # Group actors ids Vars_actors_levels = [5,6,7,8] # Group actors levels # Date: Year, Month, Day, Hour, Minute, Second Vars_date = [9,10,11,12,13,14] # Time: Hour, minute, second Vars_time = [15,16,17] Vars_money = 18 # Gold Vars_steps = 19 # Steps end =begin -----VOCABULARY------- Remember that you can use special signes, modify spaces or make it empty with text="" =end module Wep # Save menu Save_description_text = "Select slot to save your game" Load_description_text = "Select slot to load your game" Money_text = "Money " Steps_text = "Steps " Level_text = "Lv." Completed_game_text = "% completed" Empty_slot = "Empty slot" Slot = 'Slot ' Empty_quicksave_slot_text = "Empty quicksave slot" Empty_autosave_slot_text = "Empty autosave slot" Quicksave_slot_text = "Quicksave" Autosave_slot_text = "Autosave" Slot_dont_exist = "Nonexistent slot" # Main menu (Scene_Menu) Warning_message_text = "Quicksave completed" Warning_message_one_slot_text = "Save completed" Main_menu_quicksave_text = "Quicksave" Main_menu_status_text = "Status" Main_menu_quit_text = "Exit" Main_menu_save_text = "Save" # Title (Scene_Title) Title_quickload = "Quickload" New_game_text = "New game" Load_game_text = "Load" Quit_game_text = "Exit" end =begin -----COMPATIBILITY---- This script is coded in a modular and flexible structure. You can totally desactivate some of the features to improve compatibility with others scripts. With each option is explained what features and options you will lose. Main_menu_modification: -Quicksave entry in main menu and all its options. -Revamped style -Vocabulary of that scene Title_modification: -Quicksave: Must load option -Vocabulary of that scene -One slot modes =end module Wep Main_menu_modification = true Title_modification = true end ###### SCRIPT CODE DONT TOUCH THIS ######## #============================================================================== # Warning message # By gerkrt/gerrtunk # Version: 1 # License: GPL, credits #============================================================================== =begin I created this script long ago for one of my menus and any other project. Its very flexible and can be used for a lot of things. It uses a modified window+sprite combination because i think that it looks better, anyway you can modify it or do what you want. -The window size and position is based on the text size. -All other sizes or positions are set automatically. -It have methods for automatically visible/invisible, dipose,etc, all sprites and windows. -You can add a question to it. With this a modified version of a window command is actived. -You can changue the text, ask option, x and y in every call. I use it with a variable in the Scene called "Warning_message_type" that defines the behavior of it. =end class Warning_Message def initialize # Default values when refreshing it @default_x = 200 @default_y = 200 # Back text window @text_window = Window_Base.new(120, 136, 400, 64) @text_window.z = 252 @text_window.visible = false # Text sprite @text_sprite = Sprite.new @text_sprite.z = 254 @text_sprite.x = 120 @text_sprite.y = 136 @text_sprite.bitmap = Bitmap.new(400,64) # Testing bitmap for size test @testing_bitmap = Bitmap.new(1,1) # Question window @question_window = Window_Selection.new(80, ["Yes", "No"]) @question_window.x = 280 @question_window.y = 200 @question_window.z = 253 @question_window.back_opacity = 0 @question_window.opacity = 0 @question_window.active = false @question_window.visible = false # Back question window @back_question_window = Window_Base.new(120, 136, 64, 64) @back_question_window.x = 280 @back_question_window.y = 200 @back_question_window.z = 254 @back_question_window.visible = false end # Make all the sprites/windows visibles def visible @text_window.visible = true @text_sprite.visible = true # Question ones only if active if @question_window.active @question_window.visible = true @back_question_window.visible = true end end # Make all the sprites/windows invisibles def no_visible @text_window.visible = false @text_sprite.visible = false @question_window.visible = false @back_question_window.visible = false end # Is question window active? def active return @question_window.active end # Set question window active def active=(value) @question_window.active = value end # Update all the sprites/windows visibles def update @text_window.update @text_sprite.update @back_question_window.update @question_window.update end # Draw the warning message # question: called to add a yes/no window. def refresh(message, question=false, x=@default_x, y=@default_y) # Basic position settings @text_window.y = y @text_window.x = x @text_sprite.x = x @text_sprite.y = y rect = @testing_bitmap.text_size(message) # With question window or not. All the positions auto-setting are done here. if question @text_window.width = rect.width+26+40 @question_window.visible = true @question_window.active = true @back_question_window.visible = true @question_window.x = @text_window.x+rect.width+4+6 @question_window.y = @text_window.y - 16 @back_question_window.x = @text_window.x+rect.width+4+16 @back_question_window.y = @text_window.y else @text_window.width = rect.width+26 end # First update the back window @text_window.update @text_sprite.bitmap.clear # Draw text @text_sprite.bitmap.draw_text(0+10,0,400,64,message, 0) @text_sprite.update end # Dispose all the sprites/windows visibles def dispose @text_window.dispose @text_sprite.dispose @question_window.dispose @back_question_window.dispose end end class Window_Selection < Window_Command #-------------------------------------------------------------------------- # * Update Cursor Rectangle #-------------------------------------------------------------------------- def update_cursor_rect # If cursor position is less than 0 if @index < 0 self.cursor_rect.empty return end # Get current row row = @index / @column_max # If current row is before top row if row < self.top_row # Scroll so that current row becomes top row self.top_row = row end # If current row is more to back than back row if row > self.top_row + (self.page_row_max - 1) # Scroll so that current row becomes back row self.top_row = row - (self.page_row_max - 1) end # Calculate cursor width cursor_width = (self.width / @column_max - 32)+11 # Calculate cursor coordinates x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 32 - self.oy # Update cursor rectangle self.cursor_rect.set(x-4, y, cursor_width, 32) end end module Wep Save_windows_size = [640,104] end #-------------------------------------------------------------------------- # * Compatibility check: Main menu modification #-------------------------------------------------------------------------- if Wep::Main_menu_modification # Main menu quicksave addittion if Wep::Main_menu_quicksave and Wep::Quicksave #============================================================================== # ** Window_PlayTime #------------------------------------------------------------------------------ # Modified #============================================================================== class Window_PlayTime < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 160, 50) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, -5, 120, 32, text, 2) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if Graphics.frame_count / Graphics.frame_rate != @total_sec refresh end end end end #================================================================="============= # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs menu screen processing. #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # * Object Initialization # menu_index : command cursor's initial position #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index @warning_message_active = false # Used to check for warning message active or not end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Create warning window @warning_window = Warning_Message.new # If main menu quicksave are active all the initialitzation is modified if Wep::Main_menu_quicksave and Wep::Quicksave and not Wep::One_slot_mode_quicksaving # Make command window s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = Wep::Main_menu_status_text s5 = Wep::Main_menu_save_text s6 = Wep::Main_menu_quicksave_text s7 = Wep::Main_menu_quit_text @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7]) @command_window.index = @menu_index # If number of party members is 0 if $game_party.actors.size == 0 # Disable items, skills, equipment, and status @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # If save is forbidden if $game_system.save_disabled # Disable save @command_window.disable_item(4) end if $game_system.disabled_quicksave != nil # If quick save is forbidden if $game_system.disabled_quicksave # Disable save @command_window.disable_item(6) end end # Resize windows and changue positions to give space to quicksave entry @command_window.height+= 14 # Make play time window @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 366 # Make steps window @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 270 # Crear ventana de lugares # Make gold window @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # Make status window @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 else # Make command window s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = Wep::Main_menu_status_text s5 = Wep::Main_menu_save_text s6 = Wep::Main_menu_quit_text @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index # If number of party members is 0 if $game_party.actors.size == 0 # Disable items, skills, equipment, and status @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # If save is forbidden if $game_system.save_disabled # Disable save @command_window.disable_item(4) end # Make play time window @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 # Make steps window @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 # Make gold window @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # Make status window @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 end # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @command_window.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @status_window.dispose @warning_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @command_window.update @playtime_window.update @steps_window.update @gold_window.update @status_window.update @warning_window.update # If warning message active if @warning_message_active update_advertencia return end # If command window is active: call update_command if @command_window.active update_command return end # If status window is active: call update_status if @status_window.active update_status return end end #-------------------------------------------------------------------------- # * Frame Update (Advertencia) #-------------------------------------------------------------------------- def update_advertencia # If any key is press, exit game checking for after quicksyve stle if Input.trigger?(Input::B) or Input.trigger?(Input::C) or Input.trigger?(Input::Z) or Input.trigger?(Input::B) if not Wep::One_slot_mode_quicksaving if Wep::After_quicksave == 0 # End game Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil elsif Wep::After_quicksave == 1 # To title $scene = Scene_Title.new end else if Wep::After_quicksaving == 0 # End game Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil elsif Wep::After_quicksaving == 1 # To title $scene = Scene_Title.new end end return end end #-------------------------------------------------------------------------- # * Frame Update (when command window is active) #-------------------------------------------------------------------------- def update_command # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to map screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # If command other than save or end game, and party members = 0 if $game_party.actors.size == 0 and @command_window.index < 4 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Branch by command window cursor position case @command_window.index when 0 # item # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to item screen $scene = Scene_Item.new when 1 # skill # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # equipment # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # status # Play decision SE $game_system.se_play($data_system.decision_se) # Make status window active @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 # save # If its one slot mode save directly in selected slot if Wep::One_slot_mode # If saving is forbidden if $game_system.save_disabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) slot = Wep::One_slot_mode_slot guard_rap = false temp = Scene_Save.new file = File.open(Wep::Save_folder+"\\"+Wep::File_name+slot.to_s+Wep::Saves_extension, "wb") temp.write_save_data(file, guard_rap) file.close # If its one slot quicksaving mode save directly in selected slot and exit elsif Wep::One_slot_mode_quicksaving # If saving is forbidden if $game_system.save_disabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) $game_system.se_play($data_system.save_se) $game_system.save_slot(Wep::One_slot_mode_slot) if Wep::Quicksaving_warning_message @warning_message_active = true @command_window.active = false @warning_window.visible @warning_window.refresh(Wep::Warning_message_one_slot_text, question=false, Wep::Warning_message_position[0], Wep::Warning_message_position[1]) else if Wep::After_quicksaving == 0 # Termina el programa Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil elsif Wep::After_quicksaving == 1 # Vuelve al titulo $scene = Scene_Title.new end end # Normal save else # If saving is forbidden if $game_system.save_disabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to save screen $scene = Scene_Save.new end when 5 # quicksave or end # Depending on menu configuration if Wep::Main_menu_quicksave and Wep::Quicksave and not Wep::One_slot_mode_quicksaving # If quick saving is forbidden if $game_system.disabled_quicksave != nil if $game_system.disabled_quicksave # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end end # Play decision SE $game_system.se_play($data_system.decision_se) $game_system.map_quicksave $game_system.se_play($data_system.save_se) if Wep::Quicksave_warning_message and Wep::Quicksave @warning_message_active = true @command_window.active = false @warning_window.visible @warning_window.refresh(Wep::Warning_message_text, question=false, Wep::Warning_message_position[0], Wep::Warning_message_position[1]) else if Wep::After_quicksave == 0 # Termina el programa Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil elsif Wep::After_quicksave == 1 # Vuelve al titulo $scene = Scene_Title.new end end else # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to end game screen $scene = Scene_End.new end when 6 # end game in quicksave mode # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to end game screen $scene = Scene_End.new end return end end end end class Game_System attr_accessor :disabled_quicksave attr_accessor :disabled_autosave attr_accessor :save_description attr_accessor :autosave_count attr_accessor :autosave_running alias old_initialize initialize def initialize @disabled_autosave = false @disabled_quicksave = false @save_description = "Chapter I" @autosave_count = Wep::Autosave_time @autosave_running = Wep::Autosave && Wep::Autosave_type == 0 ? true : false old_initialize end #-------------------------------------------------------------------------- # * Autosave count restart #-------------------------------------------------------------------------- def restart_auto_save_count # Restart timer @autosave_count = Wep::Autosave_time end #-------------------------------------------------------------------------- # * Autosave check #-------------------------------------------------------------------------- def auto_save_update # Reduces time if enabled if Wep::Autosave_type == 0 and @autosave_count > 0 and @autosave_running and not @disabled_autosave @autosave_count -= 1 end if Wep::Autosave_type == 0 and @autosave_count == 0 and @autosave_running # Check for save map_autosave # Inform player $game_switches[Wep::Switch_info] = true # Restart timer @autosave_count = Wep::Autosave_time end end #-------------------------------------------------------------------------- # * Update timer. Modded: Also updates autosave timer. #-------------------------------------------------------------------------- def update if @timer_working and @timer > 0 @timer -= 1 end auto_save_update end end class Game_System #-------------------------------------------------------------------------- # * Map autosave #-------------------------------------------------------------------------- def map_autosave temp = Scene_Save.new file = File.open(Wep::Save_folder+"\\"+Wep::File_name+(Wep::Autosave_slot).to_s+Wep::Saves_extension, "wb") temp.write_save_data(file) file.close end #-------------------------------------------------------------------------- # * Map quicksave #-------------------------------------------------------------------------- def map_quicksave temp = Scene_Save.new file = File.open(Wep::Save_folder + "\\" + Wep::File_name + Wep::Quicksave_slot.to_s + Wep::Saves_extension, "wb") temp.write_save_data(file) file.close end #-------------------------------------------------------------------------- # * Load slot #-------------------------------------------------------------------------- def load_slot(slot) $scene = Transfer_Scene.new(slot) end #-------------------------------------------------------------------------- # * Save slot #-------------------------------------------------------------------------- def save_slot(slot) temp = Scene_Save.new file = File.open(Wep::Save_folder+"\\"+Wep::File_name+slot.to_s+Wep::Saves_extension, "wb") temp.write_save_data(file) file.close end #-------------------------------------------------------------------------- # * Erase slot #-------------------------------------------------------------------------- def erase_slot(slot) if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension) File.delete( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension) end end #-------------------------------------------------------------------------- # * Slot exist? #-------------------------------------------------------------------------- def slot_exist(slot) if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension) $game_switches[Wep::Sw_file_exist] = true return true else return false end end #-------------------------------------------------------------------------- # * Slot info #-------------------------------------------------------------------------- def slot_info(slot) if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension) file = File.open( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension, "r") timestamp = file.mtime characters = Marshal.load(file) guard_rap = Marshal.load(file) psj = Marshal.load(file) dinero = Marshal.load(file) frame_count = Marshal.load(file) 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) total_sec = frame_count / Graphics.frame_rate file.close i=0 # Actors levels and ids for actor in game_party.actors $game_variables[Wep::Vars_actors_ids[i]] = actor.id $game_variables[Wep::Vars_actors_levels[i]] = actor.level i+=1 end # Date $game_variables[Wep::Vars_date[0]] = timestamp.year $game_variables[Wep::Vars_date[1]] = timestamp.month $game_variables[Wep::Vars_date[2]] = timestamp.day $game_variables[Wep::Vars_date[3]] = timestamp.hour $game_variables[Wep::Vars_date[4]] = timestamp.min $game_variables[Wep::Vars_date[5]] = timestamp.sec # Time hour = total_sec / 60 / 60 min = total_sec / 60 % 60 sec = total_sec % 60 $game_variables[Wep::Vars_time[0]] = hour $game_variables[Wep::Vars_time[1]] = min $game_variables[Wep::Vars_time[2]] = sec # Gold and steps $game_variables[Wep::Vars_money] = game_party.gold $game_variables[Wep::Vars_steps] = game_party.steps return true end end end #================================================================="============= # ** Transfer_Scene #------------------------------------------------------------------------------ # This scene is used as an intermediate scene to load games # slot: slot to load #============================================================================== class Transfer_Scene def initialize(slot) @slot = slot end def main # Normal load process file = File.open(Wep::Save_folder+ "\\"+ Wep::File_name+ @slot.to_s + Wep::Saves_extension, "rb") # One sp/hp onehp = Marshal.load(file) onesp = Marshal.load(file) # Description description = Marshal.load(file) # % completed game comp = Marshal.load(file) # Map map = Marshal.load(file) # Steps steps = Marshal.load(file) # Make medium levels for ordering save file medium_level=Marshal.load(file) # Read character data for drawing save file characters = Marshal.load(file) # Cargar personajes @psj = Marshal.load(file) # Cargar dinero @dinero = Marshal.load(file) # Read frame count for measuring play time Graphics.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) $game_temp = Game_Temp.new $game_system.bgm_stop # If magic number is different from when saving # (if editing was added with editor) if $game_system.magic_number != $data_system.magic_number # Load map $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # Refresh party members $game_party.refresh file.close # Check to erase save slots with some modes if Wep::Quicksave and @slot == Wep::Quicksave_slot $game_system.erase_slot(Wep::Quicksave_slot) end if Wep::One_slot_mode_quicksaving and @slot == Wep::One_slot_mode_slot $game_system.erase_slot(Wep::One_slot_mode_slot) end # Switch to map screen $scene = Scene_Map.new end end #================================================================="============= # ** Window_HelpSave #------------------------------------------------------------------------------ # Modified to that can be configurated by the player #============================================================================== class Window_HelpSave < Window_Help #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super self.contents = Bitmap.new(width - 32, height - 32) self.opacity = Wep::Help_windows_opacity self.back_opacity = Wep::Help_windows_back_opacity if Wep::Help_window_font_name != "" self.contents.font.name = Wep::Help_window_font_name end end end #================================================================="============= # ** Slot_Window #------------------------------------------------------------------------------ # This a window+sprite combined class. It enables to use very small # windows. # i: position multiplier #============================================================================== class Slot_Window def initialize(i) # Back window @ventana = Window_Base.new(0,104*i+64, 100,24) @ventana.visible = true @ventana.z = 249 # Text sprite @sprite = Sprite.new @sprite.bitmap = Bitmap.new(@ventana.width, @ventana.height) @sprite.bitmap.font.size = 14 # Font setting if Wep::Slot_window_font_name != "" @sprite.bitmap.font.name = Wep::Slot_window_font_name end @sprite.z = 250 @sprite.x = 0 @sprite.y = 104*i+64 @sprite.visible = true end # Draw the text def refresh(text) @ventana.update @sprite.bitmap.clear # Font setting @sprite.bitmap.font.color = Wep::Basic_color @sprite.bitmap.draw_text(0,-2,@ventana.width,32, text.to_s, 1) end # Dispose all def dispose @ventana.dispose @sprite.dispose end end #============================================================================== # ** Scene_File #------------------------------------------------------------------------------ # This is a superclass for the save screen and load screen. #============================================================================== class Scene_File #-------------------------------------------------------------------------- # * Object Initialization # help_text : text string shown in the help window # type : true=save false=load scene #-------------------------------------------------------------------------- def initialize(help_text, file_index, tipo) @help_text = help_text @file_index = file_index @type = tipo # Create Folder for Save file if Wep::Save_folder != "" Dir.mkdir(Wep::Save_folder) if !FileTest.directory?(Wep::Save_folder) end end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # If quicksave and it must load it... # Make help window @help_window = Window_HelpSave.new @help_window.set_text(@help_text) @help_window.visible = Wep::Help_window_visible # Background sprite @backgrounds = Sprite.new @backgrounds.bitmap = Bitmap.new(640,480) @backgrounds.z = 1 @backgrounds.visible = true # Faces sprite @faces = Sprite.new @faces.bitmap = Bitmap.new(640,480) @faces.z = 101 @faces.visible = true # Check and load Scene background if Wep::Scene_background != "" bitmap = RPG::Cache.picture(Wep::Scene_background) @backgrounds.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 480), 255) end # Check and load Help background if Wep::Help_window_background != "" bitmap = RPG::Cache.picture(Wep::Help_window_background) @backgrounds.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 64), 255) end # Check and load Save background if Wep::Save_windows_background != "" for i in 0...3 bitmap = RPG::Cache.picture(Wep::Save_windows_background) @backgrounds.bitmap.blt(0, 64 + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), 255) end end # Make array of save slots info @save_slots = [] for i in 0...Wep::Max_slots # Check if exist and put base info and ordered one if FileTest.exist?(make_filename(i)) file = File.open(make_filename(i), "r") # One sp/hp onehp = Marshal.load(file) onesp = Marshal.load(file) # Description description = Marshal.load(file) # % completed game comp = Marshal.load(file) # Map map = Marshal.load(file) # Steps steps = Marshal.load(file) # Make medium levels for ordering save file medium_level=Marshal.load(file) # Read character data for drawing save file characters = Marshal.load(file) # Cargar personajes psj = Marshal.load(file) # Cargar dinero dinero = Marshal.load(file) # Read frame count for measuring play time frame_count = Marshal.load(file) time_stamp = file.mtime total_sec = frame_count / Graphics.frame_rate file.close @save_slots[i] = file_index=i, time_stamp, frame_count, medium_level else @save_slots[i] = [file_index=i] end end @file_index = 2 # Make save file and slots windows @savefile_windows = [] @slot_windows = [] for i in 0..3 @savefile_windows.push(Window_SaveFile.new(i)) @slot_windows.push(Slot_Window.new(i)) end # Refresh the windows for i in 0..3 # Checks if its beyond the limit if i+@file_index > Wep::Max_slots-1 @savefile_windows[i].refresh(@save_slots[Wep::Max_slots-i][0]) @slot_windows[i].refresh(Wep::Slot+(@save_slots[Wep::Max_slots-i][0]+1).to_s) if Wep::Quicksave and Wep::Max_slots-i == Wep::Quicksave_slot-1 @slot_windows[i].refresh(Wep::Quicksave_slot_text) end if Wep::Autosave and Wep::Max_slots-i == Wep::Autosave_slot-1 @slot_windows[i].refresh(Wep::Autosave_slot_text) end else @savefile_windows[i].refresh(@save_slots[@file_index+i-2][0]) @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i-2][0]+1).to_s) if Wep::Quicksave and @file_index+i-2 == Wep::Quicksave_slot-1 @slot_windows[i].refresh(Wep::Quicksave_slot_text) end if Wep::Autosave and @file_index+i-2 == Wep::Autosave_slot-1 @slot_windows[i].refresh(Wep::Autosave_slot_text) end end end # Select slot 2 @savefile_windows[@file_index].selected = true # Draw faces if enabled if Wep::Show_faces or Wep::Quick_actors_info.include?('face') if not Wep::Quick_actors_info draw_faces end end @file_index = 0 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose for i in @savefile_windows i.dispose end @backgrounds.dispose @faces.dispose for i in 0..3 @slot_windows[i].dispose end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @backgrounds.update for i in @savefile_windows i.update end # If C button was pressed if Input.trigger?(Input::C) # Check that it isnt in autosave or quicksave protected slots if Wep::Quicksave and @type and @save_slots[@file_index+2][0] == 0 and Wep::Quicksave_sep_slot # Play cursor SE $game_system.se_play($data_system.buzzer_se) return end if Wep::Autosave and @type and @save_slots[@file_index+2][0] == 1 and Wep::Autosave_sep_slot # Play cursor SE $game_system.se_play($data_system.buzzer_se) return end # Call method: on_decision (defined by the subclasses) on_decision(make_filename(@save_slots[@file_index+2][0])) if Wep::Quicksave and Wep::Quicksave_slot == @save_slots[@file_index+2][0] and @type == false $game_system.erase_slot(Wep::Quicksave_slot) end $game_temp.last_file_index = @file_index return end # If B button was pressed if Input.trigger?(Input::B) # Call method: on_cancel (defined by the subclasses) on_cancel return end # If the down directional button was pressed if Input.repeat?(Input::DOWN) # If the down directional button pressed down is not a repeat, # or cursor position is more in front than 3 if Input.trigger?(Input::DOWN) # Check and correct list limit if @file_index+1 > Wep::Max_slots-1-2 # Play cursor SE $game_system.se_play($data_system.buzzer_se) return end #p @file_index # Play cursor SE $game_system.se_play($data_system.cursor_se) # Move cursor down @file_index +=1 # Refresh the widows for i in 0..3 # Checks if its beyond the limit if @file_index+i > Wep::Max_slots-1 @savefile_windows[i].refresh(1001) @slot_windows[i].refresh(Wep::Slot_dont_exist) else @savefile_windows[i].refresh(@save_slots[@file_index+i][0]) @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i][0]+1).to_s) if Wep::Quicksave and @file_index+i == Wep::Quicksave_slot-1 @slot_windows[i].refresh(Wep::Quicksave_slot_text) end if Wep::Autosave and @file_index+i == Wep::Autosave_slot-1 @slot_windows[i].refresh(Wep::Autosave_slot_text) end end end # Draw faces if enabled if Wep::Show_faces or Wep::Quick_actors_info.include?('face') if not Wep::Quick_actors_info draw_faces end end return end end # If the up directional button was pressed if Input.repeat?(Input::UP) # If the up directional button pressed down is not a repeatใ # or cursor position is more in back than 0 if Input.trigger?(Input::UP) # # Check and correct list limit if @file_index-1 < 0-2 # Play cursor SE $game_system.se_play($data_system.buzzer_se) return end # Play cursor SE $game_system.se_play($data_system.cursor_se) # Move cursor up @file_index -=1 # Refresh the widows for i in 0..3 # Checks if its beyond the limit if @file_index+i < 0 @savefile_windows[i].refresh(1001) @slot_windows[i].refresh(Wep::Slot_dont_exist) else @savefile_windows[i].refresh(@save_slots[@file_index+i][0]) @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i][0]+1).to_s) if Wep::Quicksave and @file_index+i == Wep::Quicksave_slot-1 @slot_windows[i].refresh(Wep::Quicksave_slot_text) end if Wep::Autosave and @file_index+i == Wep::Autosave_slot-1 @slot_windows[i].refresh(Wep::Autosave_slot_text) end end end # Draw faces if enabled if Wep::Show_faces or Wep::Quick_actors_info.include?('face') if not Wep::Quick_actors_info draw_faces end end return end end end #-------------------------------------------------------------------------- # * Draw Faces #-------------------------------------------------------------------------- def draw_faces # Clear bitmap each time @faces.bitmap.clear for i in 0..3 # If the window dont have actors info skip it next if @savefile_windows[i].psj == nil # Draw the faces for j in 0...@savefile_windows[i].psj.size bitmap = RPG::Cache.picture('Saveface_'+@savefile_windows[i].psj[j].name+'.png') cw = bitmap.rect.width ch = bitmap.rect.height src_rect = Rect.new(0, 0, cw, ch) # Quick config option if not Wep::Quick_actors_info @faces.bitmap.blt(Wep::Face_position[0]+Wep::Face_separation*j, Wep::Face_position[1] + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), Wep::Face_transparency) else @faces.bitmap.blt(0+Wep::Face_separation*j, 68 + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), Wep::Face_transparency) end end end end #-------------------------------------------------------------------------- # * Make File Name # file_index : save file index (0-3) #-------------------------------------------------------------------------- def make_filename(file_index) return Wep::Save_folder+"\\"+Wep::File_name+ "#{file_index + 1}"+Wep::Saves_extension end end #============================================================================== # ** Scene_Load #------------------------------------------------------------------------------ # This class performs load screen processing. #============================================================================== class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(de_mapa=false) @de_mapa = de_mapa # Remake temporary object $game_temp = Game_Temp.new # Timestamp selects new file $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0...Wep::Max_slots filename = make_filename(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super(Wep::Load_description_text, @file_index = 0, @tipo = false) end #-------------------------------------------------------------------------- # * 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 # Play load SE $game_system.se_play($data_system.load_se) # Read save data file = File.open(filename, "rb") read_save_data(file) file.close # Restore BGM and BGS $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) # Update map (run parallel process event) $game_map.update # Switch to map screen $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Cancel Processing #-------------------------------------------------------------------------- def on_cancel # Play cancel SE $game_system.se_play($data_system.cancel_se) if not @de_mapa # Switch to title screen $scene = Scene_Title.new else $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # * Read Save Data # file : file object for reading (opened) #-------------------------------------------------------------------------- def read_save_data(file) # One sp/hp onehp = Marshal.load(file) onesp = Marshal.load(file) # Description description = Marshal.load(file) # % completed game comp = Marshal.load(file) # Map map = Marshal.load(file) # Steps steps = Marshal.load(file) # Make medium levels for ordering save file medium_level=Marshal.load(file) # Read character data for drawing save file characters = Marshal.load(file) # Cargar personajes @psj = Marshal.load(file) # Cargar dinero @dinero = Marshal.load(file) # Read frame count for measuring play time Graphics.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 magic number is different from when saving # (if editing was added with editor) if $game_system.magic_number != $data_system.magic_number # Load map $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # Refresh party members $game_party.refresh end end #============================================================================== # ** Scene_Save #------------------------------------------------------------------------------ # This class performs save screen processing. #============================================================================== class Scene_Save < Scene_File #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(Wep::Save_description_text, @file_index = 1, @tipo = true) end #-------------------------------------------------------------------------- # * Decision Processing #-------------------------------------------------------------------------- def on_decision(filename) # Play save SE $game_system.se_play($data_system.save_se) # Write save data file = File.open(filename, "wb") write_save_data(file) file.close # If called from event if $game_temp.save_calling # Clear save call flag $game_temp.save_calling = false # Switch to map screen $scene = Scene_Map.new return end # Switch to menu screen $scene = Scene_Menu.new(4) end #-------------------------------------------------------------------------- # * Cancel Processing #-------------------------------------------------------------------------- def on_cancel # Play cancel SE $game_system.se_play($data_system.cancel_se) # If called from event if $game_temp.save_calling # Clear save call flag $game_temp.save_calling = false # Switch to map screen $scene = Scene_Map.new return end # Switch to menu screen $scene = Scene_Menu.new(4) end #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- def write_save_data(file) one_pv = $game_party.actors[0].hp, $game_party.actors[0].maxhp one_sp = $game_party.actors[0].sp, $game_party.actors[0].maxsp # One actor mode info Marshal.dump(one_pv, file) Marshal.dump(one_sp, file) # Description if $game_system.save_description == nil Marshal.dump("", file) else description = $game_system.save_description Marshal.dump(description, file) end # % completed game comp = $game_variables[Wep::Variable_completed_game] Marshal.dump(comp, file) # Map map = $game_map.map_id Marshal.dump(map, file) # Steps steps = $game_party.steps Marshal.dump(steps, file) # Make medium levels for ordering save file medium_level=0 for i in 0...$game_party.actors.size medium_level += $game_party.actors[i].level end medium_level/=$game_party.actors.size Marshal.dump(medium_level, file) # Make character data for drawing save file characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end # Write character data for drawing save file Marshal.dump(characters, file) # Preparar archivo de personajes psj = [] for i in 0...$game_party.actors.size wep = $game_party.actors[i].id psj[i] = $game_actors[wep] end # Guardar archivo de personajes Marshal.dump(psj, file) # Preparar dinero dinero = $game_party.gold # Guardar archivo de dinero Marshal.dump(dinero, file) # Wrire frame count for measuring play time Marshal.dump(Graphics.frame_count, file) # Increase save count by 1 $game_system.save_count += 1 # Save magic number # (A random value will be written each time saving with editor) $game_system.magic_number = $data_system.magic_number # Write each type of game object Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) end end #============================================================================== # ** Window_SaveFile #------------------------------------------------------------------------------ # This window displays save files on the save and load screens. #============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :filename # file name attr_reader :selected # selected attr_reader :file_index attr_reader :exist attr_reader :psj # Actors info for drawing faces #-------------------------------------------------------------------------- # * Object Initialization # file_index : save file index (0-3) # filename : file name #-------------------------------------------------------------------------- def initialize(i) super(0, 64 + i % 4 * 104, Wep::Save_windows_size[0], Wep::Save_windows_size[1]) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = Wep::Save_windows_opacity self.back_opacity = Wep::Save_windows_back_opacity @selected = false @position = i @psj = nil end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh(file_index) self.contents = Bitmap.new(width - 32, height - 32) # Font setting if Wep::Save_window_font_name != "" self.contents.font.name = Wep::Save_window_font_name end # Open and check file if file_index != nil filename = Wep::Save_folder+"\\"+Wep::File_name+ "#{file_index + 1}"+Wep::Saves_extension file_exist = FileTest.exist?(filename) else file_exist = false @psj= nil end # If file exist if file_exist # Make normal load file = File.open(filename, "r") # One sp/hp onehp = Marshal.load(file) onesp = Marshal.load(file) # Description description = Marshal.load(file) # % completed game comp = Marshal.load(file) # Map map = Marshal.load(file) # Steps steps = Marshal.load(file) # Make medium levels for ordering save file medium_level=Marshal.load(file) # Read character data for drawing save file @characters = Marshal.load(file) # Cargar personajes @psj = Marshal.load(file) # Cargar dinero @dinero = Marshal.load(file) # Read frame count for measuring play time @frame_count = Marshal.load(file) @time_stamp = file.mtime @total_sec = @frame_count / Graphics.frame_rate file.close # Testing bitmap tb = Bitmap.new(1,1) # Check for newbie option if Wep::Quick_actors_info self.contents.font.size = 22 # Quick actors info with graphics if Wep::Quick_actors_info.include?('graphic') for i in 0...@characters.size if Wep::Quick_actors_info.include?('graphic') 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 = 160- @characters.size * 34 + i * 105 - cw / 2 self.contents.blt(x, 54 - ch, bitmap, src_rect) end if Wep::Quick_actors_info.include?('name') self.contents.draw_text(i*108, 48, Wep::Save_windows_size[0]-32, 32, @psj[i].name) end if Wep::Quick_actors_info.include?('level') rect = tb.text_size(Wep::Level_text) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s) end end # Quick actors info with faces else for i in 0...@characters.size if Wep::Quick_actors_info.include?('name') self.contents.draw_text(i*108, 48, Wep::Save_windows_size[0]-32, 32, @psj[i].name) end if Wep::Quick_actors_info.include?('level') rect = tb.text_size(Wep::Level_text) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s) end if Wep::Quick_actors_info.include?('graphic') 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 = Wep::Graphic_position[0] - @characters.size * 32 + i * 64 - cw / 2 self.contents.blt(x, Wep::Graphic_position[1] - ch, bitmap, src_rect) end end end # Quick actors info without graphic or face if not Wep::Quick_actors_info.include?('face') and not Wep::Quick_actors_info.include?('graphic') if Wep::Quick_actors_info.include?('name') self.contents.draw_text(i*Wep::Name_position[0], Wep::Name_position[1], Wep::Save_windows_size[0], 32, @psj[i].name) end if Wep::Quick_actors_info.include?('level') rect = tb.text_size(Wep::Level_text) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s) end end end # Check for newbie option if Wep::Quick_general_info self.contents.font.size = 22 i=0 for option in Wep::Quick_general_info # The y is manually defined for each postion if i == 0 y = -9 elsif i == 1 y = 11 elsif i == 2 y = 30 elsif i == 3 y = 46 end if option == '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(0, y, Wep::Save_windows_size[0]-32, 32, time_string, 2) elsif option == 'map_description' for group in Wep::Map_descriptions if group == Wep::Map_descriptions[0] next end if group[0].include?(map) map_description = group[1] end end map_description = Wep::Map_descriptions[0] if map_description == nil self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, map_description, 2) elsif option == 'description' self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, description, 2) elsif option == 'steps' rect = tb.text_size(steps.to_s) self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, steps.to_s, 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Steps_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false elsif option == 'money' rect = tb.text_size(dinero.to_s) self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, @dinero.to_s, 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Money_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false elsif option == 'map_name' # Load mapinfo for map name mapinfos = load_data("Data/MapInfos.rxdata") self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, mapinfos[map].name, 2) elsif option == 'completed_game' rect = tb.text_size(comp.to_s+"%") self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, comp.to_s+"%", 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Completed_game_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false elsif option == 'date' time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, time_string, 2) end i+=1 end end # Advanced settings # Font setting if not Wep::Quick_actors_info self.contents.font.size = Wep::Actors_info_font_size end for i in 0...@characters.size # Draw names if Wep::Show_name and not Wep::Quick_actors_info self.contents.draw_text(i*Wep::Name_position[0], Wep::Name_position[1], Wep::Save_windows_size[0], 32, @psj[i].name) end # Draw level if Wep::Show_level and not Wep::Quick_actors_info rect = tb.text_size(Wep::Level_text) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(i*Wep::Level_position[0], Wep::Level_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Level_text) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false self.contents.draw_text(i*Wep::Level_position[0]+rect.width, Wep::Level_position[1], Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s) end # Draw graphic if Wep::Show_graphic and not Wep::Quick_actors_info 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 = Wep::Graphic_position[0] - @characters.size * 32 + i * 64 - cw / 2 self.contents.blt(x, Wep::Graphic_position[1] - ch, bitmap, src_rect) end end # General info if not Wep::Quick_general_info self.contents.font.size = Wep::General_info_font_size end # Draw time if Wep::Show_time and not Wep::Quick_general_info 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(Wep::Time_position[0], Wep::Time_position[1], Wep::Save_windows_size[0], 32, time_string, 2) end # Draw money if Wep::Show_money and not Wep::Quick_general_info rect = tb.text_size(dinero.to_s) self.contents.draw_text(Wep::Gold_position[0], Wep::Gold_position[1], Wep::Save_windows_size[0]-32, 32, @dinero.to_s, 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(Wep::Gold_position[0]-rect.width, Wep::Gold_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Money_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false end # Draw map name if Wep::Show_map_name and not Wep::Quick_general_info # Load mapinfo for map name mapinfos = load_data("Data/MapInfos.rxdata") self.contents.draw_text(Wep::Map_name_position[0], Wep::Map_name_position[1], Wep::Save_windows_size[0]-32, 32, mapinfos[map].name, 2) end # Draw map description if Wep::Show_map_description and not Wep::Quick_general_info for group in Wep::Map_descriptions if group == Wep::Map_descriptions[0] next end if group[0].include?(map) map_description = group[1] end end map_description = Wep::Map_descriptions[0] if map_description == nil self.contents.draw_text(Wep::Map_description_position[0], Wep::Map_description_position[1], Wep::Save_windows_size[0], 32, map_description, 2) end # Draw description if Wep::Show_description and not Wep::Quick_general_info self.contents.draw_text(Wep::Description_position[0], Wep::Description_position[1], Wep::Save_windows_size[0]-32, 32, description, 2) end # Draw steps if Wep::Show_steps and not Wep::Quick_general_info rect = tb.text_size(steps.to_s) self.contents.draw_text(Wep::Steps_position[0], Wep::Steps_position[1], Wep::Save_windows_size[0]-32, 32, steps.to_s, 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(Wep::Steps_position[0]-rect.width, Wep::Steps_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Steps_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false end # Draw completed game if Wep::Show_completed_game and not Wep::Quick_general_info rect = tb.text_size(comp.to_s+"%") self.contents.draw_text(Wep::Completed_game_position[0], Wep::Completed_game_position[1], Wep::Save_windows_size[0]-32, 32, comp.to_s+"%", 2) self.contents.font.color = Wep::Description_color self.contents.font.bold = Wep::Description_bold self.contents.draw_text(Wep::Completed_game_position[0]-rect.width, Wep::Completed_game_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Completed_game_text, 2) self.contents.font.color = Wep::Basic_color self.contents.font.bold = false end # Draw date if Wep::Show_date and not Wep::Quick_general_info time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") self.contents.draw_text(Wep::Date_position[0], Wep::Date_position[1], Wep::Save_windows_size[0], 32, time_string, 2) end else # If the file didnt exist, make psj nil and draw empty slot text if file_exist == false @psj= nil if file_index == Wep::Quicksave_slot-1 and Wep::Quicksave name = Wep::Empty_quicksave_slot_text elsif file_index == Wep::Autosave_slot-1 and Wep::Autosave name = Wep::Empty_autosave_slot_text else name = Wep::Empty_slot end @name_width = contents.text_size(name).width self.contents.draw_text(Wep::Identifier_text_position[0],Wep::Identifier_text_position[1], Wep::Save_windows_size[0], 32, name) end end end #-------------------------------------------------------------------------- # * Set Selected # selected : new selected (true = selected, false = unselected) #-------------------------------------------------------------------------- def selected=(selected) @selected = selected update_cursor_rect end #-------------------------------------------------------------------------- # * Cursor Rectangle Update #-------------------------------------------------------------------------- def update_cursor_rect if @selected self.cursor_rect.set(-14, -14, 640, 128) else self.cursor_rect.empty end end end #-------------------------------------------------------------------------- # * Compatibility check: Scene title modification #-------------------------------------------------------------------------- if Wep::Title_modification #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs title screen processing. #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # If battle test if $BTEST battle_test return end # Load database $data_actors = load_data("Data/Actors.rxdata") $data_classes = load_data("Data/Classes.rxdata") $data_skills = load_data("Data/Skills.rxdata") $data_items = load_data("Data/Items.rxdata") $data_weapons = load_data("Data/Weapons.rxdata") $data_armors = load_data("Data/Armors.rxdata") $data_enemies = load_data("Data/Enemies.rxdata") $data_troops = load_data("Data/Troops.rxdata") $data_states = load_data("Data/States.rxdata") $data_animations = load_data("Data/Animations.rxdata") $data_tilesets = load_data("Data/Tilesets.rxdata") $data_common_events = load_data("Data/CommonEvents.rxdata") $data_system = load_data("Data/System.rxdata") # Make system object $game_system = Game_System.new # Make title graphic @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) # Make command window s1 = Wep::New_game_text s2 = Wep::Load_game_text # Changue Title syntax if quickload enabled if Wep::Must_load and Wep::Quicksave if FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::Quicksave_slot.to_s + Wep::Saves_extension) s2 = Wep::Title_quickload end end s3 = Wep::Quit_game_text @command_window = Window_Command.new(192, [s1, s2, s3]) @command_window.back_opacity = 160 @command_window.x = 320 - @command_window.width / 2 @command_window.y = 288 # Continue enabled determinant # Check if at least one save file exists # If enabled, make @continue_enabled true; if disabled, make it false @continue_enabled = false # Check for one slot slots if one slot modes are active if Wep::One_slot_mode or Wep::One_slot_mode_quicksaving @continue_enabled = FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension) else for i in 0...Wep::Max_slots if FileTest.exist?(Wep::Save_folder+"\\"+Wep::File_name+ "#{i + 1}"+Wep::Saves_extension) @continue_enabled = true end end end # If continue is enabled, move cursor to "Continue" # If disabled, display "Continue" text in gray if @continue_enabled @command_window.index = 1 else @command_window.disable_item(1) end # Play title BGM $game_system.bgm_play($data_system.title_bgm) # Stop playing ME and BGS Audio.me_stop Audio.bgs_stop # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of command window @command_window.dispose # Dispose of title graphic @sprite.bitmap.dispose @sprite.dispose end #-------------------------------------------------------------------------- # * Command: Continue #-------------------------------------------------------------------------- def command_continue # If continue is disabled unless @continue_enabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # If must load quicksave if Wep::Must_load and Wep::Quicksave and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::Quicksave_slot.to_s + Wep::Saves_extension) $game_system.load_slot(Wep::Quicksave_slot) return end # If its in one slot mode: NO ANIRA, HA DE CARREGAR if Wep::One_slot_mode and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension) $game_system.load_slot(Wep::One_slot_mode_slot) return end # If its in one slot quicksavig mode if Wep::One_slot_mode_quicksaving and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension) $game_system.load_slot(Wep::One_slot_mode_slot) return end # Normal switch to load screen $scene = Scene_Load.new end end end