XP 스크립트



변경된 시스템?


스샷

참부








======== 여기밑부터

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆2000式セーブ - KGC_2000StyleSave◆
#_/----------------------------------------------------------------------------
#_/ ツクール200xのように、セーブファイル数を増やします。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

module KGC
  # ◆セーブファイル数(必ず 3 以上を指定)
  SAVEFILE_NUMBER = 15
  # ◆セーブファイルに描画する最大人数
  #  ≪多人数パーティ≫を導入していない場合は 4 で固定。
  SAVEFILE_ACTORS = 5
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["2000StyleSave"] = true

#==============================================================================
# ■ Window_SaveFile
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    file_index : セーブファイルのインデックス (0~3)
  #    filename  : ファイル名
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 64 + file_index % KGC::SAVEFILE_NUMBER * 138, 640, 138)
    self.contents = Bitmap.new(width - 32, height - 32)
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @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_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)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
    end
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    # MapInfo.rxdata をロード
    mapinfo = load_data("Data/MapInfos.rxdata")
    self.contents.clear
    # ファイル番号を描画
    self.contents.font.color = normal_color
    name = "ファイル #{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    # セーブファイルが存在する場合
    if @file_exist
      # キャラクターを描画
      x = 116
      actor = @characters[0]
      if actor != nil && actor.is_a?(Game_Actor)
        self.contents.font.size = 20
        draw_actor_name(actor, x, -4)
        draw_actor_level(actor, x, 20)
        draw_actor_hp(actor, x, 44)
        self.contents.font.size = 22
      end
      x = 256
      for i in 0...@characters.size
        actor = @characters[i]
        next if !actor.is_a?(Game_Actor) || actor == nil
        bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
        cw = bitmap.rect.width
        ch = bitmap.rect.height
        src_rect = Rect.new(0, 0, cw, ch)
        dest_rect = Rect.new(x, 0, cw / 2, ch / 2)
        x += dest_rect.width
        self.contents.stretch_blt(dest_rect, bitmap, src_rect)
      end
      # プレイ時間を描画
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.font.color = normal_color
      self.contents.draw_frame_text(4, 0, 600, 32, time_string, 2)
      # タイムスタンプを描画
      self.contents.font.color = normal_color
      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
      self.contents.draw_frame_text(4, 32, 600, 32, time_string, 2)
      if $imported["PlaceMission"]
        # マップ名が無い場合
        if @game_system.place == nil || @game_system.place == ""
          # マップ名を取得
          place = mapinfo[@game_map.map_id].name
        else
          place = @game_system.place
        end
        self.contents.font.color = system_color
        cx = self.contents.text_size("セーブ場所").width
        self.contents.draw_shadow_text(4, 80, cx, 32, "セーブ場所")
        self.contents.font.color = normal_color
        self.contents.draw_shadow_text(8 + cx, 80, 596 - cx, 32, place)
      end
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Title
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_2000StyleSave update
  def update
    # コンティニュー判定
    unless @continue_checked
      for i in 0...KGC::SAVEFILE_NUMBER
        if FileTest.exist?("Save#{i+1}.rxdata")
          found = true
          break
        end
      end
      # セーブファイルが見付かった場合
      if found
        # カーソルをコンティニューに合わせる
        @command_window.index = 1
      end
      @continue_checked = true
    end

    # 元の処理を実行
    update_KGC_2000StyleSave
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  セーブ画面およびロード画面のスーパークラスです。
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  def main
    # ヘルプウィンドウを作成
    @help_window = Window_Help.new
    @help_window.set_text(@help_text)
    # セーブファイルウィンドウを作成
    @savefile_windows = []
    for i in 0...KGC::SAVEFILE_NUMBER
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
      @savefile_windows[i].visible = false
    end
    # ウィンドウ半透明化
    window_alpha if $imported["MenuAlter"] && KGC::MA_MENU_TRANSPARENT
    # 最後に操作したファイルを選択
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    # 初期選択ウィンドウ設定
    i = 0
    if @file_index <= KGC::SAVEFILE_NUMBER - 3
      while i <= 2
        @savefile_windows[@file_index + i].y = 138 * i + 64
        @savefile_windows[@file_index + i].visible = true
        i += 1
        @index_y = 0
      end
    else
      while i <= 2
        @savefile_windows[@file_index - 2 + i].y = 138 * i + 64
        @savefile_windows[@file_index - 2 + i].visible = true
        i += 1
        @index_y = 2
      end
    end
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # ウィンドウを解放
    @help_window.dispose
    for i in @savefile_windows
      i.dispose
    end
    # スプライトを解放
    @spriteset.dispose if @spriteset != nil
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # ウィンドウを更新
    @help_window.update
    for i in @savefile_windows
      i.update
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # メソッド on_decision (継承先で定義) を呼ぶ
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # メソッド on_cancel (継承先で定義) を呼ぶ
      on_cancel
      return
    end
    # 方向ボタンの下が押された場合
    if Input.repeat?(Input::DOWN)
      # 方向ボタンの下の押下状態がリピートでない場合か、
      # またはカーソル位置がファイル個数より前の場合
      if Input.trigger?(Input::DOWN) or @file_index < KGC::SAVEFILE_NUMBER - 1
        # カーソル SE を演奏
        $game_system.se_play($data_system.cursor_se)
        # カーソルを下に移動
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 1) % KGC::SAVEFILE_NUMBER
        @savefile_windows[@file_index].selected = true
        @index_y += 1
        # ウィンドウ移動
        self.move_window
        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 + KGC::SAVEFILE_NUMBER - 1) % KGC::SAVEFILE_NUMBER
        @savefile_windows[@file_index].selected = true
        @index_y -= 1
        # ウィンドウ移動
        self.move_window
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● セーブウィンドウの移動
  #--------------------------------------------------------------------------
  def move_window
    # 普通にカーソル移動した場合
    if @index_y >= 0 && @index_y <= 2
      return
    end
    # スクロールするために全ウィンドウを消去
    for i in 0...KGC::SAVEFILE_NUMBER
      @savefile_windows[i].visible = false
    end
    i = 0
    if @index_y == 3  # 最下段で↓
      if @file_index == 0  # 最上部に移動した場合
        while i <= 2
          @savefile_windows[@file_index + i].y = 138 * i + 64
          @savefile_windows[@file_index + i].visible = true
          i += 1
        end
        @index_y = 0
      else  # 通常移動の場合
        while i <= 2
          @savefile_windows[@file_index - 2 + i].y = 138 * i + 64
          @savefile_windows[@file_index - 2 + i].visible = true
          i += 1
        end
        @index_y = 2
      end
    elsif @index_y == -1  # 最上段で↑
      if @file_index == KGC::SAVEFILE_NUMBER - 1  # 最下部に移動した場合
        while i <= 2
          @savefile_windows[@file_index - 2 + i].y = 138 * i + 64
          @savefile_windows[@file_index - 2 + i].visible = true
          i += 1
        end
        @index_y = 2
      else  # 通常移動の場合
        while i <= 2
          @savefile_windows[@file_index + i].y = 138 * i + 64
          @savefile_windows[@file_index + i].visible = true
          i += 1
        end
        @index_y = 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ半透明化
  #--------------------------------------------------------------------------
  def window_alpha
    # [Scene_Save]で再定義
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Save
#==============================================================================

