Announcement
Announcement
| Crystal Fantasy takes 1st as the 2013 2nd Quarter Contest Winner!!! See the Community Announcements section. |
![]() ![]() |
Apr 13 2012, 10:01 AM
Post
#1
|
|
![]() ![]() Type: Writer Alignment: Neutral Good |
Hello. I'm not a scripter, just able to understand a few things about the codes. I tried using the YEM System Game Options with the Woratana's Neo Save System.
What happens is that the selecting of Window skins goes haywire after accessing the save file. I never did any modification of the codes other than replacing the contents of the Hash table for the Windows in YEM. I tried running the script in a separate project without modifying the codes and I get the same bug. So here's the bug, whenever I try to choose the second window, it goes to a different selection. Let's say your choice is Window #2, instead of changing the Window to 2 it goes to 6 and if you try pressing up or down it goes all over the place like from your choice window 6 will go to window 1. I have 9 values on my hash table and my DEFAULT_SKIN_VALUE is 2 right now. Okay here's the codes to make it easy for experts like you to understand. This is the YEM Codes. I deleted the ATB parts and other Battle Engine Melody related lines but the bud exists even before I removed them. CODE #=============================================================================== # # Yanfly Engine Melody - System Game Options # Last Date Updated: 2010.06.12 # Level: Normal # # System Game Options replaces the "Game End" scene found in the default RPG # Maker VX with a system options menu. In this menu, the player can readjust # sound volumes, automatic dashing, and more. This changes one of the unused # game end scene into something a whole lot more useful. # #=============================================================================== # Updates # ----------------------------------------------------------------------------- # o 2010.06.12 - Bugfix for disposing the skins window. # o 2010.05.14 - Finished Script. # o 2010.05.12 - Started Script. #=============================================================================== # Instructions # ----------------------------------------------------------------------------- # To install this script, open up your script editor and copy/paste this script # to an open slot below ▼ Materials but above ▼ Main. Remember to save. # # 1. Scroll down, adjust the various Switches and Variable values to something # empty or predetermined. # 2. Make a "Windows" folder in your project's "Graphics" folder. Insert the # window skins you want to use there and adjust the WINDOW_HASH accordingly. # #=============================================================================== # Compatibility # ----------------------------------------------------------------------------- # - Replaces ALL of Scene_End. Expect no functionality with any scripts that # will also replace Scene_End. # - This script is made to be specifically compatible with Battle Engine Melody. #=============================================================================== $imported = {} if $imported == nil $imported["SystemGameOptions"] = true module YEM module SYSTEM # This replaces the Game End title with the following text. And although # script itself doesn't provide the icon, any script that may potentially # link towards the System menu will reveal the System icon below. TITLE = "System" ICON = 134 #=========================================================================== # Game System Commands # -------------------------------------------------------------------------- # The following adjusts the order at which you would like the menu system # commands to appear. Here is the reference table to their command ID's. # :blank - Blank Item. # :volume_bgm - Adjusts BGM volume. # :volume_bgs - Adjusts BGS volume. # :volume_sfx - Adjusts SFX volume. # :animations - Turns on/off battle animations. # :autocursor - Requires BEM. Memorized cursor position. # :skill_help - Requires BEM. Display skill help. # :next_actor - Requires BEM. Automatic Next Actor. # :atb_active - Requires BEM. Sets ATB type. # :atb_speed - Requires BEM. Sets ATB speed. # :auto_dash - Controls if need to hold down dash button to run. # :instant_text - Whether or not text appears instantly in messages. # :windowskin - Changes the windowskin. # :return_title - Return back to the title screen. # :return_menu - Return back to the menu screen. #=========================================================================== # This array modifies the order your system menu options appear in from # top to bottom. Rearrange them as you see fit or remove them if desired. COMMANDS =[ :windowskin, :autocursor, :bgm_volume, :bgs_volume, :sfx_volume, :auto_dash, :instant_text, :blank, :return_title, :return_menu, ] # Do not remove this. # The following hash determines what variables and switches are used to # adjust the system options menu. It's very important that you bind the # values to the proper variables and switches in order for your game to # run properly. In addition to adjusting the switches, you also apply # text descriptions of each of the items here, too. OPTIONS ={ # Option => Value :bgm_variable => 21, # Variable used to adjust BGM volume. :bgm_mute_sw => 21, # Switch used to mute/unmute the BGM. :bgm_volume => "BGM Volume", :bgm_des => "Adjusts BGM volume. Z to Mute and Unmute.", :bgs_variable => 22, # Variable used to adjust BGS volume. :bgs_mute_sw => 22, # Switch used to mute/unmute the BGS. :bgs_volume => "BGS Volume", :bgs_des => "Adjusts BGS volume. Z to Mute and Unmute.", :sfx_variable => 23, # Variable used to adjust SFX volume. :sfx_mute_sw => 23, # Switch used to mute/unmute the SFX. :sfx_volume => "SFX Volume", :sfx_des => "Adjusts SFX volume. Z to Mute and Unmute.", :mute => "Mute", :audio => "Audio %d%%", :auto_dash_sw => 28, # Switch used to enable auto-dashing. :auto_dash => "Auto-Dash", :dash_des => "Automatically dash without holding the run button.", :dash_on => "Dash", :dash_off => "Walk", :inst_text_sw => 29, # Switch used to control instant text. :instant_text => "Instant Text", :inst_des => "Text appears all at once instead of one by one.", :inst_on => "Instant", :inst_off => "Normal", :return_title => "Return to Title", :retitle_des => "Return back to the title screen.", :return_menu => "Return to Main Menu", :remenu_des => "Return back to the main menu.", :window_var => 30, # Variable used to change windowskins. :windowskin => "Windowskin", :wind_des => "Changes the windowskin used for the game.", } # Do not remove this. # This sets the default fonts used for your windows. Note that in this # array, if a player doesn't have the font in front, it'll use the next one # onward until the player does have that font installed. DEFAULT = ["UmePlus Gothic", "Verdana", "Arial", "Courier New"] WRITING = ["Comic Sans MS", "Lucida Handwriting", "Arial"] # The following adjusts the window skins used for your game. Match the # Window skins with the names accordingly. Within the windowskin hash, # the following settings are adjusted as such: # Name - File Name # Opac - Back Opacity # Bold - Bold font? # Italic - Italic font? # Shadow - Use shadows? # Size - Font Size # Font - Font Set DEFAULT_SKIN_VALUE = 2 WINDOW_HASH ={ # Window ID => [ Name, Opac, Bold, Italic, Shadow, Size, Font], 1 => ["Type 1", 0, true, false, true, 20, WRITING], 2 => ["Type 2", 0, true, false, true, 20, WRITING], 3 => ["Type 3", 0, true, false, true, 20, WRITING], 4 => ["Type 4", 0, true, false, true, 20, WRITING], 5 => ["Type 5", 0, true, false, true, 20, WRITING], 6 => ["Type 6", 0, true, false, true, 20, WRITING], 7 => ["Type 7", 0, true, false, true, 20, WRITING], 8 => ["Type 8", 0, true, false, true, 20, WRITING], 9 => ["Type 9", 0, true, false, true, 20, WRITING], } # Do not remove this. end # SYSTEM end # YEM #=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #=============================================================================== #=============================================================================== # Vocab #=============================================================================== module Vocab #-------------------------------------------------------------------------- # overwrite method: self.game_end #-------------------------------------------------------------------------- def self.game_end return YEM::SYSTEM::TITLE end end # Vocab #=============================================================================== # module Icon #=============================================================================== module Icon #-------------------------------------------------------------------------- # new method: self.system #-------------------------------------------------------------------------- def self.system return YEM::SYSTEM::ICON end end # Icon #=============================================================================== # module Cache #=============================================================================== module Cache #-------------------------------------------------------------------------- # new method: self.windows #-------------------------------------------------------------------------- def self.windows(filename); load_bitmap("Graphics/Windows/", filename); end end # Cache YEM::SYSTEM::WINDOWSKIN_VARIABLE = YEM::SYSTEM::OPTIONS[:window_var] #=============================================================================== # RPG::BGM #=============================================================================== unless $imported["BattleEngineMelody"] module RPG class BGM < AudioFile #-------------------------------------------------------------------------- # overwrite method: play #-------------------------------------------------------------------------- def play if @name.empty? Audio.bgm_stop @@last = BGM.new else vol = @volume if $game_variables != nil options = YEM::SYSTEM::OPTIONS vol = vol * $game_variables[options[:bgm_variable]] / 100 vol = [[vol, 0].max, 100].min vol = 0 if $game_switches[options[:bgm_mute_sw]] end Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch) @@last = self end end end # BGM class ME < AudioFile #-------------------------------------------------------------------------- # overwrite method: play #-------------------------------------------------------------------------- def play if @name.empty? Audio.me_stop else vol = @volume if $game_variables != nil options = YEM::SYSTEM::OPTIONS vol = vol * $game_variables[options[:bgm_variable]] / 100 vol = [[vol, 0].max, 100].min vol = 0 if $game_switches[options[:bgm_mute_sw]] end Audio.me_play("Audio/ME/" + @name, vol, @pitch) end end end # ME class BGS < AudioFile #-------------------------------------------------------------------------- # overwrite method: play #-------------------------------------------------------------------------- def play if @name.empty? Audio.bgs_stop @@last = BGS.new else vol = @volume if $game_variables != nil options = YEM::SYSTEM::OPTIONS vol = vol * $game_variables[options[:bgs_variable]] / 100 vol = [[vol, 0].max, 100].min vol = 0 if $game_switches[options[:bgs_mute_sw]] end Audio.bgs_play("Audio/BGS/" + @name, vol, @pitch) @@last = self end end end # BGS class SE < AudioFile #-------------------------------------------------------------------------- # overwrite method: play #-------------------------------------------------------------------------- def play unless @name.empty? vol = @volume if $game_variables != nil options = YEM::SYSTEM::OPTIONS vol = vol * $game_variables[options[:sfx_variable]] / 100 vol = [[vol, 0].max, 100].min vol = 0 if $game_switches[options[:sfx_mute_sw]] end Audio.se_play("Audio/SE/" + @name, vol, @pitch) end end end # SE end # RPG end # $imported["BattleEngineMelody"] #=============================================================================== # Game_System #=============================================================================== class Game_System #-------------------------------------------------------------------------- # new method: create_system_options #-------------------------------------------------------------------------- def create_system_options return if @created_system_options @created_system_options = true options = YEM::SYSTEM::OPTIONS $game_variables[options[:bgm_variable]] = 100 $game_variables[options[:bgs_variable]] = 100 $game_variables[options[:sfx_variable]] = 100 $game_switches[options[:bgm_mute_sw]] = false $game_switches[options[:bgs_mute_sw]] = false $game_switches[options[:sfx_mute_sw]] = false $game_switches[options[:auto_dash_sw]] = false $game_switches[options[:inst_text_sw]] = false $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] = YEM::SYSTEM::DEFAULT_SKIN_VALUE end end # Game_System #=============================================================================== # Game_Player #=============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # alias method: dash? #-------------------------------------------------------------------------- alias dash_sgo dash? unless $@ def dash? if $game_switches[YEM::SYSTEM::OPTIONS[:auto_dash_sw]] return false if @move_route_forcing return false if $game_map.disable_dash? return false if in_vehicle? return false if Input.press?(Input::A) return true else return dash_sgo end end end # Game_Player #=============================================================================== # Window #=============================================================================== class Window #-------------------------------------------------------------------------- # update windowskin #-------------------------------------------------------------------------- def update_windowskin return if $game_variables == nil variable = YEM::SYSTEM::WINDOWSKIN_VARIABLE if $game_variables[variable] == 0 $game_variables[variable] = YEM::SYSTEM::DEFAULT_SKIN_VALUE elsif !YEM::SYSTEM::WINDOW_HASH.include?($game_variables[variable]) $game_variables[variable] = YEM::SYSTEM::DEFAULT_SKIN_VALUE end skin = YEM::SYSTEM::WINDOW_HASH[$game_variables[variable]] change_settings(skin) end #-------------------------------------------------------------------------- # change_settings #-------------------------------------------------------------------------- def change_settings(skin) self.windowskin = Cache.windows(skin[0]) self.back_opacity = skin[1] self.contents.font.bold = Font.default_bold = skin[2] self.contents.font.italic = Font.default_italic = skin[3] self.contents.font.shadow = Font.default_shadow = skin[4] self.contents.font.size = Font.default_size = skin[5] self.contents.font.name = Font.default_name = skin[6] self.contents.font.color = normal_color end end # Window #=============================================================================== # Window_Base #=============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # alias method: initialize #-------------------------------------------------------------------------- alias initialize_window_sgo initialize unless $@ def initialize(x, y, width, height) initialize_window_sgo(x, y, width, height) self.update_windowskin end #-------------------------------------------------------------------------- # alias method: create_contents #-------------------------------------------------------------------------- alias create_contents_base_sgo create_contents unless $@ def create_contents create_contents_base_sgo self.contents.font.color = normal_color end end # Window_Base #=============================================================================== # Window_Selectable #=============================================================================== class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # alias method: create_contents #-------------------------------------------------------------------------- alias create_contents_selectable_sgo create_contents unless $@ def create_contents create_contents_selectable_sgo self.contents.font.color = normal_color end end # Window_Selectable #=============================================================================== # Window_SaveFile #=============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # alias method: refresh #-------------------------------------------------------------------------- alias refresh_savefile_mso refresh unless $@ def refresh if @file_exist n = @game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] if n == 0 or !YEM::SYSTEM::WINDOW_HASH.include?(n) n = YEM::SYSTEM::DEFAULT_SKIN_VALUE end skin = YEM::SYSTEM::WINDOW_HASH[n] change_settings(skin) end refresh_savefile_mso end end # Window_SaveFile #=============================================================================== # Window_Message #=============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # alias method: update_show_fast #-------------------------------------------------------------------------- alias update_show_fast_sgo update_show_fast unless $@ def update_show_fast if $game_switches[YEM::SYSTEM::OPTIONS[:inst_text_sw]] if self.pause or self.openness < 255 @show_fast = false else @show_fast = true end if @show_fast and @wait_count > 0 @wait_count -= 1 end else update_show_fast_sgo end end #-------------------------------------------------------------------------- # alias method: new_page #-------------------------------------------------------------------------- alias new_page_sgo new_page unless $@ def new_page self.update_windowskin new_page_sgo end end # Window_Message #=============================================================================== # Window_SystemOptions #=============================================================================== class Window_SystemOptions < Window_Selectable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(help_window) dy = help_window.height dh = Graphics.height - dy super(0, dy, Graphics.width, dh) self.index = 0 refresh @help_window = help_window update_help end #-------------------------------------------------------------------------- # item #-------------------------------------------------------------------------- def item; return @data[self.index]; end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh @data = [] for command in YEM::SYSTEM::COMMANDS case command when :windowskin, :animations, :bgm_volume, :sfx_volume, :bgs_volume, :auto_dash, :instant_text, :blank, :return_title, :return_menu else; next end @data.push(command) end @item_max = @data.size create_contents for i in 0...@item_max; draw_item(i); end end #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) obj = @data[index] return if obj == nil case obj when :windowskin draw_window_item(obj, rect.clone) when :bgm_volume, :sfx_volume, :bgs_volume draw_volume_item(obj, rect.clone) when :auto_dash, :instant_text draw_switch_item(obj, rect.clone) when :return_title, :return_menu draw_solo_item(obj, rect.clone) end end #-------------------------------------------------------------------------- # draw_window_item #-------------------------------------------------------------------------- def draw_window_item(obj, rect) title = YEM::SYSTEM::OPTIONS[:windowskin] self.contents.font.color = normal_color self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1) dx = rect.x + rect.width/2 skin_id = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] skin_name = YEM::SYSTEM::WINDOW_HASH[skin_id][0] dx = rect.x + rect.width/2 self.contents.draw_text(dx, rect.y, rect.width/2, WLH, skin_name, 1) end #-------------------------------------------------------------------------- # draw_volume_item #-------------------------------------------------------------------------- def draw_volume_item(obj, rect) options = YEM::SYSTEM::OPTIONS case obj when :bgm_volume title = options[:bgm_volume] value = $game_variables[options[:bgm_variable]] mute = $game_switches[options[:bgm_mute_sw]] when :bgs_volume title = options[:bgs_volume] value = $game_variables[options[:bgs_variable]] mute = $game_switches[options[:bgs_mute_sw]] when :sfx_volume title = options[:sfx_volume] value = $game_variables[options[:sfx_variable]] mute = $game_switches[options[:sfx_mute_sw]] else; return end value = sprintf(options[:audio], value) self.contents.font.color = normal_color self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1) self.contents.font.color.alpha = mute ? 128 : 255 dx = rect.x + rect.width/2 self.contents.draw_text(dx, rect.y, rect.width/4, WLH, value, 1) self.contents.font.color.alpha = mute ? 255 : 128 dx = rect.x + rect.width*3/4 self.contents.draw_text(dx, rect.y, rect.width/4, WLH, options[:mute], 1) end #-------------------------------------------------------------------------- # draw_switch_item #-------------------------------------------------------------------------- def draw_switch_item(obj, rect) options = YEM::SYSTEM::OPTIONS title = options[obj] case obj when :cinematics name1 = options[:cinem_on] name2 = options[:cinem_off] toggle = $game_switches[options[:cinematics_sw]] when :auto_dash name1 = options[:dash_on] name2 = options[:dash_off] toggle = $game_switches[options[:auto_dash_sw]] when :instant_text name1 = options[:inst_on] name2 = options[:inst_off] toggle = $game_switches[options[:inst_text_sw]] else; return end self.contents.font.color = normal_color self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1) self.contents.font.color.alpha = toggle ? 255 : 128 dx = rect.x + rect.width/2 self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name1, 1) self.contents.font.color.alpha = toggle ? 128 : 255 dx = rect.x + rect.width*3/4 self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name2, 1) end #-------------------------------------------------------------------------- # draw_solo_item #-------------------------------------------------------------------------- def draw_solo_item(obj, rect) options = YEM::SYSTEM::OPTIONS case obj when :return_title, :return_menu text = options[obj] else; return end self.contents.font.color = normal_color self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text, 1) end #-------------------------------------------------------------------------- # update #-------------------------------------------------------------------------- def update super if Input.trigger?(Input::C) input_case_c elsif Input.repeat?(Input::LEFT) input_case_left elsif Input.repeat?(Input::RIGHT) input_case_right end end #-------------------------------------------------------------------------- # input_case_c #-------------------------------------------------------------------------- def input_case_c options = YEM::SYSTEM::OPTIONS case item when :windowskin Sound.play_decision $scene.open_skins_window return when :bgm_volume; switch = options[:bgm_mute_sw] when :bgs_volume; switch = options[:bgs_mute_sw] when :sfx_volume; switch = options[:sfx_mute_sw] when :cinematics; switch = options[:cinematics_sw] when :auto_dash; switch = options[:auto_dash_sw] when :instant_text; switch = options[:inst_text_sw] when :return_title $scene.command_to_title return when :return_menu Sound.play_decision $scene.return_scene return else; return end $game_switches[switch] = !$game_switches[switch] Sound.play_decision RPG::BGM::last.play if item == :bgm_volume RPG::BGS::last.play if item == :bgs_volume draw_item(self.index) end #-------------------------------------------------------------------------- # input_case_left #-------------------------------------------------------------------------- def input_case_left options = YEM::SYSTEM::OPTIONS ignore = false case item when :bgm_volume, :bgs_volume, :sfx_volume value = Input.press?(Input::SHIFT) ? 10 : 1 case item when :bgm_volume; variable = options[:bgm_variable] when :bgs_volume; variable = options[:bgs_variable] when :sfx_volume; variable = options[:sfx_variable] end return if $game_variables[variable] == 0 $game_variables[variable] -= value $game_variables[variable] = [$game_variables[variable], 0].max ignore = true when :cinematics; switch = options[:cinematics_sw] when :auto_dash; switch = options[:auto_dash_sw] when :instant_text; switch = options[:inst_text_sw] else; return end unless ignore return if $game_switches[switch] $game_switches[switch] = true end Sound.play_cursor RPG::BGM::last.play if item == :bgm_volume RPG::BGS::last.play if item == :bgs_volume draw_item(self.index) end #-------------------------------------------------------------------------- # input_case_right #-------------------------------------------------------------------------- def input_case_right options = YEM::SYSTEM::OPTIONS ignore = false case item when :bgm_volume, :bgs_volume, :sfx_volume value = Input.press?(Input::SHIFT) ? 10 : 1 case item when :bgm_volume; variable = options[:bgm_variable] when :bgs_volume; variable = options[:bgs_variable] when :sfx_volume; variable = options[:sfx_variable] end return if $game_variables[variable] == 100 $game_variables[variable] += value $game_variables[variable] = [$game_variables[variable], 100].min ignore = true when :cinematics; switch = options[:cinematics_sw] when :auto_dash; switch = options[:auto_dash_sw] when :instant_text; switch = options[:inst_text_sw] else; return end unless ignore return if !$game_switches[switch] $game_switches[switch] = false end Sound.play_cursor RPG::BGM::last.play if item == :bgm_volume RPG::BGS::last.play if item == :bgs_volume draw_item(self.index) end #-------------------------------------------------------------------------- # update_help #-------------------------------------------------------------------------- def update_help case item when :bgm_volume; type = :bgm_des when :bgs_volume; type = :bgs_des when :sfx_volume; type = :sfx_des when :cinematics; type = :cinem_des when :windowskin; type = :wind_des when :auto_dash; type = :dash_des when :instant_text; type = :inst_des when :return_title; type = :retitle_des when :return_menu; type = :remenu_des else; type = nil end text = YEM::SYSTEM::OPTIONS[type].to_s @help_window.set_text(text, 1) end end # Window_SystemOptions #=============================================================================== # Window_Skins #=============================================================================== class Window_Skins < Window_Selectable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize dx = Graphics.width/4 dw = Graphics.width/2 dh = Graphics.height - 112 super(dx, 56, dw, dh) @column_max = 1 self.index = 0 self.back_opacity = 255 self.openness = 0 self.active = false refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh @data = [] variable = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] hash = YEM::SYSTEM::WINDOW_HASH.sort{ |a,b| a[0] <=> b[0] } for key in hash @data.push(key[0]) self.index = key[0] - 1 if key[0] == $game_variables[variable] end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) rect.width -= 4 text = YEM::SYSTEM::WINDOW_HASH[@data[index]][0] self.contents.draw_text(rect, text, 1) end end # Window_Skins #=============================================================================== # Scene_Title #=============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # alias method: create_game_objects #-------------------------------------------------------------------------- alias create_game_objects_sgo create_game_objects unless $@ def create_game_objects create_game_objects_sgo $game_system.create_system_options end end # Scene_Title #=============================================================================== # Scene_Map #=============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # alias method: start #-------------------------------------------------------------------------- alias start_sgo start unless $@ def start $game_system.create_system_options start_sgo end end # Scene_Map #=============================================================================== # Scene_Battle #=============================================================================== class Scene_Battle < Scene_Base end # Scene_Battle #=============================================================================== # Scene_End #=============================================================================== class Scene_End < Scene_Base #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :window_var #-------------------------------------------------------------------------- # overwrite method: start #-------------------------------------------------------------------------- def start super create_menu_background @window_var = YEM::SYSTEM::WINDOWSKIN_VARIABLE @help_window = Window_Help.new @options_window = Window_SystemOptions.new(@help_window) @skins_window = Window_Skins.new end #-------------------------------------------------------------------------- # overwrite method: post_start #-------------------------------------------------------------------------- def post_start; super; end #-------------------------------------------------------------------------- # overwrite method: pre_terminate #-------------------------------------------------------------------------- def pre_terminate; super; end #-------------------------------------------------------------------------- # overwrite method: close_command_window #-------------------------------------------------------------------------- def close_command_window; end #-------------------------------------------------------------------------- # overwrite method: terminate #-------------------------------------------------------------------------- def terminate super @help_window.dispose @options_window.dispose @skins_window.dispose dispose_menu_background end #-------------------------------------------------------------------------- # overwrite method: update #-------------------------------------------------------------------------- def update super @help_window.update @skins_window.update update_menu_background if @options_window.active update_options_window elsif @skins_window.active update_skins_window end end #-------------------------------------------------------------------------- # new method: update_options_window #-------------------------------------------------------------------------- def update_options_window @options_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene end end #-------------------------------------------------------------------------- # new method: open_skins_window #-------------------------------------------------------------------------- def open_skins_window @skins_window.open @skins_window.index = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] - 1 @skins_window.active = true @options_window.active = false end #-------------------------------------------------------------------------- # new method: update_skins_window #-------------------------------------------------------------------------- def update_skins_window if @last_index != @skins_window.index @last_index = @skins_window.index update_skins end if Input.trigger?(Input::B) Sound.play_cancel @skins_window.close @skins_window.active = false @options_window.active = true elsif Input.trigger?(Input::C) Sound.play_decision @skins_window.close @skins_window.active = false @options_window.active = true end end #-------------------------------------------------------------------------- # new method: update_skins #-------------------------------------------------------------------------- def update_skins $game_variables[@window_var] = @skins_window.index + 1 @options_window.update_windowskin @options_window.refresh @help_window.update_windowskin @help_window.set_text("") @options_window.update_help @skins_window.update_windowskin @skins_window.back_opacity = 255 @skins_window.refresh @options_window.draw_item(@options_window.index) end end # Scene_End #=============================================================================== # # END OF FILE # #=============================================================================== And here's the Neo Save System. I only did modification on the SAVE_FILE_NAME area. CODE #=============================================================== # ● [VX] ◦ Neo Save System III ◦ □ #-------------------------------------------------------------- # ◦ by Woratana [woratana@hotmail.com] # ◦ Thaiware RPG Maker Community # ◦ Released on: 15/02/2009 # ◦ Version: 3.0 #-------------------------------------------------------------- # ◦ Log III: # - Change back to draw tilemap as screenshot. Don't need any image. # - For drawing tilemap, the characters won't show on the tilemap. #-------------------------------------------------------------- # ◦ Log II: # - Screenshot DLL is not work with Vista Aero, so I remove it # and use image for each map instead of screenshot. # - Actor's level in last version (V.1) is incorrect. #-------------------------------------------------------------- # ◦ Features: # - Unlimited save slots, you can choose max save slot # - You can use image for scene's background # - Choose your save file's name, and folder to store save files # - Choose to show only information you want # - Editable text for information's title # - Draw tilemap for map that player is currently in. # - Remove text you don't want from map's name (e.g. tags for special script) # - Choose map that you don't want to show its name # - Include save confirmation window before overwrite old save #================================================================= module Wora_NSS #========================================================================== # * START NEO SAVE SYSTEM - SETUP #-------------------------------------------------------------------------- NSS_WINDOW_OPACITY = 255 # All windows' opacity (Lowest 0 - 255 Highest) # You can change this to 0 in case you want to use image for background NSS_IMAGE_BG = '' # Background image file name, it must be in folder Picture. # use '' for no background NSS_IMAGE_BG_OPACITY = 255 # Opacity for background image MAX_SAVE_SLOT = 99 # Max save slots no. SLOT_NAME = 'FILE {id}' # Name of the slot (show in save slots list), use {id} for slot ID SAVE_FILE_NAME = 'Ethersave{id}.rvdata' # Save file name, you can also change its file type from .rvdata to other # use {id} for save slot ID SAVE_PATH = '' # Path to store save file, e.g. 'Save/' or '' (for game folder) SAVED_SLOT_ICON = 133 # Icon Index for saved slot EMPTY_SLOT_ICON = 141 # Icon Index for empty slot EMPTY_SLOT_TEXT = '-EMPTY-' # Text to show for empty slot's data DRAW_GOLD = true # Draw Gold DRAW_PLAYTIME = true # Draw Playtime DRAW_LOCATION = true # Draw location DRAW_FACE = true # Draw Actor's face DRAW_LEVEL = true # Draw Actor's level DRAW_NAME = true # Draw Actor's name PLAYTIME_TEXT = 'Play Time: ' GOLD_TEXT = 'Wallet: ' LOCATION_TEXT = 'Location: ' LV_TEXT = 'Lv ' MAP_NAME_TEXT_SUB = %w{} # Text that you want to remove from map name, # e.g. %w{[LN] [DA]} will remove text '[LN]' and '[DA]' from map name MAP_NO_NAME_LIST = [] # ID of Map that will not show map name, e.g. [1,2,3] MAP_NO_NAME_NAME = '??????????' # What you will use to call map in no name list MAP_BORDER = Color.new(0,0,0,200) # Map image border color (R,G,B,Opacity) FACE_BORDER = Color.new(0,0,0,200) # Face border color ## SAVE CONFIRMATION WINDOW ## SFC_Text_Confirm = 'Save' # Text to confirm to save file SFC_Text_Cancel = 'Cancel Save' # Text to cancel to save SFC_Window_Width = 200 # Width of Confirmation Window SFC_Window_X_Offset = 0 # Move Confirmation Window horizontally SFC_Window_Y_Offset = 0 # Move Confirmation Window vertically #---------------------------------------------------------------------- # END NEO SAVE SYSTEM - SETUP #========================================================================= end class Scene_File < Scene_Base include Wora_NSS attr_reader :window_slotdetail #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background if NSS_IMAGE_BG != '' @bg = Sprite.new @bg.bitmap = Cache.picture(NSS_IMAGE_BG) @bg.opacity = NSS_IMAGE_BG_OPACITY end @help_window = Window_Help.new command = [] (1..MAX_SAVE_SLOT).each do |i| command << SLOT_NAME.clone.gsub!(/\{ID\}/i) { i.to_s } end @window_slotdetail = Window_NSS_SlotDetail.new @window_slotlist = Window_SlotList.new(160, command) @window_slotlist.y = @help_window.height @window_slotlist.height = Graphics.height - @help_window.height @help_window.opacity = NSS_WINDOW_OPACITY @window_slotdetail.opacity = @window_slotlist.opacity = NSS_WINDOW_OPACITY # Create Folder for Save file if SAVE_PATH != '' Dir.mkdir(SAVE_PATH) if !FileTest.directory?(SAVE_PATH) end if @saving @index = $game_temp.last_file_index @help_window.set_text(Vocab::SaveMessage) else @index = self.latest_file_index @help_window.set_text(Vocab::LoadMessage) (1..MAX_SAVE_SLOT).each do |i| @window_slotlist.draw_item(i-1, false) if !@window_slotdetail.file_exist?(i) end end @window_slotlist.index = @index # Draw Information @last_slot_index = @window_slotlist.index @window_slotdetail.draw_data(@last_slot_index + 1) end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background unless @bg.nil? @bg.bitmap.dispose @bg.dispose end @window_slotlist.dispose @window_slotdetail.dispose @help_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if !@confirm_window.nil? @confirm_window.update if Input.trigger?(Input::C) if @confirm_window.index == 0 determine_savefile @confirm_window.dispose @confirm_window = nil else Sound.play_cancel @confirm_window.dispose @confirm_window = nil end elsif Input.trigger?(Input::B) Sound.play_cancel @confirm_window.dispose @confirm_window = nil end else update_menu_background @window_slotlist.update if @window_slotlist.index != @last_slot_index @last_slot_index = @window_slotlist.index @window_slotdetail.draw_data(@last_slot_index + 1) end @help_window.update update_savefile_selection end end #-------------------------------------------------------------------------- # * Update Save File Selection #-------------------------------------------------------------------------- def update_savefile_selection if Input.trigger?(Input::C) if @saving and @window_slotdetail.file_exist?(@last_slot_index + 1) Sound.play_decision text1 = SFC_Text_Confirm text2 = SFC_Text_Cancel @confirm_window = Window_Command.new(SFC_Window_Width,[text1,text2]) @confirm_window.x = ((544 - @confirm_window.width) / 2) + SFC_Window_X_Offset @confirm_window.y = ((416 - @confirm_window.height) / 2) + SFC_Window_Y_Offset else determine_savefile end elsif Input.trigger?(Input::B) Sound.play_cancel return_scene end end #-------------------------------------------------------------------------- # * Execute Save #-------------------------------------------------------------------------- def do_save file = File.open(make_filename(@last_slot_index), "wb") write_save_data(file) file.close $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Execute Load #-------------------------------------------------------------------------- def do_load file = File.open(make_filename(@last_slot_index), "rb") read_save_data(file) file.close $scene = Scene_Map.new RPG::BGM.fade(1500) Graphics.fadeout(60) Graphics.wait(40) @last_bgm.play @last_bgs.play end #-------------------------------------------------------------------------- # * Confirm Save File #-------------------------------------------------------------------------- def determine_savefile if @saving Sound.play_save do_save else if @window_slotdetail.file_exist?(@last_slot_index + 1) Sound.play_load do_load else Sound.play_buzzer return end end $game_temp.last_file_index = @last_slot_index end #-------------------------------------------------------------------------- # * Create Filename # file_index : save file index (0-3) #-------------------------------------------------------------------------- def make_filename(file_index) return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index + 1).to_s } end #-------------------------------------------------------------------------- # * Select File With Newest Timestamp #-------------------------------------------------------------------------- def latest_file_index latest_index = 0 latest_time = Time.at(0) (1..MAX_SAVE_SLOT).each do |i| file_name = make_filename(i - 1) next if !@window_slotdetail.file_exist?(i) file_time = File.mtime(file_name) if file_time > latest_time latest_time = file_time latest_index = i - 1 end end return latest_index end end class Window_SlotList < Window_Command #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 icon_index = 0 self.contents.clear_rect(rect) if $scene.window_slotdetail.file_exist?(index + 1) icon_index = Wora_NSS::SAVED_SLOT_ICON else icon_index = Wora_NSS::EMPTY_SLOT_ICON end if !icon_index.nil? rect.x -= 4 draw_icon(icon_index, rect.x, rect.y, enabled) # Draw Icon rect.x += 26 rect.width -= 20 end self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index]) end def cursor_down(wrap = false) if @index < @item_max - 1 or wrap @index = (@index + 1) % @item_max end end def cursor_up(wrap = false) if @index > 0 or wrap @index = (@index - 1 + @item_max) % @item_max end end end class Window_NSS_SlotDetail < Window_Base include Wora_NSS def initialize super(160, 56, 384, 360) @data = [] @exist_list = [] @bitmap_list = {} @map_name = [] end def dispose dispose_tilemap super end def draw_data(slot_id) contents.clear # 352, 328 dispose_tilemap load_save_data(slot_id) if @data[slot_id].nil? if @exist_list[slot_id] save_data = @data[slot_id] # DRAW SCREENSHOT~ contents.fill_rect(0,30,352,160, MAP_BORDER) create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x, save_data['gamemap'].display_y) if DRAW_GOLD # DRAW GOLD gold_textsize = contents.text_size(save_data['gamepar'].gold).width goldt_textsize = contents.text_size(GOLD_TEXT).width contents.font.color = system_color contents.draw_text(0, 0, goldt_textsize, WLH, GOLD_TEXT) contents.draw_text(goldt_textsize + gold_textsize,0,200,WLH, Vocab::gold) contents.font.color = normal_color contents.draw_text(goldt_textsize, 0, gold_textsize, WLH, save_data['gamepar'].gold) end if DRAW_PLAYTIME # DRAW PLAYTIME hour = save_data['total_sec'] / 60 / 60 min = save_data['total_sec'] / 60 % 60 sec = save_data['total_sec'] % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) pt_textsize = contents.text_size(PLAYTIME_TEXT).width ts_textsize = contents.text_size(time_string).width contents.font.color = system_color contents.draw_text(contents.width - ts_textsize - pt_textsize, 0, pt_textsize, WLH, PLAYTIME_TEXT) contents.font.color = normal_color contents.draw_text(0, 0, contents.width, WLH, time_string, 2) end if DRAW_LOCATION # DRAW LOCATION lc_textsize = contents.text_size(LOCATION_TEXT).width mn_textsize = contents.text_size(save_data['map_name']).width contents.font.color = system_color contents.draw_text(0, 190, contents.width, WLH, LOCATION_TEXT) contents.font.color = normal_color contents.draw_text(lc_textsize, 190, contents.width, WLH, save_data['map_name']) end # DRAW FACE & Level & Name save_data['gamepar'].members.each_index do |i| actor = save_data['gameactor'][save_data['gamepar'].members[i].id] face_x_base = (i*80) + (i*8) face_y_base = 216 lvn_y_plus = 10 lv_textsize = contents.text_size(actor.level).width lvt_textsize = contents.text_size(LV_TEXT).width if DRAW_FACE # Draw Face contents.fill_rect(face_x_base, face_y_base, 84, 84, FACE_BORDER) draw_face(actor.face_name, actor.face_index, face_x_base + 2, face_y_base + 2, 80) end if DRAW_LEVEL # Draw Level contents.font.color = system_color contents.draw_text(face_x_base + 2 + 80 - lv_textsize - lvt_textsize, face_y_base + 2 + 80 - WLH + lvn_y_plus, lvt_textsize, WLH, LV_TEXT) contents.font.color = normal_color contents.draw_text(face_x_base + 2 + 80 - lv_textsize, face_y_base + 2 + 80 - WLH + lvn_y_plus, lv_textsize, WLH, actor.level) end if DRAW_NAME # Draw Name contents.draw_text(face_x_base, face_y_base + 2 + 80 + lvn_y_plus - 6, 84, WLH, actor.name, 1) end end else contents.draw_text(0,0, contents.width, contents.height - WLH, EMPTY_SLOT_TEXT, 1) end end def load_save_data(slot_id) file_name = make_filename(slot_id) if file_exist?(slot_id) or FileTest.exist?(file_name) @exist_list[slot_id] = true @data[slot_id] = {} # Start load data file = File.open(file_name, "r") @data[slot_id]['time'] = file.mtime @data[slot_id]['char'] = Marshal.load(file) @data[slot_id]['frame'] = Marshal.load(file) @data[slot_id]['last_bgm'] = Marshal.load(file) @data[slot_id]['last_bgs'] = Marshal.load(file) @data[slot_id]['gamesys'] = Marshal.load(file) @data[slot_id]['gamemes'] = Marshal.load(file) @data[slot_id]['gameswi'] = Marshal.load(file) @data[slot_id]['gamevar'] = Marshal.load(file) @data[slot_id]['gameselfvar'] = Marshal.load(file) @data[slot_id]['gameactor'] = Marshal.load(file) @data[slot_id]['gamepar'] = Marshal.load(file) @data[slot_id]['gametro'] = Marshal.load(file) @data[slot_id]['gamemap'] = Marshal.load(file) @data[slot_id]['total_sec'] = @data[slot_id]['frame'] / Graphics.frame_rate @data[slot_id]['map_name'] = get_mapname(@data[slot_id]['gamemap'].map_id) file.close else @exist_list[slot_id] = false @data[slot_id] = -1 end end def make_filename(file_index) return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index).to_s } end def file_exist?(slot_id) return @exist_list[slot_id] if !@exist_list[slot_id].nil? @exist_list[slot_id] = FileTest.exist?(make_filename(slot_id)) return @exist_list[slot_id] end def get_mapname(map_id) if @map_data.nil? @map_data = load_data("Data/MapInfos.rvdata") end if @map_name[map_id].nil? if MAP_NO_NAME_LIST.include?(map_id) @map_name[map_id] = MAP_NO_NAME_NAME else @map_name[map_id] = @map_data[map_id].name MAP_NAME_TEXT_SUB.each_index do |i| @map_name[map_id].sub!(MAP_NAME_TEXT_SUB[i], '') end end end return @map_name[map_id] end def create_tilemap(map_data, ox, oy) @viewport = Viewport.new(self.x + 2 + 16, self.y + 32 + 16, 348,156) @viewport.z = self.z @tilemap = Tilemap.new(@viewport) @tilemap.bitmaps[0] = Cache.system("TileA1") @tilemap.bitmaps[1] = Cache.system("TileA2") @tilemap.bitmaps[2] = Cache.system("TileA3") @tilemap.bitmaps[3] = Cache.system("TileA4") @tilemap.bitmaps[4] = Cache.system("TileA5") @tilemap.bitmaps[5] = Cache.system("TileB") @tilemap.bitmaps[6] = Cache.system("TileC") @tilemap.bitmaps[7] = Cache.system("TileD") @tilemap.bitmaps[8] = Cache.system("TileE") @tilemap.map_data = map_data @tilemap.ox = ox / 8 + 99 @tilemap.oy = oy / 8 + 90 end def dispose_tilemap unless @tilemap.nil? @tilemap.dispose @tilemap = nil end end end class Scene_Title < Scene_Base def check_continue file_name = Wora_NSS::SAVE_PATH + Wora_NSS::SAVE_FILE_NAME.gsub(/\{ID\}/i) { '*' } @continue_enabled = (Dir.glob(file_name).size > 0) end end #====================================================================== # END - NEO SAVE SYSTEM by Woratana #====================================================================== I would prefer someone tell me what's wrong and I'll see if I can solve it on my own but if you could provide a solution then it would be very much appreciated. I rarely go online so it might take a while for me to reply but I would appreciate it if you could help me. I'm just a newbie so I don't know what skills I can offer you in return but if you need help in your games, feel free to ask me. Thank for those who will help me in the future. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 19th June 2013 - 08:27 AM |
|
|