Yay, I beat the game! And goddamnit, the ending was a backstabber..
Anyways
It should work correctly now, with the 'New Game +' being displayed in the saveslots etc. And just a tip, redefining methods will always cause conflicts between two or more scripts. You can eighter alias, change the method's name, or just compose all those methods into one single method. Ruby is meant to be simple and an 'easy to get into language', unlike many others. Therefore I think that people could try atleast, before asking people to do it for them on the internet. I don't mean to be rude or anything, and even though there are people out there like myself who are willing to help out, there's still no better way than knowing how to do it yourself, you know
Anyhow, the demo was clear and constructive and even kinda entertaining, you did a good job there I must say
So, here's the modified NG+ script:
#===============================================================================
# New Game Plus
# By MysteryMan23
# Do not redistribute without permission.
#~
# ~Rewritten by Mangomight for compability with Neo's Save System
# 2012-12-08
#~~
# * Revisions to Note:
# Several methods has been removed/altered for compability with Neo's Save
# System, thus can't the two scripts be run without each other.
#~
#-------------------------------------------------------------------------------
# Version History:
# 1.0 - Initial script. (07/23/2011)
#-------------------------------------------------------------------------------
# What does this script do?:
#
# This script allows you to implement a New Game Plus feature in your games.
# This is done by modifying the behavior of the File screen to start a New Game
# plus when the game you're trying to load has a certain switch enabled. This
# switch can be whatever switch you desire. Also, you're allowed to alter the
# behavior of the New Game Plus function to include or exclude whatever values
# you want.
#-------------------------------------------------------------------------------
# Instructions:
#
# Place this script in the "Materials" section. Then, adjust the settings in the
# configuration module to whatever you wish.
#-------------------------------------------------------------------------------
# Thanks to:
#
# Woratana, for inspiring this script with "New Game Plus Reborn"
# Yanfly, whose scripts helped guide me in making this
# Jet, likewise.
#===============================================================================
$imported = {} if $imported == nil
$imported["MM23_New_Game_Plus"] = true
module NewGamePlus
# This is the ID of the switch you want to turn on for New Game Plus.
NGP_SWITCH = 1
# This is the array of switches you want to preserve. Note that NGP_SWITCH
# can not and should not be preserved; if it is listed in this array, it will
# be ignored.
SWITCHES_TO_PRESERVE = [3]
# This is the array of variables you want to preserve.
VARIABLES_TO_PRESERVE = []
# This lets you decide whether or not you want the time played to carry over.
PRESERVE_TIME = true
# This lets you decide whether or not you want the save count to carry over.
PRESERVE_SAVE_COUNT = true
# This lets you decide whether or not you want the actors to carry over.
PRESERVE_ACTORS = true
# This lets you decide whether or not you want the party's gold to carry over.
PRESERVE_GOLD = true
# This lets you decide whether or not you want the step count to carry over.
PRESERVE_STEP_COUNT = true
# This lets you decide whether or not you want the inventory to carry over. If
# this is false, and PRESERVE_ACTORS is true, the actors' equipment will be
# reset to their default.
PRESERVE_INVENTORY = false
# This allows you to prevent certain items from being carried over to the new
# game. Note that all copies of the item will be erased.
EXCLUDED_ITEMS = [1..39]
# This allows you to prevent certain weapons from being carried over to the
# new game. Note that all copies of the weapon will be erased, including any
# copies equipped by actors.
EXCLUDED_WEAPONS = []
# This allows you to prevent certain armors from being carried over to the new
# game. Note that all copies of the armor will be erased, including any copies
# equipped by actors.
EXCLUDED_ARMORS = []
# This allows you to prevent certain skills from being carried over to the new
# game. Leave this empty if PRESERVE_ACTORS is false.
EXCLUDED_SKILLS = [81, 82]
# This is the help text that appears when highlighting a Clear Game file.
VOCAB_NGP_HELP = "It works without Neo Save!"
# This is the text that appears in the top-right corner of a Clear Game file.
VOCAB_CLEAR_GAME = "GAME +"
# This is the color of the text specified above.
CLEAR_GAME_COLOR = 6
end
#===============================================================================
# Editing beyond this point may result in the script not behaving correctly.
# Therefore, only edit past this point if you're certain of what you're doing.
# Hell, I managed to break the script editing down here, and I'm the author!
#===============================================================================
class Array
#--------------------------------------------------------------------------
# * Returns true if the given object is present in the array by using
# the '===' operator (checking for associated objects aswell), returns
# false otherwise.
#--------------------------------------------------------------------------
def has_object?(obj)
self.each { |i| return true if i === obj }
return assoc(obj) != nil
end
end
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * New Method: Set up New Game Plus
#--------------------------------------------------------------------------
def new_game_plus
preserved_switches = preserve_switches
preserved_variables = preserve_variables
preserved_frame_count = Graphics.frame_count if NewGamePlus::PRESERVE_TIME
preserved_save_count = $game_system.save_count if NewGamePlus::PRESERVE_SAVE_COUNT
preserved_actors = preserve_actors if NewGamePlus::PRESERVE_ACTORS
preserved_gold = $game_party.gold if NewGamePlus::PRESERVE_GOLD
preserved_step_count = $game_party.steps if NewGamePlus::PRESERVE_STEP_COUNT
preserved_items = preserve_items if NewGamePlus::PRESERVE_INVENTORY
preserved_weapons = preserve_weapons if NewGamePlus::PRESERVE_INVENTORY
preserved_armors = preserve_armors if NewGamePlus::PRESERVE_INVENTORY
recreate_game_objects
reset_switches(preserved_switches)
reset_variables(preserved_variables)
$game_system.save_count = preserved_save_count if NewGamePlus::PRESERVE_SAVE_COUNT
reset_actors(preserved_actors)
$game_party.gain_gold(preserved_gold) if NewGamePlus::PRESERVE_GOLD
$game_party.steps = preserved_step_count if NewGamePlus::PRESERVE_STEP_COUNT
reset_inventory(preserved_items) if NewGamePlus::PRESERVE_INVENTORY
reset_inventory(preserved_weapons) if NewGamePlus::PRESERVE_INVENTORY
reset_inventory(preserved_armors) if NewGamePlus::PRESERVE_INVENTORY
confirm_player_location
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = NewGamePlus::PRESERVE_TIME ? preserved_frame_count : 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# * New Method: Preserve Switches
#--------------------------------------------------------------------------
def preserve_switches
switches = {}
for i in NewGamePlus::SWITCHES_TO_PRESERVE
switches[i] = $game_switches[i] unless i == NewGamePlus::NGP_SWITCH
end
return switches
end
#--------------------------------------------------------------------------
# * New Method: Preserve Variables
#--------------------------------------------------------------------------
def preserve_variables
variables = {}
for i in NewGamePlus::VARIABLES_TO_PRESERVE
variables[i] = $game_variables[i]
end
return variables
end
#--------------------------------------------------------------------------
# * New Method: Preserve Actors
#--------------------------------------------------------------------------
def preserve_actors
actors = []
for i in 1..$data_actors.size - 1
actors[i] = $game_actors[i]
end
for i in actors
modify_preserved_actor(i) unless i == nil
end
return actors
end
#--------------------------------------------------------------------------
# * New Method: Modify Preserved Actor
#--------------------------------------------------------------------------
def modify_preserved_actor(actor)
modified_actor = actor
for i in modified_actor.skills
if NewGamePlus::EXCLUDED_SKILLS.include?(i.id)
modified_actor.forget_skill(i.id)
end
end
if NewGamePlus::PRESERVE_INVENTORY
count = 0;
for i in modified_actor.weapons
if NewGamePlus::EXCLUDED_WEAPONS.include?(i.id)
modified_actor.change_equip(count, nil, true)
end
count += 1;
end
for i in modified_actor.armors
if NewGamePlus::EXCLUDED_ARMORS.include?(i.id)
modified_actor.change_equip(count, nil, true)
end
count += 1;
end
else
count = 0;
for i in modified_actor.equips
modified_actor.change_equip(count, $game_actors[actor.id].equips[count], true)
count += 1;
end
end
return modified_actor
end
#--------------------------------------------------------------------------
# * New Method: Preserve Items
#--------------------------------------------------------------------------
def preserve_items
items = {}
for i in $game_party.items
items[i] = $game_party.item_number(i) if i.is_a?(RPG::Item) and !NewGamePlus::EXCLUDED_ITEMS.has_object?(i.id)
end
return items
end
#--------------------------------------------------------------------------
# * New Method: Preserve Weapons
#--------------------------------------------------------------------------
def preserve_weapons
weapons = {}
for i in $game_party.items
weapons[i] = $game_party.item_number(i) if i.is_a?(RPG::Weapon) and !NewGamePlus::EXCLUDED_WEAPONS.include?(i.id)
end
return weapons
end
#--------------------------------------------------------------------------
# * New Method: Preserve Armors
#--------------------------------------------------------------------------
def preserve_armors
armors = {}
for i in $game_party.items
armors[i] = $game_party.item_number(i) if i.is_a?(RPG::Armor) and !NewGamePlus::EXCLUDED_ARMORS.include?(i.id)
end
return armors
end
#--------------------------------------------------------------------------
# * New Method: Recreate Game Objects
#--------------------------------------------------------------------------
def recreate_game_objects
$game_temp = Game_Temp.new
$game_message = Game_Message.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
end
#--------------------------------------------------------------------------
# * New Method: Reset Switches
#--------------------------------------------------------------------------
def reset_switches(switches)
for i in switches.keys.sort
$game_switches[i] = switches[i]
end
end
#--------------------------------------------------------------------------
# * New Method: Reset Variables
#--------------------------------------------------------------------------
def reset_variables(variables)
for i in variables.keys.sort
$game_variables[i] = variables[i]
end
end
#--------------------------------------------------------------------------
# * New Method: Reset Actors
#--------------------------------------------------------------------------
def reset_actors(actors)
for i in 1..$data_actors.size - 1
temp = $game_actors[i]
$game_actors[i] = actors[i]
$game_actors[i].recover_all
end
end
#--------------------------------------------------------------------------
# * New Method: Reset Inventory
#--------------------------------------------------------------------------
def reset_inventory(items)
for i in items.keys
$game_party.gain_item(i, items[i])
end
end
#--------------------------------------------------------------------------
# * Check Player Start Location Existence
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "Player start location not set."
exit
end
end
end
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * New Writer Method for steps
#--------------------------------------------------------------------------
attr_writer :steps
end
class Game_Actors
#--------------------------------------------------------------------------
# * Set Actor
# actor_id : actor's ID
# value : the actor
#--------------------------------------------------------------------------
def []=(actor_id, value)
if actor_id < @data.size
@data[actor_id] = value
end
end
end
And here's the modified Neo Save System script:
#==========================================================================
# ? [VX] ? Neo Save System VI ? ?
#---------------------------------------------------------------------------
# ? Author: Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Last Updated:
# ? Version: III -> VI (By Helladen)
# ? Screenshot image credit Andreas21, and Cybersam
# ? Commerical usage ask Wortana.
#~
# ~Rewritten by Mangomight for compability with New Game Plus
# 2012-12-08
#~~
# * Revisions to Note:
# Several methods has been overwritten for compability with NG+, thus
# can't the two scripts be run without each other.
#~
#---------------------------------------------------------------------------
# ? Log VI:
# - Cleaned up comments and code format.
# - Added corresponding map variables system to MAP_NO_NAME.
# - Added where you can use premade images that use a map's name.
#---------------------------------------------------------------------------
# ? Log V:
# - Screenshot support for those who want tone/weather/sprites.
# - Added an option to stay in save screen after you save the game.
#---------------------------------------------------------------------------
# ? Log IV:
# - New addition for hiding map names. You can control the switch to
# allow MAP_NO_NAME_LIST to work or not.
# - Revised some of the settings and script organization.
# - Added an option to disable the vocab::Gold text right of the number.
# - Added an option to use default opacity or not.
# - Swap tile compatibility support.
#---------------------------------------------------------------------------
# ? Log III:
# - Changed back to draw tile map for save image, don't need any image.
# - For drawing tile map, the characters won't show on the tile map.
#---------------------------------------------------------------------------
# ? Log II:
# - Screenshot DLL is not work with Vista Aero, so I remove it
# and use image for each map instead of screenshot.
# - Actor's level in last version (V.1) is incorrect.
#---------------------------------------------------------------------------
# ? Features:
# - Unlimited save slots, you can choose max save slot
# - Many configuration options
# - Swap tile support
# - You can use image for scene's background
# - Choose your save file's name, and folder to store save files
# - Choose to show only information you want
# - Editable text for information's title
# - Draw tile map for map that player is currently on.
# - Remove text you don't want from map's name (e.g. tags for special script)
# - Choose map that you don't want to show the name on
# - Include save confirmation window before overwrite old save
#===========================================================================
module Wora_NSS Wora_NSS
#==========================================================================
# * START NEO SAVE SYSTEM - SETUP
#--------------------------------------------------------------------------
OPACITY_DEFAULT = true # This will use the default opacity for windows.
# Please note that this will affect both opacitys below.
NSS_WINDOW_OPACITY = 255 # All windows' opacity (Lowest 0 - 255 Highest).
# You can change this to 0 in case you want to use image for background.
NSS_IMAGE_BG = '' # Background image file name, it must be in folder picture
# use '' for no background.
NSS_IMAGE_BG_OPACITY = 255 # Opacity for background image.
# If you use the screenshot method this does not matter.
SWAP_TILE = false # Make this false if you don't use the swap_tile script
SWAP_TILE_SWITCH = 84 # The switch needs to be the same as your swap tile
# switch, but if SWAP_TILE is false it does not matter.
# If this is true it will screenshot the map, if false it will draw it.
SCREENSHOT_IMAGE = false # Drawing the map is good because it doesn't require
# a .DLL or images for the screenshot, and it will have tone and
# weather. If you are using SwapXT and this value is false you need to turn
# on swap tile.
# Do you want to use your own custom images for each map via map name.
PREMADE_IMAGE = false # If this is true it sets its priority over
# screenshots/etc.
# Image type for screenshot '.bmp', or '.jpg', or '.png'.
IMAGE_FILETYPE = '.png'
# If this is true then the scene will not change when you save the game.
SCENE_CHANGE = true # Changes scene to map instead of remaining in Save screen.
MAX_SAVE_SLOT = 10 # Max save slots.
SLOT_NAME = 'File {id}'
# Name of the slot (show in save slots list), use {id} for slot ID.
SAVE_FILE_NAME = 'Save{id}.rvdata'
# Save file name, you can also change its file type from .rvdata to other.
# Use {id} for save slot ID.
SAVE_PATH = '' # Path to store save file, e.g. 'Save/' or '' (for game folder).
SAVED_SLOT_ICON = 140 # Icon Index for saved slot.
EMPTY_SLOT_ICON = 139 # Icon Index for empty slot.
EMPTY_SLOT_TEXT = '' # Text to show for empty slot's data.
DRAW_GOLD = true # Draw Gold.
DRAW_PLAYTIME = true # Draw playtime.
DRAW_LOCATION = true # Draw location.
DRAW_FACE = true # Draw actor's face.
DRAW_LEVEL = true # Draw actor's level.
DRAW_NAME = true # Draw actor's name.
DRAW_TEXT_GOLD = false # Draw the vocab::Gold text to the right of the number.
PLAYTIME_TEXT = 'Time:'
GOLD_TEXT = 'G:'
LOCATION_TEXT = ''
LV_TEXT = 'Lv.'
MAP_NAME_TEXT_SUB = %w{}
# Text that you want to remove from map name,
# e.g. %w{[LN] [DA]} will remove text '[LN]' and '[DA]' from map name.
# Do we want to use corresponding variables for each map number in MAP_NO_NAME_LIST?
MAP_NO_NAME_VARIABLE = false # You just apply the value one to the variable which
# is the map number to change it from MAP_NO_NAME.
MAP_NO_NAME_LIST = [] # ID of Map that will not show map name, e.g. [1,2,3].
MAP_NO_NAME = '???' # What you will use to call the map in the no name list.
# This is a switch that can activate or deactivate maps from being displayed as
# MAP_NO_NAME. If it is off then maps will return back to normal.
MAP_NO_NAME_SWITCH = # This switch has to be on for MAP_NO_NAME_LIST to work.
MAP_BORDER = Color.new(0,0,0,200) # Map image border color (R,G,B,Opacity).
FACE_BORDER = Color.new(0,0,0,200) # Face border color.
# Save confirmation window
SFC_Text_Confirm = 'Save' # Text to confirm to save file.
SFC_Text_Cancel = 'Cancel' # Text to cancel to save.
SFC_Window_Width = 200 # Width of Confirmation Window.
SFC_Window_X_Offset = 0 # Move Confirmation Window horizontally.
SFC_Window_Y_Offset = 0 # Move Confirmation Window vertically.
#-------------------------------------------------------------------------
# END NEO SAVE SYSTEM - SETUP (Edit below at your own risk)
#=========================================================================
#-------------------------------------------------------------
# Screenshot V2 by Andreas21 and Cybersam
#-------------------------------------------------------------
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
def self.shot(file_name)
case IMAGE_FILETYPE
when '.bmp'; typid = 0
when '.jpg'; typid = 1
when '.png'; typid = 2
end
# Get Screenshot
filename = file_name + IMAGE_FILETYPE
@screen.call(0, 0, Graphics.width, Graphics.height, filename, self.handel,
typid)
end
def self.handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end
class Scene_File < Scene_Base
include Wora_NSS
attr_reader :window_slotdetail
#-------------------------------------------------------------------------
# * Start processing
#-------------------------------------------------------------------------
def start
super
create_menu_background
if NSS_IMAGE_BG != ''
@bg = Sprite.new
@bg.bitmap = Cache.picture(NSS_IMAGE_BG)
@bg.opacity = NSS_IMAGE_BG_OPACITY
end
@help_window = Window_Help.new
command = []
(1..MAX_SAVE_SLOT).each do |i|
command << SLOT_NAME.clone.gsub!(/\{ID\}/i) { i.to_s }
end
@window_slotdetail = Window_NSS_SlotDetail.new
@window_slotlist = Window_SlotList.new(160, command)
@window_slotlist.y = @help_window.height
@window_slotlist.height = Graphics.height - @help_window.height
if !OPACITY_DEFAULT
@help_window.opacity = NSS_WINDOW_OPACITY
@window_slotdetail.opacity = @window_slotlist.opacity = NSS_WINDOW_OPACITY
end
# Create folder for save file
if SAVE_PATH != ''
Dir.mkdir(SAVE_PATH) if !FileTest.directory?(SAVE_PATH)
end
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = $game_temp.last_file_index
if @window_slotdetail.game_clear?(@index + 1)
@help_window.set_text(NewGamePlus::VOCAB_NGP_HELP)
else
@help_window.set_text(Vocab::LoadMessage)
end
(1..MAX_SAVE_SLOT).each do |i|
@window_slotlist.draw_item(i-1, false) if !@window_slotdetail.file_exist?(i)
end
end
@window_slotlist.index = @index
# Draw information
@last_slot_index = @window_slotlist.index
@window_slotdetail.draw_data(@last_slot_index + 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
unless @bg.nil?
@bg.bitmap.dispose
@bg.dispose
end
@window_slotlist.dispose
@window_slotdetail.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if !@confirm_window.nil?
@confirm_window.update
if Input.trigger?(Input::C)
if @confirm_window.index == 0
determine_savefile
@confirm_window.dispose
@confirm_window = nil
else
Sound.play_cancel
@confirm_window.dispose
@confirm_window = nil
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
@confirm_window.dispose
@confirm_window = nil
end
else
update_menu_background
@window_slotlist.update
if @window_slotlist.index != @last_slot_index
@last_slot_index = @window_slotlist.index
@window_slotdetail.draw_data(@last_slot_index + 1)
end
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
elsif @window_slotdetail.game_clear?(@last_slot_index + 1)
@help_window.set_text(NewGamePlus::VOCAB_NGP_HELP)
else
@help_window.set_text(Vocab::LoadMessage)
end
@help_window.update
update_savefile_selection
end
end
#--------------------------------------------------------------------------
# * Update Save File Selection
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
if @saving and @window_slotdetail.file_exist?(@last_slot_index + 1)
Sound.play_decision
text1 = SFC_Text_Confirm
text2 = SFC_Text_Cancel
@confirm_window = Window_Command.new(SFC_Window_Width,[text1,text2])
@confirm_window.x = ((544 - @confirm_window.width) / 2) + SFC_Window_X_Offset
@confirm_window.y = ((416 - @confirm_window.height) / 2) + SFC_Window_Y_Offset
else
determine_savefile
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
end
#--------------------------------------------------------------------------
# * Execute Save
#--------------------------------------------------------------------------
def do_save
if SCREENSHOT_IMAGE
File.rename(SAVE_PATH + 'temp' + IMAGE_FILETYPE,
make_filename(@last_slot_index).gsub(/\..*$/){ '_ss' } + IMAGE_FILETYPE)
end
file = File.open(make_filename(@last_slot_index), "wb")
write_save_data(file)
file.close
# Alter the scene after the saving is done
if SCENE_CHANGE
$scene = Scene_Map.new
else
$scene = Scene_File.new(true, false, false)
end
end
#--------------------------------------------------------------------------
# * Execute Load
#--------------------------------------------------------------------------
def do_load
file = File.open(make_filename(@last_slot_index), "rb")
read_save_data(file)
file.close
if $game_switches[NewGamePlus::NGP_SWITCH]
new_game_plus
else
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
end
#--------------------------------------------------------------------------
# * Confirm Save File
#--------------------------------------------------------------------------
def determine_savefile
if @saving
Sound.play_save
do_save
else
if @window_slotdetail.file_exist?(@last_slot_index + 1)
Sound.play_load
do_load
else
Sound.play_buzzer
return
end
end
$game_temp.last_file_index = @last_slot_index
end
#--------------------------------------------------------------------------
# * Create Filename
# file_index : save file index (0-3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index + 1).to_s }
end
#--------------------------------------------------------------------------
# * Select File With Newest Timestamp
#--------------------------------------------------------------------------
def latest_file_index
latest_index = 0
latest_time = Time.at(0)
(1..MAX_SAVE_SLOT).each do |i|
file_name = make_filename(i - 1)
next if !@window_slotdetail.file_exist?(i)
file_time = File.mtime(file_name)
if file_time > latest_time
latest_time = file_time
latest_index = i - 1
end
end
return latest_index
end
end
class Window_SlotList < Window_Command
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
icon_index = 0
self.contents.clear_rect(rect)
if $scene.window_slotdetail.file_exist?(index + 1)
icon_index = Wora_NSS::SAVED_SLOT_ICON
else
icon_index = Wora_NSS::EMPTY_SLOT_ICON
end
if !icon_index.nil?
rect.x -= 4
draw_icon(icon_index, rect.x, rect.y, enabled) # Draw Icon
rect.x += 26
rect.width -= 20
end
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index])
end
def cursor_down(wrap = false)
if @index < @item_max - 1 or wrap
@index = (@index + 1) % @item_max
end
end
def cursor_up(wrap = false)
if @index > 0 or wrap
@index = (@index - 1 + @item_max) % @item_max
end
end
end
class Window_NSS_SlotDetail < Window_Base
include Wora_NSS
def initialize
super(160, 56, 384, 360)
@data = []
@exist_list = []
@bitmap_list = {}
@map_name = []
end
def game_clear?(slot_id = 0)
if @exist_list[slot_id]
return false unless @data[slot_id]
return @data[slot_id]['gameswi'][NewGamePlus::NGP_SWITCH]
end
return false
end
def dispose
dispose_tilemap
super
end
def draw_data(slot_id)
contents.clear # 352, 328
dispose_tilemap
load_save_data(slot_id) if @data[slot_id].nil?
if @exist_list[slot_id]
save_data = @data[slot_id]
contents.fill_rect(0,30,352,152, MAP_BORDER)
if game_clear?(slot_id)
gw1 = contents.text_size(save_data['gamepar'].gold).width
gw2 = contents.text_size(GOLD_TEXT).width
xd = DRAW_GOLD ? gw1 + gw2 + 32 : 0
wdth = contents.width - 4
contents.font.color = text_color(NewGamePlus::CLEAR_GAME_COLOR)
contents.draw_text(xd, 0, wdth, WLH, NewGamePlus::VOCAB_CLEAR_GAME)
end
if PREMADE_IMAGE
bitmap = get_bitmap("Graphics/Save/" + @data[slot_id]['map_name'] + IMAGE_FILETYPE)
rect = Rect.new((Graphics.width-348)/2,(Graphics.height-156)/2,348,156)
contents.blt(2,32,bitmap,rect)
elsif SCREENSHOT_IMAGE and save_data['ss']
bitmap = get_bitmap(save_data['ss_path'])
rect = Rect.new((Graphics.width-348)/2,(Graphics.height-156)/2,348,156)
contents.blt(2,32,bitmap,rect)
elsif SWAP_TILE and $game_switches[SWAP_TILE_SWITCH]
create_swaptilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,
save_data['gamemap'].display_y)
else
create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,
save_data['gamemap'].display_y)
end
if DRAW_GOLD
gold_textsize = contents.text_size(save_data['gamepar'].gold).width
goldt_textsize = contents.text_size(GOLD_TEXT).width
contents.font.color = system_color
contents.draw_text(0, 0, goldt_textsize, WLH, GOLD_TEXT)
contents.font.color = normal_color
contents.draw_text(goldt_textsize, 0, gold_textsize, WLH, save_data['gamepar'].gold)
if DRAW_TEXT_GOLD
contents.draw_text(goldt_textsize + gold_textsize, 0, 200, WLH, Vocab::gold)
else
gold_textsize = 0
goldt_textsize = 0
end
end
if DRAW_PLAYTIME
hour = save_data['total_sec'] / 60 / 60
min = save_data['total_sec'] / 60 % 60
sec = save_data['total_sec'] % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
pt_textsize = contents.text_size(PLAYTIME_TEXT).width
ts_textsize = contents.text_size(time_string).width
contents.font.color = system_color
contents.draw_text(contents.width - ts_textsize - pt_textsize, 0,
pt_textsize, WLH, PLAYTIME_TEXT)
contents.draw_text(goldt_textsize + gold_textsize,0,200,WLH, Vocab::gold)
contents.font.color = normal_color
contents.draw_text(0, 0, contents.width, WLH, time_string, 2)
end
if DRAW_LOCATION
lc_textsize = contents.text_size(LOCATION_TEXT).width
mn_textsize = contents.text_size(save_data['map_name']).width
contents.font.color = system_color
contents.draw_text(0, 190, contents.width, WLH, LOCATION_TEXT)
contents.font.color = normal_color
contents.draw_text(lc_textsize, 190, contents.width, WLH, save_data['map_name'])
end
# Draw level & name
save_data['gamepar'].members.each_index do |i|
actor = save_data['gameactor'][save_data['gamepar'].members[i].id]
face_x_base = (i*80) + (i*8)
face_y_base = 216
lvn_y_plus = 10
lv_textsize = contents.text_size(actor.level).width
lvt_textsize = contents.text_size(LV_TEXT).width
if DRAW_FACE
contents.fill_rect(face_x_base, face_y_base, 84, 84, FACE_BORDER)
draw_face(actor.face_name, actor.face_index, face_x_base + 2,
face_y_base + 2, 80)
end
if DRAW_LEVEL
contents.font.color = system_color
contents.draw_text(face_x_base + 2 + 80 - lv_textsize - lvt_textsize,
face_y_base + 2 + 80 - WLH + lvn_y_plus, lvt_textsize, WLH, LV_TEXT)
contents.font.color = normal_color
contents.draw_text(face_x_base + 2 + 80 - lv_textsize,
face_y_base + 2 + 80 - WLH + lvn_y_plus, lv_textsize, WLH, actor.level)
end
if DRAW_NAME
contents.draw_text(face_x_base, face_y_base + 2 + 80 + lvn_y_plus - 6, 84,
WLH, actor.name, 1)
end
end
else
contents.draw_text(0,0, contents.width, contents.height - WLH, EMPTY_SLOT_TEXT, 1)
end
end
def load_save_data(slot_id)
file_name = make_filename(slot_id)
if file_exist?(slot_id) or FileTest.exist?(file_name)
@exist_list[slot_id] = true
@data[slot_id] = {}
# Start load data
file = File.open(file_name, "r")
@data[slot_id]['time'] = file.mtime
@data[slot_id]['char'] = Marshal.load(file)
@data[slot_id]['frame'] = Marshal.load(file)
@data[slot_id]['last_bgm'] = Marshal.load(file)
@data[slot_id]['last_bgs'] = Marshal.load(file)
@data[slot_id]['gamesys'] = Marshal.load(file)
@data[slot_id]['gamemes'] = Marshal.load(file)
@data[slot_id]['gameswi'] = Marshal.load(file)
@data[slot_id]['gamevar'] = Marshal.load(file)
@data[slot_id]['gameselfvar'] = Marshal.load(file)
@data[slot_id]['gameactor'] = Marshal.load(file)
@data[slot_id]['gamepar'] = Marshal.load(file)
@data[slot_id]['gametro'] = Marshal.load(file)
@data[slot_id]['gamemap'] = Marshal.load(file)
@data[slot_id]['total_sec'] = @data[slot_id]['frame'] / Graphics.frame_rate
# Save the image
if SCREENSHOT_IMAGE
@data[slot_id]['ss_path'] = file_name.gsub(/\..*$/){'_ss'} + IMAGE_FILETYPE
@data[slot_id]['ss'] = FileTest.exist?(@data[slot_id]['ss_path'])
end
@data[slot_id]['map_name'] = get_mapname(@data[slot_id]['gamemap'].map_id)
file.close
else
@exist_list[slot_id] = false
@data[slot_id] = -1
end
end
def make_filename(file_index)
return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index).to_s }
end
def file_exist?(slot_id)
return @exist_list[slot_id] if !@exist_list[slot_id].nil?
@exist_list[slot_id] = FileTest.exist?(make_filename(slot_id))
return @exist_list[slot_id]
end
def get_bitmap(path)
if !@bitmap_list.include?(path)
@bitmap_list[path] = Bitmap.new(path)
end
return @bitmap_list[path]
end
def get_mapname(map_id)
if @map_data.nil?
@map_data = load_data("Data/MapInfos.rvdata")
end
if @map_name[map_id].nil?
if MAP_NO_NAME_LIST.include?(map_id) and $game_switches[MAP_NO_NAME_SWITCH]
if $game_variables[map_id] == 0 or !MAP_NO_NAME_VARIABLE
@map_name[map_id] = MAP_NO_NAME
else
@map_name[map_id] = @map_data[map_id].name
end
else
@map_name[map_id] = @map_data[map_id].name
end
MAP_NAME_TEXT_SUB.each_index do |i|
@map_name[map_id].sub!(MAP_NAME_TEXT_SUB[i], '')
@mapname = @map_name[map_id]
end
end
return @map_name[map_id]
end
def create_tilemap(map_data, ox, oy)
@viewport = Viewport.new(self.x + 2 + 16, self.y + 32 + 16, 348,156)
@viewport.z = self.z
@tilemap = Tilemap.new(@viewport)
@tilemap.bitmaps[0] = Cache.system("TileA1")
@tilemap.bitmaps[1] = Cache.system("TileA2")
@tilemap.bitmaps[2] = Cache.system("TileA3")
@tilemap.bitmaps[3] = Cache.system("TileA4")
@tilemap.bitmaps[4] = Cache.system("TileA5")
@tilemap.bitmaps[5] = Cache.system("TileB")
@tilemap.bitmaps[6] = Cache.system("TileC")
@tilemap.bitmaps[7] = Cache.system("TileD")
@tilemap.bitmaps[8] = Cache.system("TileE")
@tilemap.map_data = map_data
@tilemap.ox = ox / 8 + 99
@tilemap.oy = oy / 8 + 90
end
def create_swaptilemap(map_data, ox, oy)
@viewport = Viewport.new(self.x + 2 + 16, self.y + 32 + 16, 348,156)
@viewport.z = self.z
@tilemap = Tilemap.new(@viewport)
tile1 = Cache_Swap_Tiles.swap($tileA1 + ".png") rescue nil
tile2 = Cache_Swap_Tiles.swap($tileA2 + ".png") rescue nil
tile3 = Cache_Swap_Tiles.swap($tileA3 + ".png") rescue nil
tile4 = Cache_Swap_Tiles.swap($tileA4 + ".png") rescue nil
tile5 = Cache_Swap_Tiles.swap($tileA5 + ".png") rescue nil
tile6 = Cache_Swap_Tiles.swap($tileB + ".png") rescue nil
tile7 = Cache_Swap_Tiles.swap($tileC + ".png") rescue nil
tile8 = Cache_Swap_Tiles.swap($tileD + ".png") rescue nil
tile9 = Cache_Swap_Tiles.swap($tileE + ".png") rescue nil
if $tileA1 != nil
@tilemap.bitmaps[0] = tile1
else
@tilemap.bitmaps[0] = Cache.system("TileA1")
end
if $tileA2 != nil
@tilemap.bitmaps[1] = tile2
else
@tilemap.bitmaps[1] = Cache.system("TileA2")
end
if $tileA3 != nil
@tilemap.bitmaps[2] = tile3
else
@tilemap.bitmaps[2] = Cache.system("TileA3")
end
if $tileA4 != nil
@tilemap.bitmaps[3] = tile4
else
@tilemap.bitmaps[3] = Cache.system("TileA4")
end
if $tileA5 != nil
@tilemap.bitmaps[4] = tile5
else
@tilemap.bitmaps[4] = Cache.system("TileA5")
end
if $tileB != nil
@tilemap.bitmaps[5] = tile6
else
@tilemap.bitmaps[5] = Cache.system("TileB")
end
if $tileC != nil
@tilemap.bitmaps[6] = tile7
else
@tilemap.bitmaps[6] = Cache.system("TileC")
end
if $tileD != nil
@tilemap.bitmaps[7] = tile8
else
@tilemap.bitmaps[7] = Cache.system("TileD")
end
if $tileE != nil
@tilemap.bitmaps[8] = tile9
else
@tilemap.bitmaps[8] = Cache.system("TileE")
end
@tilemap.map_data = map_data
@tilemap.ox = ox / 8 + 99
@tilemap.oy = oy / 8 + 90
end
def dispose_tilemap
unless @tilemap.nil?
@tilemap.dispose
@tilemap = nil
end
end
end
class Scene_Title < Scene_Base
def check_continue
file_name = Wora_NSS::SAVE_PATH + Wora_NSS::SAVE_FILE_NAME.gsub(/\{ID\}/i) { '*' }
@continue_enabled = (Dir.glob(file_name).size > 0)
end
end
class Scene_Map < Scene_Base
alias wora_nss_scemap_ter terminate
def terminate
Wora_NSS.shot(Wora_NSS::SAVE_PATH + 'temp')
wora_nss_scemap_ter
end
end
#======================================================================
# END - NEO SAVE SYSTEM by Woratana and Helladen
#======================================================================