Jako iż dawno mnie nie było chciałbym dodać coś nowego na forum a mianowicie skrypt na Auto Save ( Automatyczne zapisywanie gry ). Przetłumaczyłem go trochę i może wam się spodoba :).
AUTO SAVE
KOMPATYBILNOŚĆ
Raczej Vx, oraz kłóci się ze skryptami typu : Neo Save lecz zamieszczam ten skrypt razem połączony z Neo Save 3.0 Woratany ( jest na samym dole )
AUTOR :
BulleXt
OPIS
Skrypt umożliwia Auto Save czyli automatyczne zapisywanie w konkretnej akcji lub miejscach :
Podczas przechodzenia z mapy do mapy (Teleport), końca walki oraz wychodzenia z menu.
Plusem tego jest, że można ustawić samemu kiedy zrobi nam Save'a
SKRYPT :
Spoiler:
Kod:
=begin
AutoSave VX
Author: BulleXt(bulletxt@gmail.com)
Version: 0.1
Date: 06/07/2009
Przetłumaczone przez Ishizaki1
Opis:
Ten skrypt domyślnie automatycznie zapisze kiedy wykonujesz teleport z mapy do mapy,
po wygranej bitwie i po wyjściu z menu.
(Można również ręcznie ustawić autosave wewnątrz przypadku po prostu robi
Skrypt rozmowy tak?):
Auto_Save.new
Skrypt nie wyłącza normalnego systemu zapisywania więc gracz może zapisać na swoim slocie, lecz nie zastąpi źródła Auto Save'a
The script also lets you set how many saving slots you want.
=end
#Numer slot'a do Auto Save'u
SAVE_NUMBER = 1
#To jest liczba która ustawia ile będziesz miał slotów
NUMBER_OF_SAVE_SLOTS = 10
#ID przełącznika który od-uaktywni AutoSave'a od teleportu z mapy do mapy
SAVE_ON_MAP_TRANSFER = 1
#To samo co wyżej tyle, że po walce
SAVE_AFTER_WINNING_BATTLE = 2
#@Up tyle, że po wyjściu z Menu
SAVE_AFTER_CLOSING_MENU = 3
############################### Koniec Configu##############################
class Auto_Save < Scene_File
def initialize
do_save
end
end
class Scene_File < Scene_Base
alias auto_save_bulletxt_initialize initialize
def initialize(saving, from_title, from_event)
auto_save_bulletxt_initialize(saving, from_title, from_event)
@saving_inside_menu = false
end
def start
super
@file_max = NUMBER_OF_SAVE_SLOTS
create_menu_background
@help_window = Window_Help.new
create_savefile_windows
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@savefile_windows[@index].selected = true
@page_file_max = ((416 - @help_window.height) / 90).truncate
for i in 0...@file_max
window = @savefile_windows[i]
if @index > @page_file_max - 1
if @index < @file_max - @page_file_max - 1
@top_row = @index
window.y -= @index * window.height
elsif @index >= @file_max - @page_file_max
@top_row = @file_max - @page_file_max
window.y -= (@file_max - @page_file_max) * window.height
else
@top_row = @index
window.y -= @index * window.height
end
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
end
#create window slots
def create_savefile_windows
@top_row = 0
@savefile_windows = []
for i in 0..(NUMBER_OF_SAVE_SLOTS - 1)
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
@item_max = NUMBER_OF_SAVE_SLOTS
end
#handle going down
def cursor_down(wrap)
@file_max = NUMBER_OF_SAVE_SLOTS
if @index < @file_max - 1 or wrap
@index = (@index + 1) % @file_max
for i in 0...@file_max
window = @savefile_windows[i]
if @index == 0
@top_row = 0
window.y = @help_window.height + i % @file_max * window.height
elsif @index - @top_row > @page_file_max - 1
window.y -= window.height
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
if @index - @top_row > @page_file_max - 1
@top_row += 1
end
end
end
#handle going up
def cursor_up(wrap)
@file_max = NUMBER_OF_SAVE_SLOTS
if @index > 0 or wrap
@index = (@index - 1 + @file_max) % @file_max
for i in 0...@file_max
window = @savefile_windows[i]
if @index == @file_max - 1
@top_row = @file_max - @page_file_max
window.y = @help_window.height + i % @file_max * window.height
window.y -= (@file_max - @page_file_max) * window.height
elsif @index - @top_row < 0
window.y += window.height
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
if @index - @top_row < 0
@top_row -= 1
end
end
end
alias auto_save_bulletxt_determine_savefile determine_savefile
def determine_savefile
#if true, player has selected autosave slot so he must not save
if @savefile_windows[@index].filename == SAVING_FILE
saving_not_allowed if @saving
return if @saving
end
#if here player can save
@saving_inside_menu = true if @saving
auto_save_bulletxt_determine_savefile
end
#window warning player can't save on auto save slot
def saving_not_allowed
Sound.play_buzzer
b = Bitmap.new(340,60)
b.draw_text(0, 20,340, 20, "You can't save on the Auto Save slot.")
w = Window_Message.new
w.contents = b
w.width = 380
w.height = 100
w.visible = true
w.openness = 255
w.x = 100
w.y = 180
w.back_opacity = 255
w.opacity = 255
w.update
Graphics.wait(180)
b.dispose
w.dispose
w = nil
b = nil
end
def do_save
#if true, player is saving from inside menu
if @saving_inside_menu
file = File.open(@savefile_windows[@index].filename, "wb")
else
#if here player has done a manual Auto_Save.new call from event
file = File.open(SAVING_FILE, "wb")
end
write_save_data(file)
file.close
return_scene if @saving_inside_menu
#$scene = Scene_Map.new if @saving_inside_menu == false
@saving_inside_menu = false
end
end
class Scene_Battle < Scene_Base
#save after winning a battle
alias auto_save_bulletxt_process_victory process_victory
def process_victory
auto_save_bulletxt_process_victory
Auto_Save.new if $BTEST == false && $game_switches[SAVE_AFTER_WINNING_BATTLE] == false
end
end
class Scene_Map < Scene_Base
#save on map transfer
alias auto_save_bulletxt_update_transfer_player update_transfer_player
def update_transfer_player
return unless $game_player.transfer?
auto_save_bulletxt_update_transfer_player
Auto_Save.new if $game_switches[SAVE_ON_MAP_TRANSFER] == false
end
end
class Scene_Menu < Scene_Base
#save when exiting menu
alias auto_save_bulletxt_update_command_selection update_command_selection
def update_command_selection
if Input.trigger?(Input::B)
Auto_Save.new if $game_switches[SAVE_AFTER_CLOSING_MENU] == false
end
auto_save_bulletxt_update_command_selection
end
end
Description:
This script by default will automatically save when you do a map transfer,
after winning a battle and after exiting menu.
You can also manually call an autosave inside an event by simply doing a
call script like this:
Auto_Save.new
The script doesn't disable normal saving system so player can still save on his
slots, he will not be able to overwrite the autosave slot.
The script also lets you set how many saving slots you want.
=end
#This is the autosave slot number
SAVE_NUMBER = 1
#This is an ID switch, if ON it disables the autosave on map transfer
SAVE_ON_MAP_TRANSFER = 1
#This is an ID switch, if ON it disables the autosave after winning a battle
SAVE_AFTER_WINNING_BATTLE = 2
#This is an ID switch, if ON it disables the autosave after closing Menu
SAVE_AFTER_CLOSING_MENU = 3
#===============================================================
# ? [VX] ? Neo Save System III ? ?
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 15/02/2009
# ? Version: 3.0
#--------------------------------------------------------------
# ? Log III:
# - Change back to draw tilemap as screenshot. Don't need any image.
# - For drawing tilemap, the characters won't show on the tilemap.
#--------------------------------------------------------------
# ? Log II:
# - Screenshot DLL is not work with Vista Aero, so I remove it
# and use image for each map instead of screenshot.
# - Actor's level in last version (V.1) is incorrect.
#--------------------------------------------------------------
# ? Features:
# - Unlimited save slots, you can choose max save slot
# - You can use image for scene's background
# - Choose your save file's name, and folder to store save files
# - Choose to show only information you want
# - Editable text for information's title
# - Draw tilemap for map that player is currently in.
# - Remove text you don't want from map's name (e.g. tags for special script)
# - Choose map that you don't want to show its name
# - Include save confirmation window before overwrite old save
#=================================================================
module Wora_NSS
#==========================================================================
# * START NEO SAVE SYSTEM - SETUP
#--------------------------------------------------------------------------
NSS_WINDOW_OPACITY = 255 # All windows' opacity (Lowest 0 - 255 Highest)
# You can change this to 0 in case you want to use image for background
NSS_IMAGE_BG = '' # Background image file name, it must be in folder Picture.
# use '' for no background
NSS_IMAGE_BG_OPACITY = 255 # Opacity for background image
MAX_SAVE_SLOT = 20 # Max save slots no.
SLOT_NAME = 'SLOT {id}'
# Name of the slot (show in save slots list), use {id} for slot ID
SAVE_FILE_NAME = 'Saveslot{id}.rvdata'
# Save file name, you can also change its file type from .rvdata to other
# use {id} for save slot ID
SAVE_PATH = '' # Path to store save file, e.g. 'Save/' or '' (for game folder)
SAVED_SLOT_ICON = 133 # Icon Index for saved slot
EMPTY_SLOT_ICON = 141 # Icon Index for empty slot
EMPTY_SLOT_TEXT = '-NO DATA-' # Text to show for empty slot's data
MAP_NAME_TEXT_SUB = %w{}
# Text that you want to remove from map name,
# e.g. %w{[LN] [DA]} will remove text '[LN]' and '[DA]' from map name
MAP_NO_NAME_LIST = [] # ID of Map that will not show map name, e.g. [1,2,3]
MAP_NO_NAME_NAME = '??????????' # What you will use to call map in no name list
MAP_BORDER = Color.new(0,0,0,200) # Map image border color (R,G,B,Opacity)
FACE_BORDER = Color.new(0,0,0,200) # Face border color
## SAVE CONFIRMATION WINDOW ##
SFC_Text_Confirm = 'Confirm to 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
#=========================================================================
end
class Auto_Save < Scene_File
def initialize
do_save
end
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 = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
(1..MAX_SAVE_SLOT).each do |i|
@window_slotlist.draw_item(i-1, false) if !@window_slotdetail.file_exist?(i)
end
end
@window_slotlist.index = @index
# Draw Information
@last_slot_index = @window_slotlist.index
@window_slotdetail.draw_data(@last_slot_index + 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
unless @bg.nil?
@bg.bitmap.dispose
@bg.dispose
end
@window_slotlist.dispose
@window_slotdetail.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if !@confirm_window.nil?
@confirm_window.update
if Input.trigger?(Input::C)
if @confirm_window.index == 0
determine_savefile
@confirm_window.dispose
@confirm_window = nil
else
Sound.play_cancel
@confirm_window.dispose
@confirm_window = nil
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
@confirm_window.dispose
@confirm_window = nil
end
else
update_menu_background
@window_slotlist.update
if @window_slotlist.index != @last_slot_index
@last_slot_index = @window_slotlist.index
@window_slotdetail.draw_data(@last_slot_index + 1)
end
@help_window.update
update_savefile_selection
end
end
#--------------------------------------------------------------------------
# * Update Save File Selection
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
if @saving and @window_slotdetail.file_exist?(@last_slot_index + 1)
Sound.play_decision
text1 = SFC_Text_Confirm
text2 = SFC_Text_Cancel
@confirm_window = Window_Command.new(SFC_Window_Width,[text1,text2])
@confirm_window.x = ((544 - @confirm_window.width) / 2) + SFC_Window_X_Offset
@confirm_window.y = ((416 - @confirm_window.height) / 2) + SFC_Window_Y_Offset
else
determine_savefile
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
end
#--------------------------------------------------------------------------
# * Execute Save
#--------------------------------------------------------------------------
def do_save
#if true, player is saving from inside menu
if @saving
file = File.open(make_filename(@last_slot_index), "wb")
else
#if here player has done a manual Auto_Save.new call from event
s = SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { SAVE_NUMBER.to_s }
file = File.open( s , "wb")
end
write_save_data(file)
file.close
$scene = Scene_Map.new if @saving
end
#--------------------------------------------------------------------------
# * Execute Load
#--------------------------------------------------------------------------
def do_load
file = File.open(make_filename(@last_slot_index), "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
#--------------------------------------------------------------------------
# * Confirm Save File
#--------------------------------------------------------------------------
def determine_savefile
if @last_slot_index + 1 == SAVE_NUMBER
saving_not_allowed if @saving
return if @saving
end
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
#window warning player can't save on auto save slot
def saving_not_allowed
Sound.play_buzzer
b = Bitmap.new(340,60)
b.draw_text(0, 20,340, 20, "You can't save on the Auto Save slot.")
w = Window_Message.new
w.contents = b
w.width = 380
w.height = 100
w.visible = true
w.openness = 255
w.x = 100
w.y = 180
w.back_opacity = 255
w.opacity = 255
w.update
Graphics.wait(180)
b.dispose
w.dispose
w = nil
b = nil
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]) if index + 1 != SAVE_NUMBER
self.contents.draw_text(rect, "Auto Save") if index + 1 == SAVE_NUMBER
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 make_filename(file_index)
return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index).to_s }
end
def file_exist?(slot_id)
return @exist_list[slot_id] if !@exist_list[slot_id].nil?
@exist_list[slot_id] = FileTest.exist?(make_filename(slot_id))
return @exist_list[slot_id]
end
def get_mapname(map_id)
if @map_data.nil?
@map_data = load_data("Data/MapInfos.rvdata")
end
if @map_name[map_id].nil?
if MAP_NO_NAME_LIST.include?(map_id)
@map_name[map_id] = MAP_NO_NAME_NAME
else
@map_name[map_id] = @map_data[map_id].name
MAP_NAME_TEXT_SUB.each_index do |i|
@map_name[map_id].sub!(MAP_NAME_TEXT_SUB[i], '')
end
end
end
return @map_name[map_id]
end
def 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_Menu < Scene_Base
#save when exiting menu
alias auto_save_bulletxt_update_command_selection update_command_selection
def update_command_selection
if Input.trigger?(Input::B)
Auto_Save.new if $game_switches[SAVE_AFTER_CLOSING_MENU] == false
end
auto_save_bulletxt_update_command_selection
end
end
class Scene_Battle < Scene_Base
#save after winning a battle
alias auto_save_bulletxt_process_victory process_victory
def process_victory
auto_save_bulletxt_process_victory
Auto_Save.new if $BTEST == false && $game_switches[SAVE_AFTER_WINNING_BATTLE] == false
end
end
class Scene_Map < Scene_Base
#save on map transfer
alias auto_save_bulletxt_update_transfer_player update_transfer_player
def update_transfer_player
return unless $game_player.transfer?
auto_save_bulletxt_update_transfer_player
Auto_Save.new if $game_switches[SAVE_ON_MAP_TRANSFER] == false
end
end
#======================================================================
# END - NEO SAVE SYSTEM by Woratana
#======================================================================
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum