RPGVX.net

  RPG-Maker VX => VX Technik [Frageforum] => Thema gestartet von: DimiFW am Januar 04, 2011, 19:14:12

Titel: Nach Speichern direkt im Spiel landen
Beitrag von: DimiFW am Januar 04, 2011, 19:14:12
Gibt es eine Möglichkeit direkt nach dem Speichern nicht wieder ins Speichermenü zu kommen sondern direkt wieder in das Spiel?


installierte zusatzskripte die möglicherweise relevant sind:

BigEd781's Final Fantasy IX Save Screen
=begin
                    BigEd781's Final Fantasy IX Save Screen
                                 
 
                            Rewritten Methods
                            -----------------
                            Scene_File
                              write_save_data
                              create_savefile_windows
                              start
                            -----------------                     
=end                   
module FFIXSave

  # use an image instead of the hazy map background
  USE_CUSTOM_BACK = true
  # the name of the background image file (if above is set to 'true')
  BACK_NAME       = 'StoneBackground'
  # the name of the 'time' image file
  TIMER_NAME      = 'SaveTimer'
  # the name of the 'gold' image file
  GOLDCOIN_NAME   = 'GoldCoin'
  # the font to use.  Example:  'Times New Roman'
  FONT_NAME       = Font.default_name
  FONT_SIZE       = 20
  # Use character sprites instead of faces
  USE_CHARAS      = true
  # the color of the font.    (red, green, blue)
  FONT_COLOR      = Color.new(238, 238, 238)
  # changing this will move the timer and gold
  # icons left or right (for - or + values). 
  # this is useful if you have long names, or use a smaller font.   
  ICON_OFFSET_X   = 0 
 
end

class Rect
 
  def shift_y(value)
    new_y = self.y + value
    return Rect.new(self.x, new_y, self.width, self.height)
  end
 
end
#==============================================================================
# ** Sprite_HeaderBar
#------------------------------------------------------------------------------
#  This is the top right window in the save/load menu
#==============================================================================
class Sprite_LoadSave < Sprite_Base
 
  def initialize(x, y, text, viewport=nil)
    super(viewport)
    @bg_image = Cache.picture('LoadSaveDisplay')
    @text = text
    self.bitmap = Bitmap.new(@bg_image.width, @bg_image.height)
    self.x = x
    self.y = y
    update
  end
 
  def update
    self.bitmap.blt(0, 0, @bg_image, @bg_image.rect)       
    self.bitmap.draw_text(self.bitmap.rect.shift_y(3), @text, 1)
  end
 