class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # ● ウィンドウ半透明化
  #--------------------------------------------------------------------------
  def window_alpha
    # スプライトセット作成
    @spriteset = Spriteset_Map.new
    # 各ウィンドウを半透明化
    @help_window.back_opacity = 160
    for window in @savefile_windows
      window.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ● セーブデータの書き込み
  #    file : 書き込み用ファイルオブジェクト (オープン済み)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    # セーブファイル描画用のキャラクターデータを作成
    characters = []
    max = [$game_party.actors.size,
      $imported["LargeParty"] ? KGC::SAVEFILE_ACTORS : 4].min
    for i in 0...max
      characters.push($game_party.actors[i])
    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

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Load
#------------------------------------------------------------------------------
#  ロード画面の処理を行うクラスです。
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # テンポラリオブジェクトを再作成
    $game_temp = Game_Temp.new
    # タイムスタンプが最新のファイルを選択
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0...KGC::SAVEFILE_NUMBER
      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("どのファイルをロードしますか?")
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
1021 아이템 흠..몬스터도감말고 아이템도감~ 9 백호 2009.02.21 2028
1020 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3337
1019 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2980
1018 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3315
1017 기타 회복으로 데미지를 받는 좀비 스크립트 7 백호 2009.02.22 2010
1016 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
1015 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6566
1014 미니맵 화면에 축소된 미니맵을 표시하는 스크립트 - 한글 번역 - 6 file 백호 2009.02.21 2560
1013 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
1012 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2139
1011 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2596
1010 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2529
1009 기타 현재 맵BGM을 그대로 전투 BGM으로 연결 from phylomortis.com 백호 2009.02.22 1180
1008 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1007 메시지 한글자씩 뜨는 스크립트 6 백호 2009.02.21 3004
1006 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11828
1005 키입력 한글입력기(자음, 모음 분리. 아마 중복일 듯...) 11 캉쿤 2011.09.13 3225
1004 키입력 한글입력기 6 백호 2009.02.22 4305
1003 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4211
1002 메시지 한글 채팅 스크립트 32 file こなた 2009.01.22 4947
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52