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
701 기타 쓸 용도가 없지만 마비노기 게임 만들 때 좋죠[장작스크립트] 5 백호 2009.02.22 2407
700 기타 레벨을 표시해주는 스크립트 5 백호 2009.02.22 2403
699 오디오 CG, 음악 감상 스크립트 [한글화] 11 file 백호 2009.02.21 2403
698 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
697 이동 및 탈것 텔레포트 스크립트. 11 XP광 2010.01.12 2392
696 파티 파티교환 시스템...이걸로 순서 교체도 가능할 듯... 9 file 백호 2009.02.21 2392
695 HUD HUD Menu 1.2 by Raziel 6 file 백호 2009.02.22 2390
694 기타 거울에 캐릭 반사 20 ok하승헌 2010.02.18 2388
693 HUD 맵이름표시 6 캉쿤 2011.09.14 2380
692 전투 전투후 경험치 분배와 레벨업시 HP/SP 전회복 15 백호 2009.02.21 2374
691 전투 Active Time Battle 2.57 by パラ犬 6 file 백호 2009.02.22 2371
690 이동 및 탈것 이거만드느라 똥줄탓다!(는뻥) 초간단스크립트 10 *PS인간 2009.02.10 2369
689 이동 및 탈것 하이 대쉬 시스템 ver.1.0 15 백호 2009.02.22 2364
688 메뉴 자세항 개인 상태화면 8 아방스 2009.01.12 2361
687 메뉴 L's Custom Menu #3: 1인용 메뉴 Revision 1 3 Alkaid 2010.09.12 2360
686 메뉴 메뉴 변경 스크립트 2 file 백호 2009.02.21 2359
685 장비 에러 안나는 장비창 전능력 표시 스크립트... 3 백호 2009.02.21 2352
» 메뉴 자작 커스텀 메뉴(데모 첨부) 3 백호 2009.02.22 2347
683 점프 대쉬 스크립트 11 WMN 2008.03.17 2345
682 메뉴 Breath Of Fire 스타일의 메뉴 3 file 백호 2009.02.21 2342
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ... 52 Next
/ 52