end
#==============================================================================
# ** Sprite_HeaderBar
#------------------------------------------------------------------------------
#  This is the top left window in the save/load menu
#==============================================================================
class Sprite_HeaderBar < Sprite_Base
  #--------------------------------------------------------------------------
  # * initialize
  #--------------------------------------------------------------------------
  def initialize(viewport=nil)
    @image = Cache.picture('FF9_HeaderBar')   
    @slot = 1
    super(viewport)
    self.bitmap = Bitmap.new(@image.width, @image.height)
    self.x = 16
    self.y = 18
    update 
  end
  #--------------------------------------------------------------------------
  # * slot=
  #--------------------------------------------------------------------------
  def slot=(value) 
    @slot = value
  end
  #--------------------------------------------------------------------------
  # * update
  #--------------------------------------------------------------------------
  def update
    self.bitmap.blt(0, 0, @image, @image.rect) 
    text_y = 10
    text_h = 24
    self.bitmap.draw_text(16, text_y, 220, text_h, "Wähle eine Datei.")
    self.bitmap.draw_text(self.width - 72, text_y, 64, text_h, "Datei #{@slot}")
  end   
 
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_File < Scene_Base
 
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_save_start :start
  def start       
    super
    create_menu_background     
    @help_window = Sprite_HeaderBar.new
    create_loadsave_sprite
    create_savefile_windows   
    @index = @saving ? $game_temp.last_file_index : self.latest_file_index       
    @savefile_windows[@index].selected = true
  end
  #--------------------------------------------------------------------------
  # * create_menu_background (only if USE_CUSTOM_BACK == true)
  #--------------------------------------------------------------------------
  if FFIXSave::USE_CUSTOM_BACK
    def create_menu_background
      @menuback_sprite = Sprite.new
      @menuback_sprite.bitmap = Cache.picture(FFIXSave::BACK_NAME)
      @menuback_sprite.color.set(16, 16, 16, 128)
      update_menu_background
    end
  end
  #--------------------------------------------------------------------------
  # * create_loadsave_sprite
  #--------------------------------------------------------------------------
  def create_loadsave_sprite
    sx = @help_window.x + @help_window.width + 6
    sy = @help_window.y
    text = @saving ? "Speichern" : "Laden"
    @loadsave_sprite = Sprite_LoadSave.new(sx, sy, text)
  end 
  #--------------------------------------------------------------------------
  # * Update Save File Selection
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_save_update_savefile_selection :update_savefile_selection
  def update_savefile_selection
    eds_pre_ff9_save_update_savefile_selection
    @help_window.slot = @index + 1
  end
  #--------------------------------------------------------------------------
  # * write_save_data
  #--------------------------------------------------------------------------
  def write_save_data(file)
    characters = []
    map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
    for actor in $game_party.members
      characters.push([ actor.character_name,
                        actor.character_index,
                        actor.face_name,         # line added
                        actor.face_index,        # line added
                        actor.name,              # line added
                        actor.level,             # line added
                        $game_party.gold,        # line added             
                        map_name ])              # line added
    end
    $game_system.save_count += 1
    $game_system.version_id = $data_system.version_id
    @last_bgm = RPG::BGM::last
    @last_bgs = RPG::BGS::last
    Marshal.dump(characters,           file)
    Marshal.dump(Graphics.frame_count, file)
    Marshal.dump(@last_bgm,            file)
    Marshal.dump(@last_bgs,            file)
    Marshal.dump($game_system,         file)
    Marshal.dump($game_message,        file)
    Marshal.dump($game_switches,       file)
    Marshal.dump($game_variables,      file)
    Marshal.dump($game_self_switches,  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
  #--------------------------------------------------------------------------
  # * Create Save File Window
  #--------------------------------------------------------------------------
  def create_savefile_windows
    @savefile_windows = []
    for i in 0..3
      @savefile_windows.push(Window_FFIXSaveFile.new(i, make_filename(i)))
    end
    @item_max = 4
  end
 
  alias :eds_pre_ff9_terminate :terminate
  def terminate
    eds_pre_ff9_terminate
    @loadsave_sprite.dispose
  end
 
end
#==============================================================================
# ** Window_FFIXSaveFile
#------------------------------------------------------------------------------
#  This is the window displayed for each save slot
#==============================================================================
class Window_FFIXSaveFile < Window_SaveFile
 
  # the x , y position of the first column and line of text
  TEXT_COL1_X = 298
  TEXT_LINE1_Y = 0
  # the y position of the second line of text, Level and Gold display 
  TEXT_LINE2_Y = 20
  #--------------------------------------------------------------------------
  # * initialize
  #--------------------------------------------------------------------------
  def initialize(file_index, filename) 
    unless FileTest.exist?(filename)
      image_name = 'FF9_SaveFileWindow_no_overlay'
    else
      image_name = 'FF9_SaveFileWindow'
    end
    @bg_image = Cache.picture(image_name)
    @timer_image = Cache.picture(FFIXSave::TIMER_NAME) 
    @gold_image = Cache.picture(FFIXSave::GOLDCOIN_NAME) 
    super(file_index, filename)
    self.x = 0
    self.height = @bg_image.height + 32 
    # do this so that they images can be close together,
    # ignoring the 16 pixel window border
    self.y -= self.y * 0.1 
    self.contents.dispose
    self.contents = Bitmap.new(512, @bg_image.height)
    self.contents.font.name = FFIXSave::FONT_NAME
    self.contents.font.size = FFIXSave::FONT_SIZE
    self.opacity = 0   
    @arrow_sprite = Sprite.new
    @arrow_sprite.bitmap = Cache.picture('pointer')
    @arrow_sprite.x = 0
    @arrow_sprite.y = self.y + (0.4 * self.height)
    @arrow_sprite.visible = false       
    @arrow_sprite.z = self.z + 1
    refresh     
  end
 
  def selected=(value)
    @arrow_sprite.visible = value
  end
  #--------------------------------------------------------------------------
  # * refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = FFIXSave::FONT_COLOR     
    draw_background_panel
    begin
      if @file_exist     
        if FFIXSave::USE_CHARAS
          draw_party_characters(64, self.height / 2)
        else         
          draw_party_characters
        end
        draw_playtime
        draw_leader_name
        draw_leader_level
        draw_gold
        draw_location
        draw_icons
      end
    rescue   
      # do nothing or the game will crash
      # before the first save file is created.
    end
  end
  #--------------------------------------------------------------------------
  # * draw_background_panel
  #--------------------------------------------------------------------------
  def draw_background_panel
    self.contents.blt(0, 0, @bg_image, @bg_image.rect)
  end
 
  unless FFIXSave::USE_CHARAS
   
    #--------------------------------------------------------------------------
    # * draw_party_characters
    #--------------------------------------------------------------------------
    def draw_party_characters   
      x, y, size = 5, 5, (self.contents.height - 10)           
      for i in 0...@characters.size
        name = @characters[i][2]
        index = @characters[i][3]
        draw_face(name, index, x, y, size)
        x += size + 2
      end       
    end
   
  end
  #--------------------------------------------------------------------------
  # * draw_playtime
  #--------------------------------------------------------------------------
  def draw_playtime
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60   
    time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
    len = contents.text_size(time_string).width + 6
    contents.font.color = FFIXSave::FONT_COLOR   
    contents.draw_text(contents.width - len, TEXT_LINE1_Y, contents.width - 4, WLH, time_string)
  end
  #--------------------------------------------------------------------------
  # * draw_leader_name
  #--------------------------------------------------------------------------
  def draw_leader_name   
    name = @characters[0][4]
    self.contents.draw_text(TEXT_COL1_X, TEXT_LINE1_Y, 128, WLH, name)   
  end   
  #--------------------------------------------------------------------------
  # * draw_leader_level
  #--------------------------------------------------------------------------       
  def draw_leader_level   
    level = "Level #{@characters[0][5]}"     
    self.contents.draw_text(TEXT_COL1_X, TEXT_LINE2_Y, 128, WLH, level)   
  end
  #--------------------------------------------------------------------------
  # * draw_gold
  #--------------------------------------------------------------------------         
  def draw_gold
    gold = "#{@characters[0][6]} #{Vocab.gold[0,1]}"
    text_x = contents.width - (contents.text_size(gold).width + 6)
    self.contents.draw_text(text_x, TEXT_LINE2_Y, 96, WLH, gold)
  end
  #--------------------------------------------------------------------------
  # * draw_location
  #--------------------------------------------------------------------------
  def draw_location
    loc = @characters[0][7]
    text_y = TEXT_LINE2_Y + 28   
    self.contents.draw_text(308, text_y, contents.width - 312, WLH, loc)
  end
  #--------------------------------------------------------------------------
  # * draw_icons
  #--------------------------------------------------------------------------
  def draw_icons 
    self.contents.blt(TEXT_COL1_X + 93 + FFIXSave::ICON_OFFSET_X,
                      TEXT_LINE1_Y + 7,
                      @timer_image,
                      @timer_image.rect)
    self.contents.blt(TEXT_COL1_X + 93 + FFIXSave::ICON_OFFSET_X,
                      TEXT_LINE2_Y + 7,
                      @gold_image,
                      @gold_image.rect)                     
  end
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  def update_cursor
    # not needed
  end
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  def dispose
    super
    @bg_image.dispose
    @timer_image.dispose
    @arrow_sprite.dispose
  end
 
end
Titel: Re: Nach Speichern direkt im Spiel landen
Beitrag von: Boogatie Roll am Januar 04, 2011, 20:42:51
Ist ganz einfach gewesen,
musste nur was an der scene ändern.
funzt auch:

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     saving     : save flag (if false, load screen)
  #     from_title : flag: it was called from "Continue" on the title screen
  #     from_event : flag: it was called from the "Call Save Screen" event
  #--------------------------------------------------------------------------
  def initialize(saving, from_title, from_event)
    @saving = saving
    @from_title = from_title
    @from_event = from_event
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    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
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    dispose_item_windows
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(4)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    update_savefile_windows
    update_savefile_selection
  end
  #--------------------------------------------------------------------------
  # * Create Save File Window
  #--------------------------------------------------------------------------
  def create_savefile_windows
    @savefile_windows = []
    for i in 0..3
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    @item_max = 4
  end
  #--------------------------------------------------------------------------
  # * Dispose of Save File Window
  #--------------------------------------------------------------------------
  def dispose_item_windows
    for window in @savefile_windows
      window.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Update Save File Window
  #--------------------------------------------------------------------------
  def update_savefile_windows
    for window in @savefile_windows
      window.update
    end
  end
  #--------------------------------------------------------------------------
  # * Update Save File Selection
  #--------------------------------------------------------------------------
  def update_savefile_selection
    if Input.trigger?(Input::C)
      determine_savefile
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    else
      last_index = @index
      if Input.repeat?(Input::DOWN)
        cursor_down(Input.trigger?(Input::DOWN))
      end
      if Input.repeat?(Input::UP)
        cursor_up(Input.trigger?(Input::UP))
      end
      if @index != last_index
        Sound.play_cursor
        @savefile_windows[last_index].selected = false
        @savefile_windows[@index].selected = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Confirm Save File
  #--------------------------------------------------------------------------
  def determine_savefile
    if @saving
      Sound.play_save
      do_save
    else
      if @savefile_windows[@index].file_exist
        Sound.play_load
        do_load
      else
        Sound.play_buzzer
        return
      end
    end
    $game_temp.last_file_index = @index
  end
  #--------------------------------------------------------------------------
  # * Move cursor down
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_down(wrap)
    if @index < @item_max - 1 or wrap
      @index = (@index + 1) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor up
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_up(wrap)
    if @index > 0 or wrap
      @index = (@index - 1 + @item_max) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Create Filename
  #     file_index : save file index (0-3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rvdata"
  end
  #--------------------------------------------------------------------------
  # * Select File With Newest Timestamp
  #--------------------------------------------------------------------------
  def latest_file_index
    index = 0
    latest_time = Time.at(0)
    for i in 0...@savefile_windows.size
      if @savefile_windows[i].time_stamp > latest_time
        latest_time = @savefile_windows[i].time_stamp
        index = i
      end
    end
    return index
  end
  #--------------------------------------------------------------------------
  # * Execute Save
  #--------------------------------------------------------------------------
  def do_save
    file = File.open(@savefile_windows[@index].filename, "wb")
    write_save_data(file)
    file.close
    $scene = Scene_Map.new
   
  end
  #--------------------------------------------------------------------------
  # * Execute Load
  #--------------------------------------------------------------------------
  def do_load
    file = File.open(@savefile_windows[@index].filename, "rb")
    read_save_data(file)
    file.close
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    Graphics.fadeout(60)
    Graphics.wait(40)
    @last_bgm.play
    @last_bgs.play
  end
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index])
    end
    $game_system.save_count += 1
    $game_system.version_id = $data_system.version_id
    @last_bgm = RPG::BGM::last
    @last_bgs = RPG::BGS::last
    Marshal.dump(characters,           file)
    Marshal.dump(Graphics.frame_count, file)
    Marshal.dump(@last_bgm,            file)
    Marshal.dump(@last_bgs,            file)
    Marshal.dump($game_system,         file)
    Marshal.dump($game_message,        file)
    Marshal.dump($game_switches,       file)
    Marshal.dump($game_variables,      file)
    Marshal.dump($game_self_switches,  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
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    characters           = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    @last_bgm            = Marshal.load(file)
    @last_bgs            = Marshal.load(file)
    $game_system         = Marshal.load(file)
    $game_message        = Marshal.load(file)
    $game_switches       = Marshal.load(file)
    $game_variables      = Marshal.load(file)
    $game_self_switches  = 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.version_id != $data_system.version_id
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
  end
end

ersetz  dein altes scene_file durch den neuen code.. :)
Titel: Re: Nach Speichern direkt im Spiel landen
Beitrag von: DimiFW am Januar 05, 2011, 02:05:55
geht wunderbar, danke dir ^^
SimplePortal 2.3.3 © 2008-2010, SimplePortal