Group: Local Mod
Posts: 1,348
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Version 1.1 is released!
It is now 100% compatible wtih Blizz ABS but the cost was that I had to drop the character being shown in the screenshot since that was causing too many problems. The Location text has a space now and I've added a section in the compatibility section about how to make this script compatible with MOG Animated Title Celia V4.
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
okay, so i tried this in both my current game, and a completely new project with no added scripts.
no matter where you save at, the save file shows the screen centered on the point on the map where you entered the map. then, when you load, it loads up the map with the view centered on that point with the player off screen.
this is a wonderful script, and I want very badly to use it. the push_sprite part is incompatible with one of my scripts, but that is an easy fix if i simply remove the part where the sprite is drawn, but the problem with loading up the wrong section of the map is a much bigger issue. i can't simply remove a section and it be okay.
#------------------------------------------------------------------------------ #============================================================================== #============================================================================== #======================*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 = "001-Weapon01" # Here you can change what icon will appear next to a filename that is empty SLOT_ICON_UNSELECTED = "002-Weapon02"
# Text inside file info window when empty EMPTY_SLOT_TEXT = "~EMPTY~"
# Playtime Text PLAYTIME_TEXT = "Play Time: " # Gold Text GOLD_TEXT = "Gold: " # 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 = 255 # Background image file name, it must be in the pictures folder. # Put '' if you don't want a background. BACKGROUND_IMAGE = '' # 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
#============================================================================== # ** Window_SaveFile #------------------------------------------------------------------------------ # This window displays save files on the save and load screens. #==============================================================================
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 dispose_tilemap @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, "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) @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 self.contents.fill_rect(640/10,50,352,160, Customization::MAP_BORDER) create_tilemap(@filename, 0, 0) # 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, 100, 32, @game_party.gold.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(140, 0, 20, 32, $data_system.words.gold, 2) self.contents.draw_text(-20, 0, 80, 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 #-------------------------------------------------------------------------- # * Create Tilemap #-------------------------------------------------------------------------- def create_tilemap(map_data, ox, oy) @viewport = Viewport.new(self.x + 640 / 10 + 18, self.y + 50 + 18, 348, 156) @viewport.z = self.z + 9 @tilemap = Tilemap.new(@viewport) @tilemap.ox = @game_player.x * 10 @tilemap.oy = @game_player.y * 20 @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(@viewport) @panorama.z = -1000 # Make fog plane @fog = Plane.new(@viewport) @fog.z = 3000 # Make character sprites @character_sprites = [] for i in $game_map.events.keys.sort push_sprite($game_map.events[i]) end # Make weather @weather = RPG::Weather.new(@viewport) end #-------------------------------------------------------------------------- # * Dispose Tilemap #-------------------------------------------------------------------------- def dispose_tilemap unless @tilemap.nil? # Dispose of tilemap @tilemap.tileset.dispose for i in 0..6 @tilemap.autotiles[i].dispose end @tilemap.dispose @tilemap = nil # 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 viewports @viewport.dispose end end #-------------------------------------------------------------------------- # * Dispose Window #-------------------------------------------------------------------------- def dispose(*args) nr_dispose(*args) dispose_tilemap 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 #-------------------------------------------------------------------------- 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 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) 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 end
#============================================================================== # ** Scene_Save #------------------------------------------------------------------------------ # This class performs save screen processing. #==============================================================================
class Scene_Save < Scene_File #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias law_css_scene_save_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize law_css_scene_save_initialize super(Customization::SAVE_TEXT) end end
#============================================================================== # ** Scene_Load #------------------------------------------------------------------------------ # This class performs load screen processing. #==============================================================================
class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias law_css_scene_load_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize law_css_scene_load_initialize 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
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
okay, i tried it out, and there are still two issues. the push_sprite thing seems to have an error whenever there is any other sprite on the map besides the hero. if i remove the sections that deal with the sprite, i can have other sprites, but once i save just once, all subsequent saves locate me back at the point of the first save, even if i change maps. or it loads me up on the appropriate map, but at the coordinates where i saved on the other map. i am trying this out on a completely blank new project, with no modifications or scripts beside this one.
i hope you can figure out the issue, since this is a really awesome looking script.
Group: Local Mod
Posts: 1,348
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Sorry for the long delay
I was trying to contact Night_Runner who made the screenshot part of the script and he's just fixed the error. I've uploaded the new version of the script that should be working
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
okay, so i tried again, and the viewport/map screen shot thing works just fine. but the problem i keep running into is that whenever you back out of the menu after saving, or load up the save, the map loads centered at the far bottom right of the map, no matter what. my character stays where i put him, but the view changes to the bottom right. i tried this on two different maps, and this happened on both maps. i saved, backed out of the menu, and the screen was centered at the far right. once i found my character again, the screen followed him. the same is true when i load the save.
i am working with a completely blank project. i made a new one just to test this script, so that all issues would be with the script alone, and not compatibility. i hate to continually bother you with this, but it is my sincere hope that you and nightrunner will be able to complete this script so that everyone can enjoy it. your scripts are really great, and make any game look even better.
Group: Local Mod
Posts: 1,348
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Fixed! Night_Runner edited the script and sent it to me but the problem was still there when you save, though it was fixed when you loaded. So I've just finsihed fixing that so I've posted up the new edited version that Night_Runner and I made on the first post of this topic. Oh, and you're not bothering us
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
well, is it any wonder? it's a really awesome script that really spruces up the dull factory save/load screen. and there is no need to apologize. this is how these things work. i'm just glad that i can help you guys out by play testing it. this also helps everybody else who comes along later, and says, "Wow, this is awesome, I wanna use it too!"
However, with that said, i may have spoken a bit too soon. while it works absolutely perfectly on maps larger than 20X15, on 20X15 maps, i encounter an error wherein the view centers over the hero such that the map has a weird looping scroll effect when you exit the menu or load a save.
hopefully this will be a quick fix, and until then, i'll just make maps slightly larger than 20X15. like i said, it isn't a problem at all on larger maps, but 20X15s have issues for some reason. as before, testing on a blank project.
Group: Local Mod
Posts: 1,348
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Lol, Night_Runner already PMed me a fix since he was looking over the thread. Just look at the first post in this thread for the new verison I've posted from Night_Runner's edit.
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
ah, delicious! it works on all accounts now. i will definitely use this on a future game, but unfortunately, as of right now, it creates a major conflict with another script i'm working with that is more integral to the game, so unless i can figure out how to resolve that issue, i'll be saving this script for a different project.
Okey. Now there is another problem. I'm using version 1.3 if you wonder. Whenever I go out from Scene_Load or Scene_Save it just changes place of the screen to somewhere else. This happens when I go in for a load and then hits cancel, when I go in for a load and hits Enter, or when I save. The only thing is that where ever I load from, it allways changes to the map that is shown on the screenshot in the scene, no matter where I were before. Attached a screen of what happens after I leave the Load or Save screen
You know what. I'll just attach the Scripts.rxdata instead.
This post has been edited by stripe103: Feb 6 2010, 02:08 AM
Attached File(s)
noname.bmp ( 900.05K )
Number of downloads: 12 Scripts.zip ( 314.3K )
Number of downloads: 8
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
that looks a lot like the problem i was having for the longest. it appears that you are working with some custom scripts. i suggest trying this script in a new project first. if it works on its own, then you have a script conflict between this script and another one that you are working with. this script is HIGHLY invasive, which also means, it may not work with a lot of scripts. if you can find the script that it conflicts with, you may be able to find a way to make them compatible (or ask someone to help you do so if such a thing is possible).
otherwise, wait for Law/NightRunner to show up. they are always VERY helpful.
Thank you. And yea, they are really helpful. Allways. Anyway, I DID try to make a new project and instert it there, and it worked just as it should. That is why I included the Scripts.rxdata in my last post, so hopefully, Law or Night Runner can look through all my scripts and find the problem. I really need this to work since these is the default scripts that I use for all of my projects(currently have two).
This looks like a really nice script. I would really like to use it, that is if the bugs have been fixed and it works right. Anyway, I was wondering if it would be possible to use the character graphics instead of face graphics in the save/load menu.
My project only requires character sets, no faces, no battlers... simply character sets. So if this script allows replacing your face graphics with graphics of the characters it might integrate rather well with my project... assuming none of the scripts I'm currently using will conflict with it.
Here's a link to the scripts I am using as of now, so if there are any known compatibility issues, I could know about them before attempting to use the script:
Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed
instead of asking for someone to look through your scripts and tell you if its incompatible, y don't you just check yourself. as for bugs, there are none. by itself, Law's Save System is fully functioning, I've tested it myself extensively. However, it rewrites a lot of things in order to make all of the components work. it completely circumvents the regular load/save system, so any script that changes the load/save system in anyway will be incompatible. for instance, the custom leveling system I have is wholly incompatible with this. if you plug the script in and something doesn't work right, you know that you have a compatibility issue with another script.
as for drawing the character graphic instead of the face graphic, all you need to do is open up your preferred image editing program and crop the character(s) image(s) down to the desired frame, and name it according to their ID# in the database. that would be the easiest way. the other way involves editing the script, and this is a really complicated script. while i can simply copy and paste the draw_actor_graphic method in and have it draw the character, it doesn't put it in the correct place, and i am not good enough to know why that is. the easiest thing is to do a graphical change, and not fool with the script.
#------------------------------------------------------------------------------ #============================================================================== #============================================================================== #======================*Law's Custom Save System*============================== #==================Author: The Law G14 and Night_Runner======================== #==============================Version 1.3a==================================== #============================================================================== #------------------------------------------------------------------------------
#============================================================================== # ** 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 = "001-Weapon01" # Here you can change what icon will appear next to a filename that is empty SLOT_ICON_UNSELECTED = "002-Weapon02"
# Text inside file info window when empty EMPTY_SLOT_TEXT = "~EMPTY~"
# Playtime Text PLAYTIME_TEXT = "Play Time: " # Gold Text GOLD_TEXT = "Gold: " # 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 = 255 # Background image file name, it must be in the pictures folder. # Put '' if you don't want a background. BACKGROUND_IMAGE = '' # 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 < Spriteset_Map #-------------------------------------------------------------------------- # * 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, $nr_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 = $nr_game_player.real_x y = $nr_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
class Spriteset_Map_Loading_Preview # setting all accessible variables attr_accessor :viewport1 attr_accessor :character_sprites #---------------------------------------------------------------------------- # override Initialization #---------------------------------------------------------------------------- alias init_blizzabs_later initialize def initialize # call original method init_blizzabs_later # iterate through all active remotes, beams and all actors except player ($BlizzABS.cache.remotes + $BlizzABS.cache.beams + $BlizzABS.battlers - [$game_player]).each {|character| # if it's really a character if character.is_a?(Game_Character) # create sprite sprite = Sprite_Character.new(@viewport1, character) # update sprite sprite.update # add sprite to character_sprites @character_sprites.push(sprite) end} # set damage update flag @dmg_update = ($scene.is_a?(Scene_Map)) end #---------------------------------------------------------------------------- # override update #---------------------------------------------------------------------------- alias upd_blizzabs_later update def update # iterate through all damage sprites $BlizzABS.cache.damages.each_index {|i| # if request if $BlizzABS.cache.damages[i].is_a?(BlizzABS::DamageRequest) # create sprite based upon request $BlizzABS.cache.damages[i] = Sprite_Damage.new($BlizzABS.cache.damages[i]) # if damage sprite opacity is 0 elsif $BlizzABS.cache.damages[i].opacity == 0 # delete damage sprite $BlizzABS.cache.damages[i].dispose # remove deleted damage sprite $BlizzABS.cache.damages[i] = nil end} # iterate through all beam sprites $BlizzABS.cache.beams.each_index {|i| # if damage sprite opacity is 0 if $BlizzABS.cache.beams[i][0].opacity == 0 # delete damage sprite $BlizzABS.cache.beams[i][0].dispose # remove deleted damage sprite $BlizzABS.cache.beams[i] = nil end} # remove nil values from both arrays $BlizzABS.cache.damages.compact! $BlizzABS.cache.beams.compact! # if damage sprites allowed to be updated if @dmg_update # update damage sprites $BlizzABS.cache.damages.each {|dmg| dmg.update} # iterate through all beam sprites $BlizzABS.cache.beams.each {|beam| # decrease counter beam[1] -= 1 # set new opacity beam[0].opacity = beam[1] * 15} end # call original method upd_blizzabs_later # update character sprites additionally update_blizzabs_character_sprites end #---------------------------------------------------------------------------- # update_blizzabs_character_sprites # Updates the character sprites additionally. #---------------------------------------------------------------------------- def update_blizzabs_character_sprites # iterate through all character sprites @character_sprites.each_index {|i| # temporary variables sprite = @character_sprites[i] character = sprite.character # if character is a dead enemy or an unsummoning pet or monster if (character.is_a?(Map_Enemy) || character.is_a?(Map_Actor) && $BlizzABS.summoned?(character)) && character.battler != nil && character.battler.dead? # set dying flag sprite.dying = true # if character which the sprite observes is a projectile elsif character.is_a?(Map_Projectile) && character.fade_out # set fade out flag sprite.fade_out = true end # if dying if sprite.dying # update die sprite.update_die # if respawning elsif sprite.respawning # update die sprite.update_respawn # if fading in elsif sprite.fade_in # update fade in sprite.update_fade_in # if fading out elsif sprite.fade_out # update fading out sprite.update_fade_out end # if sprite died and ready for deletion or expired character if character.terminate # if character is remote and remote expired if character.is_a?(Map_Remote) # remove projectile from active remotes $BlizzABS.cache.remotes.delete(character) # if character which the sprite observes is enemy elsif character.is_a?(Map_Enemy) && !character.ai.lifeless? # find all Respawn Points for this enemy tmp = $game_map.respawns.find_all {|event| !event.erased && event.respawn_ids != nil && event.respawn_ids.include?(character.battler_id)} # if none exists if tmp.size == 0 # normal respawn setting time = $game_system.respawn_time else # get a random Respawn Point and let this enemy know where it is character.respawn_point = tmp[rand(tmp.size)] # set the Respawn Points respawn time time = character.respawn_point.respawn_time end # add respawn counter for character $game_system.killed[character] = time * 40 end # dispose sprite sprite.dispose # remove sprite from spriteset @character_sprites[i] = nil end} # remove nil values @character_sprites.compact! end end
#============================================================================== # ** Window_SaveFile #------------------------------------------------------------------------------ # This window displays save files on the save and load screens. #==============================================================================
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) $nr_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, 100, 32, $game_party.gold.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(140, 0, 20, 32, $data_system.words.gold, 2) self.contents.draw_text(-20, 0, 80, 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 @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 center 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 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_temp = $game_temp.clone @nr_frame_count = Graphics.frame_count @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_temp = @nr_game_temp.clone Graphics.frame_count = @nr_frame_count $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 $nr_game_player = nil center 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 #-------------------------------------------------------------------------- if @nr_css_done_before.nil? 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 @nr_css_done_before = true end #-------------------------------------------------------------------------- # * 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) 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
#============================================================================== # End of Script. #==============================================================================
It should work with your setup
@> Fixxxxer4135: There hasn't got any known compatibility issues with any of those scripts (yet), try this out:
#------------------------------------------------------------------------------ #============================================================================== #============================================================================== #======================*Law's Custom Save System*============================== #==================Author: The Law G14 and Night_Runner======================== #============================Version 1.3======================================= #============================================================================== #------------------------------------------------------------------------------
#============================================================================== # ** 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 = "001-Weapon01" # Here you can change what icon will appear next to a filename that is empty SLOT_ICON_UNSELECTED = "002-Weapon02"
# Text inside file info window when empty EMPTY_SLOT_TEXT = "~EMPTY~"
# Playtime Text PLAYTIME_TEXT = "Play Time: " # Gold Text GOLD_TEXT = "Gold: " # 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 = 255 # Background image file name, it must be in the pictures folder. # Put '' if you don't want a background. BACKGROUND_IMAGE = '' # 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. #==============================================================================
#============================================================================== # ** 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
And it should work fine
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.