Hi, i've got this script (hope its correct for saving instantly)
Now i've got a nice menu wich works with events.
I want to call this posted code with the menu, can anybody help me to save instantly with "events"?
Code:
def save
for i in 0..10
sleep(0.1)
end
Audio.se_play(QUEST_SAVE[0], QUEST_SAVE[1], QUEST_SAVE[2])
$game_system.newgame_switch = false
file = File.open($game_system.save_slot, "wb")
write_save_data(file)
file.close
@saved = Sprite.new
@saved.bitmap = RPG::Cache.picture("saved")
@saved.x = (640/2) - (@saved.bitmap.width / 2)
@saved.y = (480/2) - (@saved.bitmap.height / 2)
return
end
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(Time.new, file)
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_party, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
Now i've got a nice menu wich works with events.
I want to call this posted code with the menu, can anybody help me to save instantly with "events"?