XP 스크립트

Note: 스크립트에 있는 메뉴 명령 중 Order(캐릭터 순서 변경)와 Party Change(추가멤버가 있을 경우 파티 재편성), Option은 더미입니다.  데모에 있는 옵션 페이지는 설정항목을 선택할 수 있지만 실제로는 반영되지 않는 더미입니다.

#==============================================================================
# ■ Game_Map
#==============================================================================
  class Game_Map       
  def name
    $map_infos[@map_id]
  end 
end


#========================================
#■ Scene_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
  $map_infos = load_data("Data/MapInfos.rxdata")
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end


class Window_Infos < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 130)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype  # "Play Time" window font
    self.contents.font.size = $defaultfontsize
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Time")
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, text, 2)
   
    self.contents.font.color = system_color
    self.contents.draw_text(4, 25, 120, 32, "Steps")
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 42, 120, 32, $game_party.steps.to_s, 2)
   
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 67, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 67, cx, 32, $data_system.words.gold, 2)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end



class Window_MapName < Window_Base
 def initialize
  super(0, 0, 160, 96)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype
  self.contents.font.size = $defaultfontsize
  refresh
 end
 def refresh
  self.contents.clear
  self.contents.font.color = system_color
  self.contents.draw_text(4, 0, 120, 32, "Location")
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 32, 120, 32, $game_map.name.to_s, 2)
 end
end



#===================================================
# - CLASS Window_Syscommand Begins
#===================================================

class Window_SysCommand  < Window_Selectable

#---------------------------------------------------------------------------------   
  def initialize(width, commands)
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
    self.index = 0
  end
#--------------------------------------------------------------------------------- 
#--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #    color : 文字色
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● 項目の無効化
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end

end
#===================================================
# - CLASS Window_Syscommand  Ends
#===================================================


#==============================================================================
# ■ Scene_Load2 - 기존의 Scene_Load를 복사해서 취소시 메뉴로 돌아가게 변경
#------------------------------------------------------------------------------
#  ロード画面の処理を行うクラスです。
#==============================================================================

class Scene_Load2 < Scene_File
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # テンポラリオブジェクトを再作成
    $game_temp = Game_Temp.new
    # タイムスタンプが最新のファイルを選択
    $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, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Load from which slot?")
  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)
    file.close
    # BGM、BGS を復帰
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    # マップを更新 (並列イベント実行)
    $game_map.update
    # マップ画面に切り替え
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # ● キャンセル時の処理
  #--------------------------------------------------------------------------
  def on_cancel
    # キャンセル SE を演奏
    $game_system.se_play($data_system.cancel_se)
    # タイトル画面に切り替え
    $scene = Scene_Menu.new(6)
  end
  #--------------------------------------------------------------------------
  # ● セーブデータの読み込み
  #    file : 読み込み用ファイルオブジェクト (オープン済み)
  #--------------------------------------------------------------------------
  def read_save_data(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_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)
    $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)
    end
    # パーティメンバーをリフレッシュ
    $game_party.refresh
  end
end


#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  メニュー画面の処理を行うクラスです。
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    menu_index : コマンドのカーソル初期位置
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @changer = 0 #Change Party Order by Yargovish
    @where = 0 #
    @checker = 0  #
  end
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  def main
    # コマンドウィンドウを作成
    s1 = "Item"
    s2 = "Skill"
    s3 = "Equip"
    s4 = "Status"
    s5 = "Order"
    s6 = "Party Change"
    s7 = "System"
   
    o1 = "Option"
    o2 = "Save"
    o3 = "Load"
    o4 = "Exit"
   
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # パーティ人数が 0 人の場合
    if $game_party.actors.size == 0
      # アイテム、スキル、装備、ステータスを無効化
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # セーブ禁止の場合
    #if $game_system.save_disabled
      # セーブを無効にする
      #@command_window.disable_item(4)     
    #end
    if $game_party.actors.size <= 1 #
      @command_window.disable_item(4)
    end
    if $game_party.actors.size <= 4
      @command_window.disable_item(5)
    end #
    @sys_command_window = Window_SysCommand.new(128, [o1, o2, o3, o4])
    @sys_command_window.active = false
    @sys_command_window.x = 100
    @sys_command_window.y = 210
    @sys_command_window.z = 0
    if $game_system.save_disabled
      @sys_command_window.disable_item(1)
    end
   
    @infos_window = Window_Infos.new
    @infos_window.x = 0
    @infos_window.y = 255
   
    @mapname_window = Window_MapName.new
    @mapname_window.x = 0
    @mapname_window.y = 384
    # ステータスウィンドウを作成
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0   
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # ウィンドウを解放
    @command_window.dispose
    @sys_command_window.dispose
    @infos_window.dispose
    @mapname_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # ウィンドウを更新
    @command_window.update
    @infos_window.update
    @status_window.update
    @mapname_window.update
    @sys_command_window.update
   
    if @sys_command_window.active
      @sys_command_window.z = 500
    end
   
    # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
    if @command_window.active
      update_command
      return
    end
    if @sys_command_window.active
      update_sys_command
      return
    end
    # ステータスウィンドウがアクティブの場合: update_status を呼ぶ
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_command
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # マップ画面に切り替え
      $scene = Scene_Map.new
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
      if $game_party.actors.size == 0 and @command_window.index < 4
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if $game_party.actors.size <= 1 and @command_window.index == 4 #
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if $game_party.actors.size <= 4 and @command_window.index == 5 #
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # コマンドウィンドウのカーソル位置で分岐
      case @command_window.index
      when 0  # アイテム
        # 決定  SE を演奏
        $game_system.se_play($data_system.decision_se)
        # アイテム画面に切り替え
        $scene = Scene_Item.new
      when 1  # スキル
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # ステータスウィンドウをアクティブにする
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # 装備
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # ステータスウィンドウをアクティブにする
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # ステータス
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # ステータスウィンドウをアクティブにする
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4
      when 5
      when 6
        $game_system.se_play($data_system.decision_se)
        @sys_command_window.active = true
        @command_window.active = false       
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_status
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # コマンドウィンドウをアクティブにする
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # コマンドウィンドウのカーソル位置で分岐
      case @command_window.index
      when 1  # スキル
        # このアクターの行動制限が 2 以上の場合
        if $game_party.actors[@status_window.index].restriction >= 2
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # スキル画面に切り替え
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # 装備
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # 装備画面に切り替え
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # ステータス
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # ステータス画面に切り替え
        $scene = Scene_Status.new(@status_window.index)
      when 4
      end
      return
    end
  end
 
  def update_sys_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @sys_command_window.active = false
      @sys_command_window.index = 0
      @sys_command_window.z = 0
      return
    end
   
    if Input.trigger?(Input::C)
      case @sys_command_window.index
      when 0
      when 1
        # セーブ禁止の場合
        if $game_system.save_disabled
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # セーブ画面に切り替え
        $scene = Scene_Save.new
      when 2
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # セーブ画面に切り替え
        $scene = Scene_Load2.new
      when 3
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # ゲーム終了画面に切り替え
        $scene = Scene_End.new
      end
      return
    end
  end 
end


**첨부한 데모는 자작 메뉴 외 여기저기서 퍼온 스크립트들을 시연하도록 자작한 것입니다.(주: 1.02a로 작성)

 

 

102a_Test_Project.exe

TAG •

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
88 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
87 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2591
86 메뉴 플레이 시간 윈도우 개조 file 백호 2009.02.21 1328
85 메뉴 파이널 판타지 7 스타일 메뉴 7 아방스 2009.01.12 3237
84 메뉴 콤보 스크립트 백호 2009.02.22 1399
83 메뉴 제가추천하는 메뉴스크립트 11 file 백호 2009.02.22 5298
82 메뉴 제가 쓰는 메뉴 14 file 백호 2009.02.21 2318
81 메뉴 제가 쓰고있는 메뉴 13 file 백호 2009.02.21 3028
» 메뉴 자작 커스텀 메뉴(데모 첨부) 3 백호 2009.02.22 2347
79 메뉴 자작 메뉴 스크립트들(L's Simple CMS and menu scenes) (SDK 호환?) 10 Alkaid 2010.09.02 3455
78 메뉴 자세항 개인 상태화면 8 아방스 2009.01.12 2361
77 메뉴 자세한 캐릭터 정보표시 스크립트 버전2 5 아방스 2009.01.12 2328
76 메뉴 온라인메뉴처럼!! 메이플 메뉴처럼!! 변신~스크립트 33 WMN 2008.03.17 6815
75 메뉴 스테이터스 화면에 넥스트 표시 1 file 백호 2009.02.21 1758
74 메뉴 스테이터스 화면 from Harts Horn 2 백호 2009.02.22 1571
73 메뉴 스테이터스 일람 스크립트 file 백호 2009.02.21 1328
72 메뉴 스탯올리기 시스템 (액알가능) 27 file 백호 2009.02.22 3403
71 메뉴 수정, 추가 링메뉴 10 file 백호 2009.02.22 2912
70 메뉴 새로운 메뉴 시스템 을 한글화 및 약간 개조 3 file 백호 2009.02.21 2203
69 메뉴 새로운 메뉴 15 file 또라에몽 2010.07.17 5302
Board Pagination Prev 1 2 3 4 5 Next
/ 5