XP 스크립트

  이전에 작성했던 메뉴 스크립트를 약간 수정해 본 것입니다.  SDK 요구하지 않는 건 안 만들었으므로 쓰실 분은 알아서 변환하시길(dispose라든가 그런 것에 주의한다면 별로 안 어렵습니다).

이전버전 소스: http://save-point.org/thread-2372.html



#============================================================================
#L's Custom Menu - Simple DMS Edit SDK2 ver.
# * Release 2(2013-01-18)
# - Replaced Dubealex's gold display with dragonslayer's simplified form.
# - Edited menu status window to conform party size.
# - Changed map window size and position.
# - And some more...
#============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log("L's CMS", 'Landarma', 'R2', '2013-01-18')

#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1])

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?("L's CMS")

#------Menu Command Configuration
module SDK::Scene_Commands
  #============================================================================
  # ** Scene_Menu
  #============================================================================
  module Scene_Menu
    Item     = 'Item'
    Skill    = 'Skill'
    Equip    = 'Equip'
    Status   = 'Status'
    Save     = 'Save'
    Load     = 'Load'
    End_Game = 'Exit'
    
    Order    = 'Order'
    Party    = 'Party'
    Option   = 'Option'
    Quest    = 'Quest'
    System   = 'System'
    
    Menu_Commands = [Item, Skill, Equip, Status, Order, Party, System]
    SysMenu_Commands = [Option, Save, Load, End_Game]
  end
end

#------------------------


if SDK.enabled?('Map Info')

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

else
#------------
#------------------------------------------------------------------------------
#  Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
#  Name
#------------------------------------------------------------------------------
  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

#-----------------
end

 
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    $game_party.actors.size < 4 ? i = 14 : i = 0
    $game_party.actors.size == 1 ? i = 24 : i = i
    size_height = ($game_party.actors.size * 102)+i
    super(0, 0, 480, size_height)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 96
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 72)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 24)
      draw_actor_state(actor, x + 90, y + 24)
      draw_actor_exp(actor, x, y + 48)
      draw_actor_hp(actor, x + 236, y + 24)
      draw_actor_sp(actor, x + 236, y + 48)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 96, self.width - 32, 84)
    end
  end
end



class Window_Infos < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 130)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)     
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    #---Show Time
    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)
    #---Show Steps
    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)
    #---Show Money
    gold = $game_party.gold.to_s
    unless gold.size > 4
      money = gold
    else
      case gold.size
      when 5
        ary = gold.slice!(0,2)
        money = ary + ","+ gold
      when 6
        ary = gold.slice!(0,3)
        money = ary + ","+ gold
      when 7
        ary1 = gold.slice!(0,4)
        ary2 = ary1.slice!(1,4)
        money = ary1 + ","+ ary2 +","+ gold
      end
    end
    
    self.contents.font.color = normal_color     
    cx = contents.text_size($data_system.words.gold).width    
    self.contents.draw_text(4, 67, 120-cx-2, 32, money, 2)
    self.contents.font.color = system_color 
    self.contents.draw_text(124-cx, 67, cx, 32, $data_system.words.gold, 2)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  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, 480, 64)
   self.contents = Bitmap.new(width - 32, height - 32)   
   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, 0, 160, 32, $game_map.name, 2)
 end
