Ich habe das Script entsprechend angepasst: Code: #============================================================================== # ¦ New/Load Game Enhanced #------------------------------------------------------------------------------ # Additions by stardust # - Herzanzeige # - Artefakte # - Rubin & Icon # - Div. Anpassungen #============================================================================== #Einstellungen----------------------------------------------------------------- SAVES_MAX = 3 SAVE_PICTURE = "choose_save" STARTING_HEARTS = 3 NEWGAME_TEXT = "Neues Spiel" #Artefakt-Switches ARTEFAKT01_SWITCH = 151 ARTEFAKT02_SWITCH = 152 ARTEFAKT03_SWITCH = 153 ARTEFAKT04_SWITCH = 154 ARTEFAKT05_SWITCH = 155 ARTEFAKT06_SWITCH = 156 ARTEFAKT07_SWITCH = 157 ARTEFAKT08_SWITCH = 158 ARTEFAKT09_SWITCH = 159 #------------------------------------------------------------------------------ class Game_Temp attr_accessor :name_fileproc alias new_initialize initialize def initialize new_initialize @name_fileproc = "" end end class Game_System attr_accessor :newgame_switch attr_accessor :played_bgm attr_accessor :played_bgs attr_accessor :save_slot alias new_initialize initialize def initialize new_initialize @newgame_switch = false @played_bgm = "" played_bgs = "" @save_slot = "" end end #============================================================================== # ¦ Window_NameEdit #------------------------------------------------------------------------------ # ??????????????????????? #============================================================================== class Window_NameEdit < Window_Base def refresh self.contents.clear @charset_index = 0 if @charset_index == nil # ????? name_array = @name.split(//) for i in 0...@max_char c = name_array[i] if c == nil c = "_" end x = 840 - @max_char * 14 + i * 28 self.contents.draw_text_outline(x, 32, 28, 32, c, 1) end # ????????? bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue) cw = bitmap.rect.width / 9.3 ch = bitmap.rect.height / 4 src_rect = Rect.new(@charset_index*120, 0, cw, ch) self.contents.blt(840 - @max_char * 14 - 40 - (cw/2), 68 - ch, bitmap, src_rect) end def charset_index(index) @charset_index = index refresh end end #============================================================================== # ¦ Scene_Name #------------------------------------------------------------------------------ # ?????????????????? #============================================================================== class Scene_Name #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main #------------------------------- # Animated Background Setup #------------------------------- @back = Sprite.new #@sprite.bitmap = RPG::Cache.title($data_system.title_name) @backgroundList = ["Titlescreen1"] @backgroundGameFrameCount = 0 # Number of game frames per background frame. @backgroundG_BFrameCount = 3.4 @back.bitmap = RPG::Cache.title(@backgroundList[0]) @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) # ??????? @actor = $game_actors[$game_temp.name_actor_id] # ???????? @edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char) @input_window = Window_NameInput.new # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @sprite.dispose @back.dispose @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? @edit_window.update @input_window.update @backgroundGameFrameCount = @backgroundGameFrameCount + 1 if @backgroundGameFrameCount >= @backgroundG_BFrameCount @backgroundGameFrameCount = 0 # Add current background frame to the end @backgroundList = @backgroundList << @backgroundList[0] # and drop it from the first position @backgroundList.delete_at(0) @sprite.bitmap = RPG::Cache.title(@backgroundList[0]) end # B ?????????? if Input.repeat?(Input::B) # ??????? 0 ??? if @edit_window.index == 0 return end # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ????? @edit_window.back return end # C ?????????? if Input.trigger?(Input::C) # ??????? [??] ??? if @input_window.character == nil # ??????? if @edit_window.name == "" # ??????????? @edit_window.restore_default # ??????? if @edit_window.name == "" # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) return end # ?????????? @actor.name = @edit_window.name # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? #-------------------------------------------------------- # Things After this has been edited to fit the new system #-------------------------------------------------------- $game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh $game_map.autoplay $game_map.update $game_variables[8] = STARTING_HEARTS*2 $game_variables[41] = STARTING_HEARTS $game_variables[42] = 0 $game_variables[50] = 0 file = $game_temp.name_fileproc 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.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) file.close $game_party.remove_actor(1) $scene = Scene_Map.new $game_temp.name_calling = false #-------------------------------------------------------- # Edits ends here #-------------------------------------------------------- return end # ???????????? if @edit_window.index == $game_temp.name_max_char # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??????? if @input_window.character == "" # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ????? @edit_window.add(@input_window.character) return end @wait = 3 if @wait == nil or @wait == 0 @charset_index = 0 if @charset_index == nil or @charset_index == 6 @wait -= 1 return if @wait > 0 @charset_index += 1 @edit_window.charset_index(@charset_index) end end #============================================================================== # ¦ Window_SaveFile #------------------------------------------------------------------------------ # ??????????????????????????????????? #============================================================================== class Window_NewLoadFile < Window_Base #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- attr_reader :filename # ????? attr_reader :selected # ???? #-------------------------------------------------------------------------- # ? ????????? # file_index : ?????????????? (0~3) # filename : ????? #-------------------------------------------------------------------------- def initialize(file_index, filename) super(50, 64 + file_index % 4 * 104 + (12*file_index) + 12, 540, 104) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize self.opacity = 0 @charset_index = 0 @file_index = file_index @filename = "Save#{@file_index + 1}.sav" @time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) @yp = 12 if @file_exist File.delete(@filename) if File.stat(@filename).size == 0 @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "rb") @time_stamp = Marshal.load(file) @characters = Marshal.load(file) @frame_count = Marshal.load(file) @game_system = Marshal.load(file) @game_switches = Marshal.load(file) @game_variables = Marshal.load(file) @game_party = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate file.close end end refresh @selected = false end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh self.contents.clear # ????????? self.contents.font.color = normal_color if @file_index == SAVES_MAX @exit = RPG::Cache.picture("exit") self.z = 0 self.y = 390 src_rect = Rect.new(0, 0, @exit.rect.width, @exit.rect.height) self.contents.blt(self.x - 78, 60 - @exit.rect.height, @exit, src_rect) self.opacity = 0 end name = "" name = @game_party.actors[0].name if @file_exist self.contents.draw_text_outline(4, -1, 600, 32, name) @name_width = contents.text_size(name).width # ?????????????? if @file_exist for i in 0...@characters.size bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 9.3 ch = bitmap.rect.height / 4 src_rect = Rect.new(@charset_index*120, 0, cw, ch) x = 105 - @characters.size * 120 + i * 64 - cw / 2 self.contents.blt(x+25, 73 - ch, bitmap, src_rect) heart_display(x+78, 83-ch) end # Rubine bitmap = RPG::Cache.picture("HUD___Rubin") self.contents.blt(431, 2, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) self.contents.draw_text_outline(425, 0, 600, 32, sprintf("%10.3d",@game_variables[53].to_s)) # Artefakte if @game_switches[ARTEFAKT01_SWITCH] then bitmap = RPG::Cache.picture("Artefakt1") self.contents.blt(106, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT02_SWITCH] then bitmap = RPG::Cache.picture("Artefakt2") self.contents.blt(142, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT03_SWITCH] then bitmap = RPG::Cache.picture("Artefakt3") self.contents.blt(178, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT04_SWITCH] then bitmap = RPG::Cache.picture("Artefakt4") self.contents.blt(214, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT05_SWITCH] then bitmap = RPG::Cache.picture("Artefakt5") self.contents.blt(250, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT06_SWITCH] then bitmap = RPG::Cache.picture("Artefakt6") self.contents.blt(286, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT07_SWITCH] then bitmap = RPG::Cache.picture("Artefakt7") self.contents.blt(322, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT08_SWITCH] then bitmap = RPG::Cache.picture("Artefakt8") self.contents.blt(358, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT09_SWITCH] then bitmap = RPG::Cache.picture("Artefakt9") self.contents.blt(390, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end else #Schrift für Neues Spiel if self.filename != "Save" + (SAVES_MAX + 1).to_s + ".sav" then @name_width = contents.text_size(NEWGAME_TEXT).width self.contents.draw_text_outline(4, 0, 600, 32, NEWGAME_TEXT) end end end def heart_display(x, y) @x = x @y = y @link_heart = @game_variables[8] @link_maxheart = @game_variables[41] if @link_heart == 1 insert_halfheart elsif @link_heart >= 2 insert_fullheart end if @link_heart <= 2 insert_emptyheart elsif @link_heart == 3 insert_halfheart elsif @link_heart >= 4 insert_fullheart end if @link_maxheart >= 3 if @link_heart <= 4 insert_emptyheart elsif @link_heart == 5 insert_halfheart elsif @link_heart >= 6 insert_fullheart end end if @link_maxheart >= 4 if @link_heart <= 6 insert_emptyheart elsif @link_heart == 7 insert_halfheart elsif @link_heart >= 8 insert_fullheart end end if @link_maxheart >= 5 if @link_heart <= 8 insert_emptyheart elsif @link_heart == 9 insert_halfheart elsif @link_heart >= 10 insert_fullheart end end if @link_maxheart >= 6 if @link_heart <= 10 insert_emptyheart elsif @link_heart == 11 insert_halfheart elsif @link_heart >= 12 insert_fullheart end end if @link_maxheart >= 7 if @link_heart <= 12 insert_emptyheart elsif @link_heart == 13 insert_halfheart elsif @link_heart >= 14 insert_fullheart end end if @link_maxheart >= 8 if @link_heart <= 14 insert_emptyheart elsif @link_heart == 15 insert_halfheart elsif @link_heart >= 16 insert_fullheart end end if @link_maxheart >= 9 if @link_heart <= 16 insert_emptyheart elsif @link_heart == 17 insert_halfheart elsif @link_heart >= 18 insert_fullheart end end if @link_maxheart >= 10 if @link_heart <= 18 insert_emptyheart elsif @link_heart == 19 insert_halfheart elsif @link_heart >= 20 insert_fullheart end end if @link_maxheart >= 11 @y += 16 @x = x if @link_heart <= 20 insert_emptyheart(true) elsif @link_heart == 21 insert_halfheart(true) elsif @link_heart >= 22 insert_fullheart(true) end end if @link_maxheart >= 12 if @link_heart <= 22 insert_emptyheart(true) elsif @link_heart == 23 insert_halfheart(true) elsif @link_heart >= 24 insert_fullheart(true) end end if @link_maxheart >= 13 if @link_heart <= 24 insert_emptyheart(true) elsif @link_heart == 25 insert_halfheart(true) elsif @link_heart >= 26 insert_fullheart(true) end end if @link_maxheart >= 14 if @link_heart <= 26 insert_emptyheart(true) elsif @link_heart == 27 insert_halfheart(true) elsif @link_heart >= 28 insert_fullheart(true) end end if @link_maxheart >= 15 if @link_heart <= 28 insert_emptyheart(true) elsif @link_heart == 29 insert_halfheart(true) elsif @link_heart >= 30 insert_fullheart(true) end end if @link_maxheart >= 16 if @link_heart <= 30 insert_emptyheart(true) elsif @link_heart == 31 insert_halfheart(true) elsif @link_heart >= 32 insert_fullheart(true) end end if @link_maxheart >= 17 if @link_heart <= 32 insert_emptyheart(true) elsif @link_heart == 33 insert_halfheart(true) elsif @link_heart >= 34 insert_fullheart(true) end end if @link_maxheart >= 18 if @link_heart <= 34 insert_emptyheart(true) elsif @link_heart == 35 insert_halfheart(true) elsif @link_heart >= 36 insert_fullheart(true) end end if @link_maxheart >= 19 if @link_heart <= 36 insert_emptyheart(true) elsif @link_heart == 37 insert_halfheart(true) elsif @link_heart >= 38 insert_fullheart(true) end end if @link_maxheart >= 20 if @link_heart <= 38 insert_emptyheart(true) elsif @link_heart == 39 insert_halfheart(true) elsif @link_heart >= 40 insert_fullheart(true) end end end def insert_fullheart(secondRow = false) bitmap = RPG::Cache.picture("FullHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y, bitmap, src_rect) @x += cw end def insert_halfheart(secondRow = false) bitmap = RPG::Cache.picture("HalfHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y, bitmap, src_rect) @x += cw end def insert_emptyheart(secondRow = false) bitmap = RPG::Cache.picture("EmptyHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y , bitmap, src_rect) @x += cw end #-------------------------------------------------------------------------- # ? ??????? # selected : ??????? (true=?? false=???) #-------------------------------------------------------------------------- def selected=(selected) @selected = selected update_cursor_rect end def charset_index(index) @charset_index = index refresh end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_cursor_rect if @selected if @file_index == SAVES_MAX self.cursor_rect.set(self.x + 7, 63 - @exit.rect.height, @exit.rect.width+2, @exit.rect.height+2) else self.cursor_rect.set(0, 0, @name_width + 8, 32) end else self.cursor_rect.empty end end end #============================================================================== # ¦ Scene_File #------------------------------------------------------------------------------ # ???????????????????????? #============================================================================== class Scene_NewLoadFile #-------------------------------------------------------------------------- # ? ????????? # help_text : ???????????????? #-------------------------------------------------------------------------- def initialize(help_text) @help_text = help_text end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main $game_party.setup_starting_members #------------------------------- # Animated Background Setup #------------------------------- @back = Sprite.new #@sprite.bitmap = RPG::Cache.title($data_system.title_name) @backgroundList = ["SaveScreen"] @backgroundGameFrameCount = 0 # Number of game frames per background frame. @backgroundG_BFrameCount = 3.4 @back.bitmap = RPG::Cache.title(@backgroundList[0]) @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) # ??????????????? @savefile_windows = [] for i in 0..SAVES_MAX @savefile_windows.push(Window_NewLoadFile.new(i, make_filename(i))) end # ?????????????? @file_index = $game_temp.last_file_index @savefile_windows[@file_index].selected = true # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @sprite.dispose @back.dispose for i in @savefile_windows i.dispose end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update @backgroundGameFrameCount = @backgroundGameFrameCount + 1 if @backgroundGameFrameCount >= @backgroundG_BFrameCount @backgroundGameFrameCount = 0 # Add current background frame to the end @backgroundList = @backgroundList << @backgroundList[0] # and drop it from the first position @backgroundList.delete_at(0) @sprite.bitmap = RPG::Cache.title(@backgroundList[0]) end for i in @savefile_windows i.update end # C ?????????? if Input.trigger?(Input::C) if @file_index == SAVES_MAX $scene = nil else $game_system.se_play($data_system.decision_se) if FileTest.exist?(make_filename(@file_index)) on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index else $game_system.save_slot = make_filename(@file_index) file = File.new(make_filename(@file_index), "wb") on_new(file) $game_temp.last_file_index = @file_index end end end # B ?????????? if Input.trigger?(Input::B) # ???? on_cancel (??????) ??? on_cancel return end # ?????????????? if Input.repeat?(Input::DOWN) # ???????????????????????? # ?????????? 3 ?????? if Input.trigger?(Input::DOWN) or @file_index < 3 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 1) % 4 @savefile_windows[@file_index].selected = true return end end # ?????????????? if Input.repeat?(Input::UP) # ???????????????????????? # ?????????? 0 ??????? if Input.trigger?(Input::UP) or @file_index > 0 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 3) % 4 @savefile_windows[@file_index].selected = true return end end @wait = 3 if @wait == nil or @wait == 0 @charset_index = 0 if @charset_index == nil or @charset_index == 6 @wait -= 1 return if @wait > 0 @charset_index += 1 for i in 0..@savefile_windows.size-1 @savefile_windows[i].charset_index(@charset_index) next end end #-------------------------------------------------------------------------- # ? ???????? # file_index : ?????????????? (0~3) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.sav" end end class Scene_NewLoad < Scene_NewLoadFile def initialize $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, "rb") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super("Load from which file") end def on_new(file) $game_map.setup($data_system.start_map_id) $game_system.newgame_switch = true $game_temp.name_fileproc = file $game_temp.name_calling = true $game_temp.name_actor_id = 1 $game_temp.name_max_char = 8 $scene = Scene_Name.new 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, $game_system.newgame_switch) file.close Audio.bgm_stop $game_system.bgm_play($game_system.playing_bgm) if !$game_system.newgame_switch $game_system.bgs_play($game_system.playing_bgs) if !$game_system.newgame_switch $game_map.autoplay # ?????? (????????) $game_map.update $game_party.remove_actor(1) if $game_system.newgame_switch # ????????? $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, newgame) if !newgame Audio.bgm_stop # ????????????????????????? time = Marshal.load(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_party = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = 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) $game_player.refresh end else characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end time = Time.new # ?????????????????????? Graphics.frame_count = 0 # ???????????????? $game_system = Game_System.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_party = Game_Party.new $game_self_switches = Game_SelfSwitches.new $game_screen = Game_Screen.new $game_actors = Game_Actors.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new #$game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh end # ??????????????????? # (?????????????????) # ??????????????? $game_party.refresh end end lg stardust
#============================================================================== # ¦ New/Load Game Enhanced #------------------------------------------------------------------------------ # Additions by stardust # - Herzanzeige # - Artefakte # - Rubin & Icon # - Div. Anpassungen #============================================================================== #Einstellungen----------------------------------------------------------------- SAVES_MAX = 3 SAVE_PICTURE = "choose_save" STARTING_HEARTS = 3 NEWGAME_TEXT = "Neues Spiel" #Artefakt-Switches ARTEFAKT01_SWITCH = 151 ARTEFAKT02_SWITCH = 152 ARTEFAKT03_SWITCH = 153 ARTEFAKT04_SWITCH = 154 ARTEFAKT05_SWITCH = 155 ARTEFAKT06_SWITCH = 156 ARTEFAKT07_SWITCH = 157 ARTEFAKT08_SWITCH = 158 ARTEFAKT09_SWITCH = 159 #------------------------------------------------------------------------------ class Game_Temp attr_accessor :name_fileproc alias new_initialize initialize def initialize new_initialize @name_fileproc = "" end end class Game_System attr_accessor :newgame_switch attr_accessor :played_bgm attr_accessor :played_bgs attr_accessor :save_slot alias new_initialize initialize def initialize new_initialize @newgame_switch = false @played_bgm = "" played_bgs = "" @save_slot = "" end end #============================================================================== # ¦ Window_NameEdit #------------------------------------------------------------------------------ # ??????????????????????? #============================================================================== class Window_NameEdit < Window_Base def refresh self.contents.clear @charset_index = 0 if @charset_index == nil # ????? name_array = @name.split(//) for i in 0...@max_char c = name_array[i] if c == nil c = "_" end x = 840 - @max_char * 14 + i * 28 self.contents.draw_text_outline(x, 32, 28, 32, c, 1) end # ????????? bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue) cw = bitmap.rect.width / 9.3 ch = bitmap.rect.height / 4 src_rect = Rect.new(@charset_index*120, 0, cw, ch) self.contents.blt(840 - @max_char * 14 - 40 - (cw/2), 68 - ch, bitmap, src_rect) end def charset_index(index) @charset_index = index refresh end end #============================================================================== # ¦ Scene_Name #------------------------------------------------------------------------------ # ?????????????????? #============================================================================== class Scene_Name #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main #------------------------------- # Animated Background Setup #------------------------------- @back = Sprite.new #@sprite.bitmap = RPG::Cache.title($data_system.title_name) @backgroundList = ["Titlescreen1"] @backgroundGameFrameCount = 0 # Number of game frames per background frame. @backgroundG_BFrameCount = 3.4 @back.bitmap = RPG::Cache.title(@backgroundList[0]) @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) # ??????? @actor = $game_actors[$game_temp.name_actor_id] # ???????? @edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char) @input_window = Window_NameInput.new # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @sprite.dispose @back.dispose @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? @edit_window.update @input_window.update @backgroundGameFrameCount = @backgroundGameFrameCount + 1 if @backgroundGameFrameCount >= @backgroundG_BFrameCount @backgroundGameFrameCount = 0 # Add current background frame to the end @backgroundList = @backgroundList << @backgroundList[0] # and drop it from the first position @backgroundList.delete_at(0) @sprite.bitmap = RPG::Cache.title(@backgroundList[0]) end # B ?????????? if Input.repeat?(Input::B) # ??????? 0 ??? if @edit_window.index == 0 return end # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ????? @edit_window.back return end # C ?????????? if Input.trigger?(Input::C) # ??????? [??] ??? if @input_window.character == nil # ??????? if @edit_window.name == "" # ??????????? @edit_window.restore_default # ??????? if @edit_window.name == "" # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) return end # ?????????? @actor.name = @edit_window.name # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? #-------------------------------------------------------- # Things After this has been edited to fit the new system #-------------------------------------------------------- $game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh $game_map.autoplay $game_map.update $game_variables[8] = STARTING_HEARTS*2 $game_variables[41] = STARTING_HEARTS $game_variables[42] = 0 $game_variables[50] = 0 file = $game_temp.name_fileproc 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.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) file.close $game_party.remove_actor(1) $scene = Scene_Map.new $game_temp.name_calling = false #-------------------------------------------------------- # Edits ends here #-------------------------------------------------------- return end # ???????????? if @edit_window.index == $game_temp.name_max_char # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??????? if @input_window.character == "" # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ????? @edit_window.add(@input_window.character) return end @wait = 3 if @wait == nil or @wait == 0 @charset_index = 0 if @charset_index == nil or @charset_index == 6 @wait -= 1 return if @wait > 0 @charset_index += 1 @edit_window.charset_index(@charset_index) end end #============================================================================== # ¦ Window_SaveFile #------------------------------------------------------------------------------ # ??????????????????????????????????? #============================================================================== class Window_NewLoadFile < Window_Base #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- attr_reader :filename # ????? attr_reader :selected # ???? #-------------------------------------------------------------------------- # ? ????????? # file_index : ?????????????? (0~3) # filename : ????? #-------------------------------------------------------------------------- def initialize(file_index, filename) super(50, 64 + file_index % 4 * 104 + (12*file_index) + 12, 540, 104) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize self.opacity = 0 @charset_index = 0 @file_index = file_index @filename = "Save#{@file_index + 1}.sav" @time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) @yp = 12 if @file_exist File.delete(@filename) if File.stat(@filename).size == 0 @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "rb") @time_stamp = Marshal.load(file) @characters = Marshal.load(file) @frame_count = Marshal.load(file) @game_system = Marshal.load(file) @game_switches = Marshal.load(file) @game_variables = Marshal.load(file) @game_party = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate file.close end end refresh @selected = false end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh self.contents.clear # ????????? self.contents.font.color = normal_color if @file_index == SAVES_MAX @exit = RPG::Cache.picture("exit") self.z = 0 self.y = 390 src_rect = Rect.new(0, 0, @exit.rect.width, @exit.rect.height) self.contents.blt(self.x - 78, 60 - @exit.rect.height, @exit, src_rect) self.opacity = 0 end name = "" name = @game_party.actors[0].name if @file_exist self.contents.draw_text_outline(4, -1, 600, 32, name) @name_width = contents.text_size(name).width # ?????????????? if @file_exist for i in 0...@characters.size bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 9.3 ch = bitmap.rect.height / 4 src_rect = Rect.new(@charset_index*120, 0, cw, ch) x = 105 - @characters.size * 120 + i * 64 - cw / 2 self.contents.blt(x+25, 73 - ch, bitmap, src_rect) heart_display(x+78, 83-ch) end # Rubine bitmap = RPG::Cache.picture("HUD___Rubin") self.contents.blt(431, 2, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) self.contents.draw_text_outline(425, 0, 600, 32, sprintf("%10.3d",@game_variables[53].to_s)) # Artefakte if @game_switches[ARTEFAKT01_SWITCH] then bitmap = RPG::Cache.picture("Artefakt1") self.contents.blt(106, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT02_SWITCH] then bitmap = RPG::Cache.picture("Artefakt2") self.contents.blt(142, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT03_SWITCH] then bitmap = RPG::Cache.picture("Artefakt3") self.contents.blt(178, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT04_SWITCH] then bitmap = RPG::Cache.picture("Artefakt4") self.contents.blt(214, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT05_SWITCH] then bitmap = RPG::Cache.picture("Artefakt5") self.contents.blt(250, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT06_SWITCH] then bitmap = RPG::Cache.picture("Artefakt6") self.contents.blt(286, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT07_SWITCH] then bitmap = RPG::Cache.picture("Artefakt7") self.contents.blt(322, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT08_SWITCH] then bitmap = RPG::Cache.picture("Artefakt8") self.contents.blt(358, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end if @game_switches[ARTEFAKT09_SWITCH] then bitmap = RPG::Cache.picture("Artefakt9") self.contents.blt(390, 40, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height)) end else #Schrift für Neues Spiel if self.filename != "Save" + (SAVES_MAX + 1).to_s + ".sav" then @name_width = contents.text_size(NEWGAME_TEXT).width self.contents.draw_text_outline(4, 0, 600, 32, NEWGAME_TEXT) end end end def heart_display(x, y) @x = x @y = y @link_heart = @game_variables[8] @link_maxheart = @game_variables[41] if @link_heart == 1 insert_halfheart elsif @link_heart >= 2 insert_fullheart end if @link_heart <= 2 insert_emptyheart elsif @link_heart == 3 insert_halfheart elsif @link_heart >= 4 insert_fullheart end if @link_maxheart >= 3 if @link_heart <= 4 insert_emptyheart elsif @link_heart == 5 insert_halfheart elsif @link_heart >= 6 insert_fullheart end end if @link_maxheart >= 4 if @link_heart <= 6 insert_emptyheart elsif @link_heart == 7 insert_halfheart elsif @link_heart >= 8 insert_fullheart end end if @link_maxheart >= 5 if @link_heart <= 8 insert_emptyheart elsif @link_heart == 9 insert_halfheart elsif @link_heart >= 10 insert_fullheart end end if @link_maxheart >= 6 if @link_heart <= 10 insert_emptyheart elsif @link_heart == 11 insert_halfheart elsif @link_heart >= 12 insert_fullheart end end if @link_maxheart >= 7 if @link_heart <= 12 insert_emptyheart elsif @link_heart == 13 insert_halfheart elsif @link_heart >= 14 insert_fullheart end end if @link_maxheart >= 8 if @link_heart <= 14 insert_emptyheart elsif @link_heart == 15 insert_halfheart elsif @link_heart >= 16 insert_fullheart end end if @link_maxheart >= 9 if @link_heart <= 16 insert_emptyheart elsif @link_heart == 17 insert_halfheart elsif @link_heart >= 18 insert_fullheart end end if @link_maxheart >= 10 if @link_heart <= 18 insert_emptyheart elsif @link_heart == 19 insert_halfheart elsif @link_heart >= 20 insert_fullheart end end if @link_maxheart >= 11 @y += 16 @x = x if @link_heart <= 20 insert_emptyheart(true) elsif @link_heart == 21 insert_halfheart(true) elsif @link_heart >= 22 insert_fullheart(true) end end if @link_maxheart >= 12 if @link_heart <= 22 insert_emptyheart(true) elsif @link_heart == 23 insert_halfheart(true) elsif @link_heart >= 24 insert_fullheart(true) end end if @link_maxheart >= 13 if @link_heart <= 24 insert_emptyheart(true) elsif @link_heart == 25 insert_halfheart(true) elsif @link_heart >= 26 insert_fullheart(true) end end if @link_maxheart >= 14 if @link_heart <= 26 insert_emptyheart(true) elsif @link_heart == 27 insert_halfheart(true) elsif @link_heart >= 28 insert_fullheart(true) end end if @link_maxheart >= 15 if @link_heart <= 28 insert_emptyheart(true) elsif @link_heart == 29 insert_halfheart(true) elsif @link_heart >= 30 insert_fullheart(true) end end if @link_maxheart >= 16 if @link_heart <= 30 insert_emptyheart(true) elsif @link_heart == 31 insert_halfheart(true) elsif @link_heart >= 32 insert_fullheart(true) end end if @link_maxheart >= 17 if @link_heart <= 32 insert_emptyheart(true) elsif @link_heart == 33 insert_halfheart(true) elsif @link_heart >= 34 insert_fullheart(true) end end if @link_maxheart >= 18 if @link_heart <= 34 insert_emptyheart(true) elsif @link_heart == 35 insert_halfheart(true) elsif @link_heart >= 36 insert_fullheart(true) end end if @link_maxheart >= 19 if @link_heart <= 36 insert_emptyheart(true) elsif @link_heart == 37 insert_halfheart(true) elsif @link_heart >= 38 insert_fullheart(true) end end if @link_maxheart >= 20 if @link_heart <= 38 insert_emptyheart(true) elsif @link_heart == 39 insert_halfheart(true) elsif @link_heart >= 40 insert_fullheart(true) end end end def insert_fullheart(secondRow = false) bitmap = RPG::Cache.picture("FullHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y, bitmap, src_rect) @x += cw end def insert_halfheart(secondRow = false) bitmap = RPG::Cache.picture("HalfHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y, bitmap, src_rect) @x += cw end def insert_emptyheart(secondRow = false) bitmap = RPG::Cache.picture("EmptyHeart") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) y = 0 if secondRow then y += 20 end self.contents.blt((@x - cw / 2) + 100, y , bitmap, src_rect) @x += cw end #-------------------------------------------------------------------------- # ? ??????? # selected : ??????? (true=?? false=???) #-------------------------------------------------------------------------- def selected=(selected) @selected = selected update_cursor_rect end def charset_index(index) @charset_index = index refresh end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_cursor_rect if @selected if @file_index == SAVES_MAX self.cursor_rect.set(self.x + 7, 63 - @exit.rect.height, @exit.rect.width+2, @exit.rect.height+2) else self.cursor_rect.set(0, 0, @name_width + 8, 32) end else self.cursor_rect.empty end end end #============================================================================== # ¦ Scene_File #------------------------------------------------------------------------------ # ???????????????????????? #============================================================================== class Scene_NewLoadFile #-------------------------------------------------------------------------- # ? ????????? # help_text : ???????????????? #-------------------------------------------------------------------------- def initialize(help_text) @help_text = help_text end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main $game_party.setup_starting_members #------------------------------- # Animated Background Setup #------------------------------- @back = Sprite.new #@sprite.bitmap = RPG::Cache.title($data_system.title_name) @backgroundList = ["SaveScreen"] @backgroundGameFrameCount = 0 # Number of game frames per background frame. @backgroundG_BFrameCount = 3.4 @back.bitmap = RPG::Cache.title(@backgroundList[0]) @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) # ??????????????? @savefile_windows = [] for i in 0..SAVES_MAX @savefile_windows.push(Window_NewLoadFile.new(i, make_filename(i))) end # ?????????????? @file_index = $game_temp.last_file_index @savefile_windows[@file_index].selected = true # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @sprite.dispose @back.dispose for i in @savefile_windows i.dispose end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update @backgroundGameFrameCount = @backgroundGameFrameCount + 1 if @backgroundGameFrameCount >= @backgroundG_BFrameCount @backgroundGameFrameCount = 0 # Add current background frame to the end @backgroundList = @backgroundList << @backgroundList[0] # and drop it from the first position @backgroundList.delete_at(0) @sprite.bitmap = RPG::Cache.title(@backgroundList[0]) end for i in @savefile_windows i.update end # C ?????????? if Input.trigger?(Input::C) if @file_index == SAVES_MAX $scene = nil else $game_system.se_play($data_system.decision_se) if FileTest.exist?(make_filename(@file_index)) on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index else $game_system.save_slot = make_filename(@file_index) file = File.new(make_filename(@file_index), "wb") on_new(file) $game_temp.last_file_index = @file_index end end end # B ?????????? if Input.trigger?(Input::B) # ???? on_cancel (??????) ??? on_cancel return end # ?????????????? if Input.repeat?(Input::DOWN) # ???????????????????????? # ?????????? 3 ?????? if Input.trigger?(Input::DOWN) or @file_index < 3 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 1) % 4 @savefile_windows[@file_index].selected = true return end end # ?????????????? if Input.repeat?(Input::UP) # ???????????????????????? # ?????????? 0 ??????? if Input.trigger?(Input::UP) or @file_index > 0 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 3) % 4 @savefile_windows[@file_index].selected = true return end end @wait = 3 if @wait == nil or @wait == 0 @charset_index = 0 if @charset_index == nil or @charset_index == 6 @wait -= 1 return if @wait > 0 @charset_index += 1 for i in 0..@savefile_windows.size-1 @savefile_windows[i].charset_index(@charset_index) next end end #-------------------------------------------------------------------------- # ? ???????? # file_index : ?????????????? (0~3) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.sav" end end class Scene_NewLoad < Scene_NewLoadFile def initialize $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, "rb") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super("Load from which file") end def on_new(file) $game_map.setup($data_system.start_map_id) $game_system.newgame_switch = true $game_temp.name_fileproc = file $game_temp.name_calling = true $game_temp.name_actor_id = 1 $game_temp.name_max_char = 8 $scene = Scene_Name.new 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, $game_system.newgame_switch) file.close Audio.bgm_stop $game_system.bgm_play($game_system.playing_bgm) if !$game_system.newgame_switch $game_system.bgs_play($game_system.playing_bgs) if !$game_system.newgame_switch $game_map.autoplay # ?????? (????????) $game_map.update $game_party.remove_actor(1) if $game_system.newgame_switch # ????????? $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, newgame) if !newgame Audio.bgm_stop # ????????????????????????? time = Marshal.load(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_party = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = 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) $game_player.refresh end else characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end time = Time.new # ?????????????????????? Graphics.frame_count = 0 # ???????????????? $game_system = Game_System.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_party = Game_Party.new $game_self_switches = Game_SelfSwitches.new $game_screen = Game_Screen.new $game_actors = Game_Actors.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new #$game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh end # ??????????????????? # (?????????????????) # ??????????????? $game_party.refresh end end
-- ⭐️ Part 1 JETZT spielen! ⭐️
Geändert von stardust (04.10.2010 um 21:28 Uhr)
Foren-Regeln