Phantom Posted July 3, 2007 Share Posted July 3, 2007 Load Game in Game DescrizioneUno script che permette di caricare la partita direttamente dal gioco. A mio parere molto utile. Autore????????????? AllegatiQesta è una demo di come dovrebbe risultare Carica_partita.rar Istruzioni per l'uso Creiamo una classe sopra il Main chiamata Scene_Save2 e inseriamo il seguente codice: #============================================================================== # ¦ Scene_Save #------------------------------------------------------------------------------ # ????????????????? #============================================================================== class Scene_Save2 < Scene_File #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize super("Dove Salvo?") end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def on_decision(filename) # ??? SE ??? $game_system.se_play($data_system.save_se) # ??????????? file = File.open(filename, "wb") write_save_data(file) file.close # ???????????????? if $game_temp.save_calling # ?????????????? $game_temp.save_calling = false # ?????????? $scene = Scene_Map.new return end # ??????????? scene = Scene_Map.new end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def on_cancel # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ???????????????? if $game_temp.save_calling # ?????????????? $game_temp.save_calling = false # ?????????? $scene = Scene_Map.new return end # ??????????? $scene = Scene_Menu.new(4) end #-------------------------------------------------------------------------- # ? ??????????? # file : ??????????????? (??????) #-------------------------------------------------------------------------- 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(characters, file) # ?????????????????????? Marshal.dump(Graphics.frame_count, file) # ?????? 1 ??? $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_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 Poi creiamone un’altra chiamata Scene_Load2 e inseriamo il seguente codice: #============================================================================== # ¦ Scene_Load #------------------------------------------------------------------------------ # ????????????????? #============================================================================== class Scene_Load2 < Scene_File #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize # ??????????????? $game_temp = Game_Temp.new # ?????????????????? $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0..3 filename = make_filename(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super("Quale Salvataggio?") end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def on_decision(filename) # ???????????? unless FileTest.exist?(filename) # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??? SE ??? $game_system.se_play($data_system.load_se) # ??????????? file = File.open(filename, "rb") read_save_data(file) file.close # BGM?BGS ??? $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) # ?????? (????????) $game_map.update # ?????????? $scene = Scene_Map.new end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def on_cancel # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ??????????? $scene = Scene_Title.new end #-------------------------------------------------------------------------- # ? ??????????? # file : ??????????????? (??????) #-------------------------------------------------------------------------- def read_save_data(file) # ????????????????????????? characters = Marshal.load(file) # ?????????????????????? Graphics.frame_count = Marshal.load(file) # ???????????????? $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = 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.magic_number != $data_system.magic_number # ???????? $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # ??????????????? $game_party.refresh end end infine l’ultima che chiameremo Scene_Menu2: #============================================================================== # ¦ Scene_Menu #------------------------------------------------------------------------------ # ?????????????????? #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ? ????????? # menu_index : ????????????? #-------------------------------------------------------------------------- # # ???????????? def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main # ???????????? s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Salva" s6= "Carica" s7 = "Esci dal gioco" @command_window = Window_Command.new(180, [s1, s2, s3, s4, s5, s6,s7]) @command_window.index = @menu_index # ??????? 0 ???? # ???????? # ???????? if $game_party.actors.size == 0 # ????????????????????? @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # ???????? if $game_system.save_disabled # ????????? @command_window.disable_item(4) end # ????????????? # ?????????? @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 320 # ?????????? # ???????????? @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # ????????????? @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @command_window.dispose @playtime_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? @command_window.update @playtime_window.update @gold_window.update @status_window.update # ??????????????????: update_command ??? if @command_window.active update_command return end # ???????????????????: update_status ??? if @status_window.active update_status return end end #-------------------------------------------------------------------------- # ? ?????? (??????????????????) #-------------------------------------------------------------------------- def update_command # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ?????????? $scene = Scene_Map.new return end # C ?????????? if Input.trigger?(Input::C) # ??????? 0 ?????????????????????? if $game_party.actors.size == 0 and @command_window.index < 4 # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??????????????????? case @command_window.index when 0 # ???? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????? $scene = Scene_Item.new when 1 # ??? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # ?? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # ????? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 # ??? # ???????? if $game_system.save_disabled # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? $scene = Scene_Save.new when 6 # ????? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ???????????? $scene = Scene_End.new when 5 # ????? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? $scene = Scene_Load.new end return end end #-------------------------------------------------------------------------- # ? ?????? (???????????????????) #-------------------------------------------------------------------------- def update_status # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ?????????????????? @command_window.active = true @status_window.active = false @status_window.index = -1 return end # C ?????????? if Input.trigger?(Input::C) # ??????????????????? case @command_window.index when 1 # ??? # ???????????? 2 ????? if $game_party.actors[@status_window.index].restriction >= 2 # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? $scene = Scene_Skill.new(@status_window.index) when 2 # ?? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ????????? $scene = Scene_Equip.new(@status_window.index) when 3 # ????? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ???????????? $scene = Scene_Status.new(@status_window.index) end return end end end Bugs e Conflitti NotiN/A Link to comment Share on other sites More sharing options...
Uzumaki92 Posted July 3, 2007 Share Posted July 3, 2007 Mhh...credo che la sezione sia alquanto sbagliata!!!! http://www.narutogen.com/sign/naruto.jpgI will become the best Hogake in the world! Link to comment Share on other sites More sharing options...
Blake Posted July 3, 2007 Share Posted July 3, 2007 Spostata. http://www.xboxlc.com/cards/simplered/higherthanhope.jpg Spazio pubblicitario: Commentate, Bastardi! Grazie per la sopportazione! http://www.rpg2s.net/awards/beststoryboarder1.jpghttp://www.rpg2s.net/awards/mostcharismatic1.jpghttp://www.rpg2s.net/awards/nicestuser1.jpg http://rpg2s.net/gif/MGContest1.gif 1° Posto al minigame contesthttp://img215.imageshack.us/img215/2788/targhetta2pr0.png Link to comment Share on other sites More sharing options...
marigno Posted July 3, 2007 Share Posted July 3, 2007 Bisogna creditare l'autore. Edita. 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