#============================================================================= # Multi_Starter #------------------------------------------------------------------------------ # Ce script permet de choisir plusieurs point de départ pour # plusieurs équipes différente. # Il permet également de n'utiliser certaines équipes que si des # interrupteurs spécifiques sont activés dans les sauvegardes. #------------------------------------------------------------------------------ # Créé par Sihn # Conçu pour RMVX # Version 2.0 #============================================================================= #============================================================================== # Game_Start #============================================================================== class Game_Start attr_accessor :name attr_accessor :x attr_accessor :y attr_accessor :map_id attr_accessor :actors attr_accessor :switches_needed attr_accessor :variable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(name) @name = name @x = $data_system.start_x @y = $data_system.start_y @map_id = $data_system.start_map_id @actors = $data_system.party_members @switches_needed = [] @variable = 0 end end #============================================================================== # Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # setup_starting_members #-------------------------------------------------------------------------- alias multi_setup_starting_members setup_starting_members def setup_starting_members(party_members=nil) if party_members == nil multi_setup_starting_members else @actors = [] for i in party_members @actors.push(i) end end end end #============================================================================== # Scene_Title #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # command_new_game #-------------------------------------------------------------------------- def command_new_game Sound.play_decision $scene = Scene_Start.new close_command_window end end #============================================================================== # Scene_Start #============================================================================== class Scene_Start < Scene_Base #-------------------------------------------------------------------------- # start #-------------------------------------------------------------------------- def start super @start_list = [] setup_start create_title_graphic create_command_window end #-------------------------------------------------------------------------- # perform_transition #-------------------------------------------------------------------------- def perform_transition Graphics.transition(20) end #-------------------------------------------------------------------------- # post_start #-------------------------------------------------------------------------- def post_start super open_command_window end #-------------------------------------------------------------------------- # pre_terminate #-------------------------------------------------------------------------- def pre_terminate super close_command_window end #-------------------------------------------------------------------------- # termination #-------------------------------------------------------------------------- def terminate super dispose_command_window snapshot_for_background dispose_title_graphic end #-------------------------------------------------------------------------- # update #-------------------------------------------------------------------------- def update super @command_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) start_game end end #-------------------------------------------------------------------------- # create_title_graphic #-------------------------------------------------------------------------- def create_title_graphic @sprite = Sprite.new @sprite.bitmap = Cache.system("Title") end #-------------------------------------------------------------------------- # dispose_title_graphic #-------------------------------------------------------------------------- def dispose_title_graphic @sprite.bitmap.dispose @sprite.dispose end #-------------------------------------------------------------------------- # add_start #-------------------------------------------------------------------------- def add_start(name) @current = Game_Start.new(name) @start_list.push(@current) end #-------------------------------------------------------------------------- # check_save_switch #-------------------------------------------------------------------------- def check_saved_switch(switch_id) filenames = Dir.glob('Save*.rvdata') for filename in filenames file = File.open(filename, "rb") game_switches = Marshal.load(file) until game_switches.is_a?(Game_Switches) return true if game_switches[switch_id] file.close game_switches = nil end return false end #-------------------------------------------------------------------------- # create_command_window #-------------------------------------------------------------------------- def create_command_window positions = [] for game_start in @start_list switches = game_start.switches_needed.sort while switches.size > 0 if check_saved_switch(switches[0]) switches.delete(switches[0]) else break end end positions.push(game_start.name) if switches.size == 0 end @command_window = Window_Command.new(256, positions) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = (416 - @command_window.height) / 2 @command_window.openness = 0 @command_window.open end #-------------------------------------------------------------------------- # dispose_command_window #-------------------------------------------------------------------------- def dispose_command_window @command_window.dispose end #-------------------------------------------------------------------------- # open_command_window #-------------------------------------------------------------------------- def open_command_window @command_window.open begin @command_window.update Graphics.update end until @command_window.openness == 255 end #-------------------------------------------------------------------------- # close_command_window #-------------------------------------------------------------------------- def close_command_window @command_window.close begin @command_window.update Graphics.update end until @command_window.openness == 0 end #-------------------------------------------------------------------------- # play_title_music #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end #-------------------------------------------------------------------------- # return_scene #-------------------------------------------------------------------------- def return_scene $scene = Scene_Title.new end #-------------------------------------------------------------------------- # confirm_player_location #-------------------------------------------------------------------------- def confirm_player_location if @start_list[@command_window.index].map_id == 0 print "Player start location not set." exit end end #-------------------------------------------------------------------------- # start_game #-------------------------------------------------------------------------- def start_game confirm_player_location Sound.play_decision start_pos = @start_list[@command_window.index] $game_party.setup_starting_members(start_pos.actors) $game_map.setup(start_pos.map_id) $game_player.moveto(start_pos.x, start_pos.y) $game_player.refresh $game_variables[StartsVar] = start_pos.variable $scene = Scene_Map.new RPG::BGM.fade(1500) close_command_window Graphics.fadeout(60) Graphics.wait(40) Graphics.frame_count = 0 RPG::BGM.stop $game_map.autoplay end end