Khristal Posted January 18, 2008 Share Posted January 18, 2008 (edited) DescrizioneQuesto semplicissimo script serve a creare una schermata prima del salvataggio che ti chiede se vuoi realmente salvare la partita.Come nella maggior parte dei GDR, e mi è sembrato meglio che scriverlo in un messaggio.Non so se potrà mai tornare utile a qualcuno comunque io lo posto lo stesso. AutoreKhristal AllegatiScene___Save_Menu___by_Khristal.txt Istruzioni per l'usoPer richiamare lo script fare un callscript con scritto : $scene = Scene_Save_Menu.new Script #============================================================================== # - Save Menu - Creato da Khristal - Rpg2s - #------------------------------------------------------------------------------ # Versione 1.0 #============================================================================== #============================================================================== # ** Scene_Save #------------------------------------------------------------------------------ # This class performs save screen processing. #============================================================================== class Scene_Save < Scene_File #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super("Which file would you like to save to?") end #-------------------------------------------------------------------------- # * Decision Processing #-------------------------------------------------------------------------- def on_decision(filename) # Play save SE $game_system.se_play($data_system.save_se) # Write save data file = File.open(filename, "wb") write_save_data(file) file.close # If called from event if $game_temp.save_calling # Clear save call flag $game_temp.save_calling = false # Switch to map screen $scene = Scene_Map.new return end # Switch to menu screen $scene = Scene_Save_Menu.new end #-------------------------------------------------------------------------- # * Cancel Processing #-------------------------------------------------------------------------- def on_cancel # Play cancel SE $game_system.se_play($data_system.cancel_se) # If called from event if $game_temp.save_calling # Clear save call flag $game_temp.save_calling = false # Switch to map screen $scene = Scene_Save_Menu.new return end # Switch to menu screen $scene = Scene_Save_Menu.new end #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- def write_save_data(file) # Make character data for drawing save file characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end # Write character data for drawing save file Marshal.dump(characters, file) # Wrire frame count for measuring play time Marshal.dump(Graphics.frame_count, file) # Increase save count by 1 $game_system.save_count += 1 # Save magic number # (A random value will be written each time saving with editor) $game_system.magic_number = $data_system.magic_number # Write each type of game object Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, 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 class Window_SaveMenutxt < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 390, 64) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(34, 0, 330, 32, "Vuoi salvare i progressi di gioco?") end end class Scene_Save_Menu #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main @spriteset = Spriteset_Map.new s1 = "Salva" s2 = "Annulla" @command_window = Window_Command.new(192, [s1, s2]) @command_window.back_opacity = 160 @command_window.x = 320 - @command_window.width / 2 @command_window.y = 288 @testo = Window_SaveMenutxt.new @testo.back_opacity = 160 @testo.x = 320 - @testo.width / 2 @testo.y = 50 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 Graphics.freeze @command_window.dispose @testo.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @command_window.update if Input.trigger?(Input::C) case @command_window.index when 0 command_salva when 1 command_esci end end #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def command_salva $game_system.se_play($data_system.decision_se) $scene = Scene_Save.new end #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def command_esci $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end end end Bugs e Conflitti NotiN/ACiao a tutti ; ) Edited March 14, 2013 by Flame http://www.rpg2s.net/gif/SloganContest1.gif Proggetto in corso:ARCANIAANNULLATO http://pokejungle.net/other/pokepet/Arcanine.gif http://img517.imageshack.us/img517/1229/9452ni4.jpg- - - Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now