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
601 파티 메뉴커맨드로 파티 멤버들 순서 바꾸기 by Yargovish 1 백호 2009.02.22 1620
600 오디오 WinAMP 플러그인을 이용하여 RMXP에서 다른 형식의 음악파일 재생하기 file 백호 2009.02.22 1259
599 기타 아래 스크립트에 대한 Guillaume777님의 개량판입니다. 백호 2009.02.22 880
598 아이템 아이템을 얻으면 자동으로 아이템 입수 메세지윈도우 띄우기 4 백호 2009.02.22 2279
» 메뉴 자작 커스텀 메뉴(데모 첨부) 3 백호 2009.02.22 2348
596 메뉴 KGC 메뉴화면 개조 스크립트 번역 3 file 백호 2009.02.22 1941
595 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
594 장비 Multi-equip script ver.6 by Guillaume777 4 file 백호 2009.02.22 1210
593 기타 일시정지 스크립트 2 file 백호 2009.02.22 1796
592 아이템 아이템 인벤토리 2 file 백호 2009.02.22 3356
591 기타 Weather Script 1.02 by ccoa 1 file 백호 2009.02.22 809
590 메시지 Animated Window Skin by Tana 1 백호 2009.02.22 1338
589 스킬 Skill Shop by SephirothSpawn file 백호 2009.02.22 813
588 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
587 그래픽 Bitmap update 2.0 by Linkin_T 1 백호 2009.02.22 985
586 기타 ABS 몬스터 HP 게이지 바 11 백호 2009.02.22 2485
585 맵/타일 Map Event Large Make 2 백호 2009.02.22 1132
584 기타 파노라마 스크롤 스크립트 개량판 by Guillaume777 1 백호 2009.02.22 896
583 HUD 맵 이름 표시 by Slipknot@rmxp.net (SDK호환) 2 백호 2009.02.22 1463
582 기타 제작한 게임의 파일을 모두 exe파일 하나에 쓸어담기 by sheefo@Creation Asylum 1 file 백호 2009.02.22 1239
Board Pagination Prev 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ... 52 Next
/ 52