Okay, I generally try for a couple of days to fix problems (including surfing boards for solutions) before I ask for help, but I cannot seem to find a solution to this problem either on my own, or with another's help. I am using Rataime_Visual (Shadows, Sun, Reflections, Mirrors, and Destruction Engine), along with Law's Custom Save System. Everything works fine when I play a New Game, do any of the visual effects, and even when I save a game. The moment I go to load a game, I get this error:
Script 'Sprite Shadow' line 304: NoMethodError occurred.
undefined method 'shadows' for nil:NilClass
If I remove the 'Sprite Shadow' Script, I get the same error for Sun, but with Line 239. If I remove Sun, it will work, but I effectively cannot have shadows in my game. It all points to the same 'line':
if character.is_a?(Game_Event) and $game_temp.shadow_spriteset.shadows != [] for Shadows
if character.is_a?(Game_Event) and $game_temp.sun_spriteset.sun != [] for Sun
I'm not a n00b with RGSS, but I'm no expert. I suspect that it's the way that the Custom Save System handles the sprites it imports into the 'screenshot'. I don't know how to fix this problem. Any help, even just pointing in the right direction, would be appreciated.
Here is Law's Save System, just in case:
Thanks in advance!
Script 'Sprite Shadow' line 304: NoMethodError occurred.
undefined method 'shadows' for nil:NilClass
If I remove the 'Sprite Shadow' Script, I get the same error for Sun, but with Line 239. If I remove Sun, it will work, but I effectively cannot have shadows in my game. It all points to the same 'line':
if character.is_a?(Game_Event) and $game_temp.shadow_spriteset.shadows != [] for Shadows
if character.is_a?(Game_Event) and $game_temp.sun_spriteset.sun != [] for Sun
I'm not a n00b with RGSS, but I'm no expert. I suspect that it's the way that the Custom Save System handles the sprites it imports into the 'screenshot'. I don't know how to fix this problem. Any help, even just pointing in the right direction, would be appreciated.
Here is Law's Save System, just in case:
Content Hidden
Spoiler
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- #======================*Law's Custom Save System*==============================
- #=========================Author: The Law G14==================================
- #============================Version 1.1=======================================
- #==============================================================================
- #------------------------------------------------------------------------------
- #==============================================================================
- # ** Module_Customization
- #------------------------------------------------------------------------------
- # This module contains all the customization for the script
- #==============================================================================
- module Customization
- #----------------------------------------------------------------------------
- # * Config Begin
- #----------------------------------------------------------------------------
- # Here you can change the number of save slots that will be in your game
- SLOTS = 8
- # Here you can change the name of the text in the save slots
- SLOT_NAME = "Slot"
- # Here you can change what icon will appear next to a filename that isn't empty
- SLOT_ICON_SELECTED = "Keyblade1"
- # Here you can change what icon will appear next to a filename that is empty
- SLOT_ICON_UNSELECTED = "Keyblade2"
- # Draw Gold
- DRAW_GOLD = true
- # Draw Playtime
- DRAW_PLAYTIME = true
- # Draw location
- DRAW_LOCATION = true
- # Draw Actor's face
- DRAW_FACE = true
- # Draw Actor's name
- DRAW_NAME = true
- # Text inside file info window when empty
- EMPTY_SLOT_TEXT = "~EMPTY~"
- # Playtime Text
- PLAYTIME_TEXT = "Play Time: "
- # Gold Text
- GOLD_TEXT = "Money: "
- # Location Text
- LOCATION_TEXT = "Location: "
- # Map image border color (R,G,B,Opacity)
- MAP_BORDER = Color.new(0,0,0,200)
- # Text for help window when saving. Ex: "Which file would you like to save to?"
- SAVE_TEXT = "Which file would you like to save to?"
- # Text for help window when loading. Ex: "Which file would you like to load?"
- LOAD_TEXT = "Which file would you like to load?"
- # All windows' opacity (Lowest 0 - 255 Highest)
- # Use low opacity when having a background.
- WINDOW_OPACITY = 200
- # Background image file name, it must be in the pictures folder.
- # Put '' if you don't want a background.
- BACKGROUND_IMAGE = 'KingdomHeartsTitle'
- # Opacity for background image
- BACKGROUND_IMAGE_OPACITY = 255
- #----------------------------------------------------------------------------
- # * Config End
- #----------------------------------------------------------------------------
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles the map. It includes scrolling and passable determining
- # functions. Refer to "$game_map" for the instance of this class.
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :name
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias law_css_setup setup
- #--------------------------------------------------------------------------
- # * Setup
- # map_id : map ID
- #--------------------------------------------------------------------------
- def setup(*args)
- # Run the original setup
- law_css_setup(*args)
- # Load the name of the map
- @name = load_data("Data/MapInfos.rxdata")[@map_id].name
- end
- end
- #==============================================================================
- # ** Spriteset_Map_Loading_Preview
- #------------------------------------------------------------------------------
- # This class brings together map screen sprites, tilemaps, etc for the
- # loading screen's preview.
- #==============================================================================
- class Spriteset_Map_Loading_Preview
- #--------------------------------------------------------------------------
- # * Invariables
- #--------------------------------------------------------------------------
- RES_WIDTH = 352 # Please insert a number divisible by 32
- RES_HEIGHT = 160 # Please insert a number divisible by 32
- TOP_CORNER_X = 201
- TOP_CORNER_Y = 120
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- center
- # Make viewports
- @viewport1 = Viewport.new(TOP_CORNER_X, TOP_CORNER_Y, RES_WIDTH, RES_HEIGHT)
- @viewport2 = Viewport.new(TOP_CORNER_X, TOP_CORNER_Y, RES_WIDTH, RES_HEIGHT)
- @viewport3 = Viewport.new(TOP_CORNER_X, TOP_CORNER_Y, RES_WIDTH, RES_HEIGHT)
- @viewport1.z = 9200
- @viewport2.z = 9200
- @viewport3.z = 95000
- # Make tilemap
- @tilemap = Tilemap.new(@viewport1)
- @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
- for i in 0..6
- autotile_name = $game_map.autotile_names[i]
- @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
- end
- @tilemap.map_data = $game_map.data
- @tilemap.priorities = $game_map.priorities
- # Make panorama plane
- @panorama = Plane.new(@viewport1)
- @panorama.z = -1000
- # Make fog plane
- @fog = Plane.new(@viewport1)
- @fog.z = 3000
- # Make character sprites
- @character_sprites = []
- for i in $game_map.events.keys.sort
- sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
- @character_sprites.push(sprite)
- end
- @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
- # Make weather
- @weather = RPG::Weather.new(@viewport1)
- # Make picture sprites
- @picture_sprites = []
- for i in 1..50
- @picture_sprites.push(Sprite_Picture.new(@viewport2,
- $game_screen.pictures[i]))
- end
- # Make timer sprite
- @timer_sprite = Sprite_Timer.new
- # Frame update
- update
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- # Dispose of tilemap
- @tilemap.tileset.dispose
- for i in 0..6
- @tilemap.autotiles[i].dispose
- end
- @tilemap.dispose
- # Dispose of panorama plane
- @panorama.dispose
- # Dispose of fog plane
- @fog.dispose
- # Dispose of character sprites
- for sprite in @character_sprites
- sprite.dispose
- end
- # Dispose of weather
- @weather.dispose
- # Dispose of picture sprites
- for sprite in @picture_sprites
- sprite.dispose
- end
- # Dispose of timer sprite
- @timer_sprite.dispose
- # Dispose of viewports
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- center
- # If panorama is different from current one
- if @panorama_name != $game_map.panorama_name or
- @panorama_hue != $game_map.panorama_hue
- @panorama_name = $game_map.panorama_name
- @panorama_hue = $game_map.panorama_hue
- if @panorama.bitmap != nil
- @panorama.bitmap.dispose
- @panorama.bitmap = nil
- end
- if @panorama_name != ""
- @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- end
- Graphics.frame_reset
- end
- # If fog is different than current fog
- if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
- @fog_name = $game_map.fog_name
- @fog_hue = $game_map.fog_hue
- if @fog.bitmap != nil
- @fog.bitmap.dispose
- @fog.bitmap = nil
- end
- if @fog_name != ""
- @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- end
- Graphics.frame_reset
- end
- # Update tilemap
- @tilemap.ox = $game_map.display_x / 4
- @tilemap.oy = $game_map.display_y / 4
- @tilemap.update
- # Update panorama plane
- @panorama.ox = $game_map.display_x / 8
- @panorama.oy = $game_map.display_y / 8
- # Update fog plane
- @fog.zoom_x = $game_map.fog_zoom / 100.0
- @fog.zoom_y = $game_map.fog_zoom / 100.0
- @fog.opacity = $game_map.fog_opacity
- @fog.blend_type = $game_map.fog_blend_type
- @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
- @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
- @fog.tone = $game_map.fog_tone
- # Update character sprites
- for sprite in @character_sprites
- sprite.update
- end
- # Update weather graphic
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.ox = $game_map.display_x / 4
- @weather.oy = $game_map.display_y / 4
- @weather.update
- # Update picture sprites
- for sprite in @picture_sprites
- sprite.update
- end
- # Update timer sprite
- @timer_sprite.update
- # Set screen color tone and shake position
- @viewport1.tone = $game_screen.tone
- @viewport1.ox = $game_screen.shake
- # Set screen flash color
- @viewport3.color = $game_screen.flash_color
- # Update viewports
- @viewport1.update
- @viewport3.update
- end
- #--------------------------------------------------------------------------
- # * Set Map Display Position to Center of Screen
- #--------------------------------------------------------------------------
- def center
- x = $game_player.real_x
- y = $game_player.real_y
- max_x = [($game_map.width - RES_WIDTH / 32) * 128, RES_WIDTH].max
- max_y = [($game_map.height - RES_HEIGHT / 32) * 128, RES_HEIGHT].max
- center_x = (RES_WIDTH/2 - 16) * 4 # Center screen x-coordinate * 4
- center_y = (RES_HEIGHT/2 - 16) * 4 # Center screen y-coordinate * 4
- $game_map.display_x = [0, [x - center_x, max_x].min].max
- $game_map.display_y = [0, [y - center_y, max_y].min].max
- $game_map.refresh
- 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
- #--------------------------------------------------------------------------
- # * Object Initialization
- # file_index : save file index (0-3)
- # filename : file name
- #--------------------------------------------------------------------------
- def initialize(file_index, filename, position)
- super(0, 64 + position * 52, 115, 52)
- self.contents = Bitmap.new(width - 32, height - 32)
- @file_index = file_index
- @filename = Customization::SLOT_NAME + "#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @file_exist
- # Draw file number
- self.contents.font.color = normal_color
- bitmap = RPG::Cache.icon(Customization::SLOT_ICON_SELECTED)
- @opacity = 255
- else
- self.contents.font.color = disabled_color
- bitmap = RPG::Cache.icon(Customization::SLOT_ICON_UNSELECTED)
- @opacity = 100
- end
- name = Customization::SLOT_NAME + "#{@file_index + 1}"
- self.contents.draw_text(20, -7, 600, 32, name)
- @name_width = contents.text_size(name).width
- self.contents.fill_rect(0, -2, 10, 32, Color.new(0, 0, 0, 0))
- self.contents.blt(0, -2, bitmap, Rect.new(0, 0, 24, 24), opacity)
- 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(0, -7, @name_width + 38, 32)
- else
- self.cursor_rect.empty
- end
- end
- end
- #==============================================================================
- # ** Window_FileInfo
- #------------------------------------------------------------------------------
- # This window displays file information.
- #==============================================================================
- class Window_FileInfo < Window_Base
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- if @law_save_resume_done_before.nil?
- alias nr_dispose dispose
- @law_save_resume_done_before = true
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(115, 64, 525, 416)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh($game_temp.last_file_index)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(file_index)
- self.contents.clear
- @spriteset.dispose unless @spriteset.nil?
- @spriteset = nil
- @file_index = file_index
- @filename = Customization::SLOT_NAME + "#{@file_index + 1}.rxdata"
- @file_exist = FileTest.exist?(@filename)
- save_data = Customization::SLOTS
- # If save file exists
- if @file_exist
- file = File.open(@filename, "rb")
- $time_stamp = file.mtime
- $characters = 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)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- file.close
- @total_sec = @frame_count / Graphics.frame_rate
- # Draw Screenshot
- begin
- width = 352 + 4
- height = 160 + 4
- x = (self.width - 32 - width) / 2
- y = 54 - 16
- self.contents.fill_rect(x, y, width, height, Customization::MAP_BORDER)
- @spriteset = Spriteset_Map_Loading_Preview.new
- end
- # Draw Gold
- if Customization::DRAW_GOLD
- cx = contents.text_size($data_system.words.gold).width
- self.contents.font.color = normal_color
- self.contents.font.size = 25
- self.contents.draw_text(40, 0, 140, 32, $game_party.gold.to_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(140, 0, 100, 32, $data_system.words.gold, 2)
- self.contents.draw_text(-20, -1, 100, 32, Customization::GOLD_TEXT, 2)
- end
- # Draw actor face
- if Customization::DRAW_FACE
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- draw_actor_face_graphic(actor, i*129, 250)
- end
- end
- # Draw actor name
- if Customization::DRAW_NAME
- for i in 0...$game_party.actors.size
- self.contents.font.color = system_color
- self.contents.font.size = 25
- actor = $game_party.actors[i]
- draw_actor_name(actor, (i*130) + 25, 350)
- end
- end
- # Draw play time
- if Customization::DRAW_PLAYTIME
- 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.font.size = 25
- self.contents.draw_text(380, 0, 100, 32, time_string, 2)
- self.contents.font.color = system_color
- time_string = Customization::PLAYTIME_TEXT
- self.contents.draw_text(230, 0, 150, 32, time_string, 2)
- end
- # Draw Location
- if Customization::DRAW_LOCATION
- self.contents.font.color = system_color
- self.contents.font.size = 25
- self.contents.draw_text(4, 210, 120, 32, Customization::LOCATION_TEXT)
- self.contents.font.color = normal_color
- x = (Customization::LOCATION_TEXT.length * 10) + 5
- self.contents.draw_text(x, 210, 120, 32, $game_map.name.to_s, 2)
- end
- else
- self.contents.draw_text(-20, 50, self.contents.width, self.contents.height - 200, Customization::EMPTY_SLOT_TEXT, 1)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Face Graphic
- #--------------------------------------------------------------------------
- def draw_actor_face_graphic(actor, x, y)
- bitmap = RPG::Cache.picture(actor.id.to_s)
- self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
- end
- #--------------------------------------------------------------------------
- # * Dispose Window
- #--------------------------------------------------------------------------
- def dispose(*args)
- nr_dispose(*args)
- @spriteset.dispose unless @spriteset.nil?
- @spriteset = nil
- end
- end
- #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # This is a superclass for the save screen and load screen.
- #==============================================================================
- class Scene_File
- #--------------------------------------------------------------------------
- # * Invariables
- #--------------------------------------------------------------------------
- CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4
- CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4
- #--------------------------------------------------------------------------
- # * Object Initialization
- # help_text : text string shown in the help window
- #--------------------------------------------------------------------------
- def initialize(help_text)
- @help_text = help_text
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- @cursor_displace = 0
- # Make help window
- @help_window = Window_Help.new
- @help_window.set_text(@help_text)
- @help_window.opacity = Customization::WINDOW_OPACITY
- # Make save file window
- @savefile_windows = []
- for i in 0..Customization::SLOTS - 1
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
- end
- # Select last file to be operated
- @file_index = $game_temp.last_file_index
- @savefile_windows[@file_index].selected = true
- for i in @savefile_windows
- i.opacity = Customization::WINDOW_OPACITY
- end
- # Make FileInfo window
- @fileinfo_window = Window_FileInfo.new
- @fileinfo_window.opacity = Customization::WINDOW_OPACITY
- # Make background
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.picture(Customization::BACKGROUND_IMAGE)
- # 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
- @fileinfo_window.dispose
- @sprite.dispose
- @sprite.bitmap.dispose
- # $game_player.center($game_player.x, $game_player.y)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- @help_window.update
- @fileinfo_window.update
- for i in @savefile_windows
- i.update
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Call method: on_decision (defined by the subclasses)
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- @fileinfo_window.refresh(@file_index)
- center
- 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 Input.trigger?(Input::DOWN) or @file_index < Customization::SLOTS - 1
- if @file_index == Customization::SLOTS - 1
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace = @file_index
- @cursor_displace += 1
- if @cursor_displace == 8
- @cursor_displace = 7
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..Customization::SLOTS
- f = i - 6 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index + 1)
- if @file_index == 8
- @file_index = 7
- end
- for i in 0..Customization::SLOTS - 1
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- @fileinfo_window.refresh(@file_index)
- return
- end
- end
- # If the up directional button was pressed
- if Input.repeat?(Input::UP)
- if Input.trigger?(Input::UP) or @file_index > 0
- if @file_index == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace = @file_index
- @cursor_displace -= 1
- if @cursor_displace == -1
- @cursor_displace = 0
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..Customization::SLOTS
- f = i - 1 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index - 1)
- if @file_index == -1
- @file_index = 0
- end
- for i in 0..Customization::SLOTS - 1
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- @fileinfo_window.refresh(@file_index)
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Make File Name
- # file_index : save file index (0-3)
- #--------------------------------------------------------------------------
- def make_filename(file_index)
- return Customization::SLOT_NAME + "#{file_index + 1}.rxdata"
- end
- #--------------------------------------------------------------------------
- # * Backup Data
- #--------------------------------------------------------------------------
- def backup_data
- @nr_game_system = $game_system.clone
- @nr_game_switches = $game_switches.clone
- @nr_game_variables = $game_variables.clone
- @nr_game_self_switches = $game_self_switches.clone
- @nr_game_screen = $game_screen.clone
- @nr_game_actors = $game_actors.clone
- @nr_game_party = $game_party.clone
- @nr_game_troop = $game_troop.clone
- @nr_game_map = $game_map.clone
- @nr_game_player = $game_player.clone
- end
- #--------------------------------------------------------------------------
- # * Load Backup Data
- #--------------------------------------------------------------------------
- def load_backup_data
- $game_system = @nr_game_system.clone
- $game_switches = @nr_game_switches.clone
- $game_variables = @nr_game_variables.clone
- $game_self_switches = @nr_game_self_switches.clone
- $game_screen = @nr_game_screen.clone
- $game_actors = @nr_game_actors.clone
- $game_party = @nr_game_party.clone
- $game_troop = @nr_game_troop.clone
- $game_map = @nr_game_map.clone
- $game_player = @nr_game_player.clone
- end
- #--------------------------------------------------------------------------
- # * Set Map Display Position to Center of Screen
- #--------------------------------------------------------------------------
- def center
- max_x = ($game_map.width - 20) * 128
- max_y = ($game_map.height - 15) * 128
- x = $game_player.x
- y = $game_player.y
- $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
- $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
- end
- end
- #==============================================================================
- # ** Scene_Save
- #------------------------------------------------------------------------------
- # This class performs save screen processing.
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias law_css_scene_save_initialize initialize
- alias nr_css_scene_save_on_cancel on_cancel
- alias nr_css_scene_save_on_desision on_decision
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(*args)
- backup_data
- law_css_scene_save_initialize(*args)
- super(Customization::SAVE_TEXT)
- end
- #--------------------------------------------------------------------------
- # * On Decision
- #--------------------------------------------------------------------------
- def on_decision(*args)
- load_backup_data
- nr_css_scene_save_on_desision(*args)
- center
- end
- #--------------------------------------------------------------------------
- # * On Decision
- #--------------------------------------------------------------------------
- def on_cancel(*args)
- load_backup_data
- nr_css_scene_save_on_cancel(*args)
- end
- end
- #==============================================================================
- # ** Scene_Load
- #------------------------------------------------------------------------------
- # This class performs load screen processing.
- #==============================================================================
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- if @nr_css_done_before.nil?
- alias law_css_scene_load_initialize initialize
- @nr_css_done_before = true
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(*args)
- law_css_scene_load_initialize(*args)
- super(Customization::LOAD_TEXT)
- end
- end
- #==============================================================================
- # ** 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 = "New Game"
- s2 = "Continue"
- s3 = "Shutdown"
- @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
- for i in 0..Customization::SLOTS
- if FileTest.exist?(Customization::SLOT_NAME + "#{i + 1}.rxdata")
- @continue_enabled = true
- 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
- end
Expand to see the code.
Thanks in advance!