end


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu < SDK::Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    party_order_init
  end
  #--------------------------------------------------------------------------
  # * Party Order Change Initiation
  #--------------------------------------------------------------------------
  def party_order_init
    @changer = 0 #Change Party Order by Yargovish
    @where = 0 #
    @checker = 0  #
  end
  #--------------------------------------------------------------------------
  # * Main Processing : Spriteset Initialization
  #--------------------------------------------------------------------------
  def main_spriteset  
    #Draw Background
    @background = Spriteset_Map.new
  end
  #--------------------------------------------------------------------------
  # * Main Processing : Window Initialization
  #--------------------------------------------------------------------------
  def main_window
    super
    # Make main command window
    main_command_window
    system_command_window
    # Make Info Window
    @infos_window = Window_Infos.new
    @infos_window.x = 0
    @infos_window.y = 350
    @infos_window.opacity = 160
    # Make map name window
    @mapname_window = Window_MapName.new
    @mapname_window.x = 160
    @mapname_window.y = 416
    @mapname_window.opacity = 160
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    @status_window.opacity = 160
  end
  #--------------------------------------------------------------------------
  # * Main Processing : Window Initialization : Main Command
  #--------------------------------------------------------------------------
  def main_command_window
    # Make command window
    command = SDK::Scene_Commands::Scene_Menu::Menu_Commands.dup
    @command_window = Window_Command.new(160, command)
    @command_window.opacity = 160
    @command_window.index = @menu_index
    if @command_window.height > 256
      @command_window.height = 256
    end
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_party.actors.size <= 1 #
      #Disable change party order
      @command_window.disable_item(4)
    end
  end
  #--------------------------------------------------------------------------
  # * Main Processing : Window Initialization : System Command
  #--------------------------------------------------------------------------
  def system_command_window
    # Make command window
    sys_command = SDK::Scene_Commands::Scene_Menu::SysMenu_Commands.dup
    @sys_command_window = Window_Command.new(128, sys_command)
    @sys_command_window.visible = false
    @sys_command_window.active = false
    @sys_command_window.x = 100
    @sys_command_window.y = 180
    @sys_command_window.opacity = 160
    #@sys_command_window.z = 0
    check_save_available
    check_load_available
  end
  #-----------------
  def check_save_available
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @sys_command_window.disable_item(1)
    end
  end
  #-----------------
  def check_load_available
    #Check if saved file exists
    @load_enabled = (Dir.glob('Save*.rxdata').size > 0)
    if !@load_enabled
      #Put your @command_window.disable_item(index)
      @sys_command_window.disable_item(2)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    # If status window is active: call update_status
    elsif @status_window.active
      update_status
      return
    end
    
    if @sys_command_window.active
      @sys_command_window.z = +500
    end
    # If system window is active: call update_sys_command
    if @sys_command_window.active
      update_sys_command
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Return if Disabled Command
      if disabled_main_command?
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Command Input
      main_command_input
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update SysCommand Window
  #--------------------------------------------------------------------------
  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.visible = false
      @sys_command_window.index = 0
      @sys_command_window.z = -500
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Return if Disabled Command
      if disabled_main_command?
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Command Input
      sys_command_input
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Return if Disabled Command
      if disabled_main_command?
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Command Input
      sub_command_input
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Disabled Main Command? Test
  #--------------------------------------------------------------------------
  def disabled_main_command?
    # Gets Current Command
    command = @command_window.command
    sys_command = @sys_command_window.command
    # Gets SDK Scene_Menu Commands
    c = SDK::Scene_Commands::Scene_Menu
    # If 0 Party Size
    if $game_party.actors.size == 0
      # If Item, Skill, Equip or Status Selected
      if [c::Item, c::Skill, c::Equip, c::Status].include?(command)
        return true
      end
    end
    if $game_party.actors.size <= 1
      if [c::Order].include?(command)
        return true
      end
    end
    # If Save Disabled && Command is Save
    return true if $game_system.save_disabled && sys_command == c::Save
    # If Load Disabled && Command is Load
    return true if !@load_enabled && sys_command == c::Load
    return false
  end
  #--------------------------------------------------------------------------
  # * Main Command Input
  #--------------------------------------------------------------------------
  def main_command_input
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Branch by command window cursor position
    case @command_window.command
    when SDK::Scene_Commands::Scene_Menu::Item      # item
      command_item
    when SDK::Scene_Commands::Scene_Menu::Skill     # skill
      command_skill
    when SDK::Scene_Commands::Scene_Menu::Equip     # equipment
      command_equip
    when SDK::Scene_Commands::Scene_Menu::Status    # status
      command_status
    when SDK::Scene_Commands::Scene_Menu::Order      # order
      command_order
    when SDK::Scene_Commands::Scene_Menu::Party      # party
      command_party
    when SDK::Scene_Commands::Scene_Menu::Option    #option
      command_option
    when SDK::Scene_Commands::Scene_Menu::System  # call system menu      
      $game_system.se_play($data_system.decision_se)
      @sys_command_window.active = true
      @sys_command_window.visible = true
      @command_window.active = false   
    end
  end
  #--------------------------------------------------------------------------
  # * System Command Input
  #--------------------------------------------------------------------------
  def sys_command_input
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Branch by command window cursor position
    case @sys_command_window.command
    when SDK::Scene_Commands::Scene_Menu::Save  #save
      command_save
    when SDK::Scene_Commands::Scene_Menu::Load  #load
      command_load
    when SDK::Scene_Commands::Scene_Menu::End_Game  #end game
      command_endgame
    when SDK::Scene_Commands::Scene_Menu::Option    #option
      command_option
    end
  end
  #--------------------------------------------------------------------------
  # * Disabled Sub Command? Test
  #--------------------------------------------------------------------------
  def disabled_sub_command?
    # If Skill Selected
    if @command_window.command == SDK::Scene_Commands::Scene_Menu::Skill
      # If this actor's action limit is 2 or more
      if $game_party.actors[@status_window.index].restriction >= 2
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Sub Command Input
  #--------------------------------------------------------------------------
  def sub_command_input
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Branch by command window cursor position
    case @command_window.command
    when SDK::Scene_Commands::Scene_Menu::Skill     # skill
      command_skill
    when SDK::Scene_Commands::Scene_Menu::Equip     # equipment
      command_equip
    when SDK::Scene_Commands::Scene_Menu::Status    # status
      command_status
    when SDK::Scene_Commands::Scene_Menu::Order      # order
      command_order
    end
  end
  #--------------------------------------------------------------------------
  # * Command : Item
  #--------------------------------------------------------------------------
  def command_item
    # Switch to item screen
    $scene = Scene_Item.new
  end
  #--------------------------------------------------------------------------
  # * Command : Skill
  #--------------------------------------------------------------------------
  def command_skill
    # If Main Command Active
    if @command_window.active
      # Activate Status Window
      active_status_window
      return
    end
    # Switch to skill screen
    $scene = Scene_Skill.new(@status_window.index)
  end
  #--------------------------------------------------------------------------
  # * Command : Equip
  #--------------------------------------------------------------------------
  def command_equip
    # If Main Command Active
    if @command_window.active
      # Activate Status Window
      active_status_window
      return
    end
    # Switch to equipment screen
    $scene = Scene_Equip.new(@status_window.index)
  end
  #--------------------------------------------------------------------------
  # * Command : Status
  #--------------------------------------------------------------------------
  def command_status
    # If Main Command Active
    if @command_window.active
      # Activate Status Window
      active_status_window
      return
    end
    # Switch to status screen
    $scene = Scene_Status.new(@status_window.index)
  end
  #--------------------------------------------------------------------------
  # * Command : Order
  #--------------------------------------------------------------------------
  def command_order
    # If Main Command Active
    if @command_window.active
      # Activate Status Window
      active_status_window
      @checker = 0
      return
    end
    #Change Party Order by Yargovish
    if @checker == 0
      @changer = $game_party.actors[@status_window.index]
      @where = @status_window.index
      @checker = 1
    else
      $game_party.actors[@where] = $game_party.actors[@status_window.index]
      $game_party.actors[@status_window.index] = @changer
      @checker = 0
      @status_window.refresh
      $game_player.refresh #
    end      
  end
  #--------------------------------------------------------------------------
  # * Command : Party
  #--------------------------------------------------------------------------
  def command_party
    # Switch to party change screen
    #Put your Party Change Scene here
  end
  #--------------------------------------------------------------------------
  # * Command : Option
  #--------------------------------------------------------------------------
  def command_option
    # Switch to option screen
    #Put your Option Scene here
  end
  #--------------------------------------------------------------------------
  # * Command : Quest
  #--------------------------------------------------------------------------
  def command_quest
    # Switch to quest screen
    #Put your Quest Scene here
  end
  #--------------------------------------------------------------------------
  # * Command : Save
  #--------------------------------------------------------------------------
  def command_save
    # Switch to save screen
    $scene = Scene_Save.new
  end
  #--------------------------------------------------------------------------
  # * Command : Load
  #--------------------------------------------------------------------------
  def command_load
    # Switch to load screen
    $scene = Scene_Load.new
  end
  #--------------------------------------------------------------------------
  # * Command : End Game
  #--------------------------------------------------------------------------
  def command_endgame
    # Switch to end game screen
    $scene = Scene_End.new
  end
  #--------------------------------------------------------------------------
  # * Activate Status Window
  #--------------------------------------------------------------------------
  def active_status_window
    # Make status window active
    @command_window.active = false
    @status_window.active = true
    @status_window.index = 0
  end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end



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 4306
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