Hey, ich habe grade diesen Script von mir auf der Festplatte gefunden. Durch Drücken der Taste 2 wird eine Savedatei erstellt, die man durch Drücken auf Taste 1 laden kann. Das Script hat keine bekannten Bugs, aber man benötigt dazu ein Inputscript:
class << Input
unless self.method_defined? (:oz_key_press)
alias oz_key_press press?
alias oz_key_trigger trigger?
alias oz_key_repeat repeat?
alias og_key_update update
end
end
module Input
Numbers = []
Numbers[0] = 48
Numbers[1] = 49
Numbers[2] = 50
State = Win32API.new("user32", "GetAsyncKeyState", ["i"], "i")
PressDuration = {} # A hash for pressed keys and their durations
def update
og_key_update
for key in PressDuration.keys
(State.call(key).abs & 0x8000 == 0x8000) ? PressDuration[key] +=
1 : PressDuration.delete(key)
end
end
def key_pressed?(key)
if (State.call(key).abs & 0x8000 == 0x8000)
PressDuration[key] = 0
return true
else
return false
end
end
def comp_fix(numkey)
numkey -= 130 if numkey.between?(130, 158)
return numkey
end
def press?(numkey)
return oz_key_press(numkey) if numkey < 30
realkey = comp_fix(numkey)
return true unless PressDuration[realkey].nil?
return key_pressed?(realkey)
end
def trigger?(numkey)
return oz_key_trigger(numkey) if numkey < 30
realkey = comp_fix(numkey)
count = PressDuration[realkey]
return ((count == 0) or (count.nil? ? key_pressed?(realkey) : false))
end
def repeat?(numkey)
return oz_key_repeat(numkey) if numkey < 30
realkey = comp_fix(numkey)
count = PressDuration[realkey]
return true if count == 0
return (count.nil? ? key_pressed?(realkey) : (count >= 23 and
(count - 23) % 6 == 0))
end
end
Und hier das Savestate-Script:
Meldung = "Ja"
class Scene_Map < Scene_Base
def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
unless $game_message.visible
update_transfer_player
update_encounter
update_call_menu
update_call_savestate
update_call_debug
update_scene_change
end
end
def update_call_savestate
if Input.press?(49)
return if $game_map.interpreter.running?
if File.exist?("Savestate")
file = File.open("Savestate", "rb")
call_savestate(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(10)
#Graphics.wait(40)
@last_bgm.play
@last_bgs.play
elsif Meldung == "Ja"
print("Savestate existiert nicht.")
else
end
return
elsif Input.press?(50)
return if $game_map.interpreter.running?
file = File.open("Savestate", "wb")
call_savestate_s(file)
file.close
return
end
end
def update_scene_change
return if $game_player.moving?
case $game_temp.next_scene
when "battle"
call_battle
when "shop"
call_shop
when "name"
call_name
when "menu"
call_menu
when "save"
call_save
when "debug"
call_debug
when "gameover"
call_gameover
when "title"
call_title
when "savestate"
call_load
when "savestate_s"
call_save
else
$game_temp.next_scene = nil
end
end
def call_load
file = File.open("Savestate", "rb")
call_savestate(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
def call_savestate(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = 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)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
def call_save
file = File.open("Savestate", "wb")
call_savestate_s(file)
file.close
return
end
def call_savestate_s(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
Ach ja, wenn keine Meldung erscheinen soll (beim Laden einer nicht vorhandenen Save) müsst ihr ganz oben
Meldung = ""
schreiben.
Hoffe es gefällt euch.
Edit: Ich habe noch ein kleines Script, welches euch erlaubt die normalen Saves in einen Ordner zu packen.
Ordnername = "Savedateien" #Bitte ohne / Ordner muss vorhanden sein!
Name = "/Datei"#Bitte mit /
class Scene_File < Scene_Base
def make_filename(file_index)
if Ordnername == ""
return "#{Name}#{file_index + 1}.rvdata"
else
return "#{Ordnername}#{Name}#{file_index + 1}.rvdata"
end
end
end
class Scene_Title < Scene_Base
def check_continue
if Ordnername == ""
@continue_enabled = (Dir.glob("#{Name}*.rvdata").size > 0)
else
@continue_enabled = (Dir.glob("#{Ordnername}#{Name}*.rvdata").size > 0)
end
end
end
Wenn ihr keinen Ordner wollt, sondern nur umbenannte Savefiles, schreibt einfach "".