Poulet carnivore Lv.2
Age : 26 Inscrit le : 28/10/2010 Messages : 26
| Sujet: Appel de script pour charger une partie: Jeu 25 Nov 2010 - 15:58 | |
| Bonjour, je suis actuellement en train de faire un écran-titre en pictures, et je voudrais appeler un script qui me permettrais de charger une partie. En fait, mon projet est uniquement composé d'une auto sauvegarde, mise grâce a ce script: - Citation :
- =begin
AutoSave VX Author: BulleXt(bulletxt@gmail.com) Version: 0.1 Date: 06/07/2009
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 the number of how many saving slots you want NUMBER_OF_SAVE_SLOTS = 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
############################### END CONFIGURATION ##############################
SAVING_FILE = "Save" + SAVE_NUMBER.to_s() + ".rvdata" SAVE_NUMBER = 1 if SAVE_NUMBER > NUMBER_OF_SAVE_SLOTS SAVE_NUMBER = 1 if SAVE_NUMBER < 1
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, "Vous ne pouvez pas écraser l'auto sauvegarde.") 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_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 Window_SaveFile < Window_Base
def initialize(file_index, filename) super(0, 56 + file_index % NUMBER_OF_SAVE_SLOTS * 90, 544, 90) @file_index = file_index @filename = filename load_gamedata refresh @selected = false end #change autoslave slot string "File $n" def refresh self.contents.clear self.contents.font.color = normal_color name = Vocab::File + " #{@file_index + 1}" if @file_index != SAVE_NUMBER - 1 self.contents.draw_text(4, 0, 200, WLH, name) @name_width = contents.text_size(name).width @autosaveslot = "Auto-sauvegarde" self.contents.draw_text(6, 0, 200, WLH, @autosaveslot) if @file_index == SAVE_NUMBER - 1 if @file_exist draw_party_characters(152, 58) draw_playtime(0, 34, contents.width - 4, 2) end end #handle cursor width when going on autosave slot def update_cursor if @selected self.cursor_rect.set(0, 0, @name_width + 8, WLH) if @file_index != SAVE_NUMBER - 1 self.cursor_rect.set(0, 0, 140, WLH) if @file_index == SAVE_NUMBER - 1 else self.cursor_rect.empty end end
end
J'aimerais donc savoir quel script appeler en event pour charger l'auto-save. Merci d'avance! |
|
Maître des Duels
Age : 32 Inscrit le : 29/07/2009 Messages : 7841
| Sujet: Re: Appel de script pour charger une partie: Jeu 25 Nov 2010 - 17:14 | |
| D'après ce que j'ai lu, tu ne peux pas appeller directement la sauvegarde. Il faut obligatoirement passer par Scene_File.
Après si tu veux vraiment charger la partie faut bidouiller un truc dans Game_Interpreter pour charger l'auto save.
Enfin, si tu veux appeler le menu de chargement c'est $scene = Scene_File.new(false, true, false) |
|
Poulet carnivore Lv.2
Age : 26 Inscrit le : 28/10/2010 Messages : 26
| Sujet: Re: Appel de script pour charger une partie: Jeu 25 Nov 2010 - 17:20 | |
| Ah ok, je connaissais déjà la technique du menu de chargement. Bon, ben je crois que je vais passer par celui-ci. Merci quand même. |
|
Ex-Grand Œil des projets
Age : 39 Inscrit le : 10/06/2009 Messages : 1137
| Sujet: Re: Appel de script pour charger une partie: Sam 11 Déc 2010 - 8:48 | |
| Un petit tour par le règlement de cette section ne serait pas de trop. N'oublie pas d'éditer le titre de ton sujet pour signaler qu'il est résolu ou abandonné à l'avenir. Merci. |
|
| Sujet: Re: Appel de script pour charger une partie: | |
| |
|