VX 스크립트

KGC에서 가져온 확장장비창스크립트입니다.
우선적으로 필요한 부분(메뉴창에서 일본어로 표시되는부분)만
한글로 약간씩 바꿨고,
기능은 장비창에 들어가면 장비, 현재가지고있는 최고의 무기를 장착, 모두 해제중
선택을 하는 형식으로 되어있습니다.
아래서부터 복사

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ 拡張装備画面 - KGC_ExtendedEquipScene ◆ VX ◆
#_/    ◇ Last update : 2009/02/15 ◇
#_/----------------------------------------------------------------------------
#_/  機能を強化した装備画面を作成します。
#_/============================================================================
#_/ 【基本機能】≪ヘルプウィンドウ機能拡張≫ より下に導入してください。
#_/ 【装備】≪スキル習得装備≫ より下に導入してください。
#_/ 【装備】≪装備拡張≫ より上に導入してください。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$data_system = load_data("Data/System.rvdata") if $data_system == nil

#==============================================================================
# ★ カスタマイズ項目 - Customize BEGIN ★
#==============================================================================

module KGC
module ExtendedEquipScene
  # ◆ パラメータ名
  VOCAB_PARAM = {
    :hit => "명중율",        # 命中率
    :eva => "회피율",        # 回避率
    :cri => "크리티컬 확률",  # クリティカル率
  }  # ← この } は消さないこと!

  # ◆ 装備変更時に表示するパラメータ
  #  表示したい順に , で区切って記入。
  #  :maxhp .. 최대 HP
  #  :maxmp .. 최대 MP
  #  :atk   .. 공격력
  #  :def   .. 방어력
  #  :spi   .. 정신력
  #  :agi   .. 민첩성
  #  :hit   .. 명중률
  #  :eva   .. 회피율
  #  :cri   .. 치명타율
  EQUIP_PARAMS = [ :atk, :def, :spi, :agi, :hit, :eva, :cri ]

  # ◆ 拡張装備コマンドを使用する
  #  true  : 「최강장비」「모두제거」명령사용 가능
  #  false : 装備変更のみ
  USE_COMMAND_WINDOW = true
  # ◆ 装備画面のコマンド名
  COMMANDS = [
    "장비변경",    # 장비변경
    "최강장비",    # 최강장비
    "모두제거",  # 모두제거
  ]  # ← この ] は消さないこと!
  # ◆ 装備画面コマンドのヘルプ
  COMMAND_HELP = [
    "장비를 변경합니다.",            # 装備変更
    "가장 강력한 무구를 제공합니다.",  # 最強装備
    "모든 무구를 제거합니다.",      # すべて外す
  ]  # ← この ] は消さないこと!

  # ◆ 最強装備を行わない装備種別
  #  最強装備から除外する装備種別を記述。
  #  -1..武器  0..盾  1..頭  2..身体  3..装飾品  4~..≪装備拡張≫ で定義
  IGNORE_STRONGEST_KIND = [3, 5]

  # ◆ 最強武器選択時のパラメータ優先順位
  #  優先順位の高い順に , で区切って記入。
  #  :atk .. 공격력
  #  :def .. 방어력
  #  :spi .. 정신력
  #  :agi .. 민첩성
  STRONGEST_WEAPON_PARAM_ORDER = [ :atk, :spi, :agi, :def ]
  # ◆ 最強防具選択時のパラメータ優先順位
  #  指定方法は武器と同じ。
  STRONGEST_ARMOR_PARAM_ORDER  = [ :def, :spi, :agi, :atk ]

  # ◆ AP ウィンドウを使用する
  #  true  : 使用する
  #  false : 使用しない
  #  ≪スキル習得装備≫ 併用時のみ有効。
  SHOW_AP_WINDOW    = true
  # ◆ AP ウィンドウに表示するスキル数
  #  多くしすぎすると表示がバグります。
  #  (4 以下を推奨)
  AP_WINDOW_SKILLS  = 4
  # ◆ AP ウィンドウの習得スキル名のキャプション
  AP_WINDOW_CAPTION = "습득#{Vocab.skill}"
  # ◆ AP ウィンドウの表示切り替えボタン
  #  このボタンを押すと、AP ウィンドウの表示/非表示が切り替わる。
  AP_WINDOW_BUTTON  = Input::X
end
end

#==============================================================================
# ☆ カスタマイズ項目 終了 - Customize END ☆
#==============================================================================

$imported = {} if $imported == nil
$imported["ExtendedEquipScene"] = true

module KGC::ExtendedEquipScene
  # パラメータ取得用 Proc
  GET_PARAM_PROC = {
    :atk => Proc.new { |n| n.atk },
    :def => Proc.new { |n| n.def },
    :spi => Proc.new { |n| n.spi },
    :agi => Proc.new { |n| n.agi },
  }
  # 最強アイテム用構造体
  StrongestItem = Struct.new("StrongestItem", :index, :item)
end

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

#==============================================================================
# ■ Vocab
#==============================================================================

module Vocab
  # 命中率
  def self.hit
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:hit]
  end

  # 回避率
  def self.eva
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:eva]
  end

  # クリティカル率
  def self.cri
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:cri]
  end
end

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

#==============================================================================
# □ Window_ExtendedEquipCommand
#------------------------------------------------------------------------------
#   拡張装備画面で、実行する操作を選択するウィンドウです。
#==============================================================================

class Window_ExtendedEquipCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(160, KGC::ExtendedEquipScene::COMMANDS)
    self.active = false
    self.z = 1000
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(KGC::ExtendedEquipScene::COMMAND_HELP[self.index])
  end
end

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

#==============================================================================
# □ Window_EquipBaseInfo
#------------------------------------------------------------------------------
#   装備画面で、アクターの基本情報を表示するウィンドウです。
#==============================================================================

class Window_EquipBaseInfo < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x     : ウィンドウの X 座標
  #     y     : ウィンドウの Y 座標
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, Graphics.width / 2, WLH + 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 0, 0)
    # EP 制を使用する場合は EP を描画
    if $imported["EquipExtension"] && KGC::EquipExtension::USE_EP_SYSTEM
      draw_actor_ep(@actor, 116, 0, Graphics.width / 2 - 148)
    end
  end
end

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

#==============================================================================
# ■ Window_Equip
#==============================================================================

class Window_Equip < Window_Selectable

  unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW

  #--------------------------------------------------------------------------
  # ● カーソルを 1 ページ後ろに移動
  #--------------------------------------------------------------------------
  def cursor_pagedown
    return if Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ● カーソルを 1 ページ前に移動
  #--------------------------------------------------------------------------
  def cursor_pageup
    return if Input.repeat?(Input::L)
    super
  end

  end  # <-- unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW

  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      Sound.play_cursor
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      Sound.play_cursor
      cursor_pageup
    end
  end
end

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

#==============================================================================
# ■ Window_EquipItem
#==============================================================================

class Window_EquipItem < Window_Item
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x          : ウィンドウの X 座標
  #     y          : ウィンドウの Y 座標
  #     width      : ウィンドウの幅
  #     height     : ウィンドウの高さ
  #     actor      : アクター
  #     equip_type : 装備部位
  #--------------------------------------------------------------------------
  alias initialize_KGC_ExtendedEquipScene initialize
  def initialize(x, y, width, height, actor, equip_type)
    width = Graphics.width / 2

    initialize_KGC_ExtendedEquipScene(x, y, width, height, actor, equip_type)

    @column_max = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KGC_ExtendedEquipScene refresh  unless $@
  def refresh
    return if @column_max == 2  # 無駄な描画はしない

    refresh_KGC_ExtendedEquipScene
  end
end

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

#==============================================================================
# □ Window_ExtendedEquipStatus
#------------------------------------------------------------------------------
#   拡張装備画面で、アクターの能力値変化を表示するウィンドウです。
#==============================================================================

class Window_ExtendedEquipStatus < Window_EquipStatus
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_writer   :equip_type               # 装備タイプ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x     : ウィンドウの X 座標
  #     y     : ウィンドウの Y 座標
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    @equip_type = -1
    @caption_cache = nil
    super(x, y, actor)
    @new_item = nil
    @new_param = {}
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    @caption_cache.dispose if @caption_cache != nil
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ内容の作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(Graphics.width / 2 - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    return if @equip_type < 0

    if @caption_cache == nil
      create_cache
    else
      self.contents.clear
      self.contents.blt(0, 0, @caption_cache, @caption_cache.rect)
    end
    draw_item_name(@actor.equips[@equip_type], 0, 0)
    draw_item_name(@new_item, 24, WLH)
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each_with_index { |param, i|
      draw_parameter(0, WLH * (i + 2), param)
    }
  end
  #--------------------------------------------------------------------------
  # ○ キャッシュ生成
  #--------------------------------------------------------------------------
  def create_cache
    create_contents

    self.contents.font.color = system_color
    self.contents.draw_text(0, WLH, 20, WLH, "→")
    # パラメータ描画
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each_with_index { |param, i|
      draw_parameter_name(0, WLH * (i + 2), param)
    }

    @caption_cache = Bitmap.new(self.contents.width, self.contents.height)
    @caption_cache.blt(0, 0, self.contents, self.contents.rect)
  end
  #--------------------------------------------------------------------------
  # ○ 能力値名の描画
  #     x    : 描画先 X 座標
  #     y    : 描画先 Y 座標
  #     type : 能力値の種類
  #--------------------------------------------------------------------------
  def draw_parameter_name(x, y, type)
    case type
    when :maxhp
      name = Vocab.hp
    when :maxmp
      name = Vocab.mp
    when :atk
      name = Vocab.atk
    when :def
      name = Vocab.def
    when :spi
      name = Vocab.spi
    when :agi
      name = Vocab.agi
    when :hit
      name = Vocab.hit
    when :eva
      name = Vocab.eva
    when :cri
      name = Vocab.cri
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 96, WLH, name)
    self.contents.font.color = system_color
    self.contents.draw_text(x + 156, y, 20, WLH, "→", 1)
  end
  #--------------------------------------------------------------------------
  # ● 装備変更後の能力値設定
  #     new_param : 装備変更後のパラメータの配列
  #     new_item  : 変更後の装備
  #--------------------------------------------------------------------------
  def set_new_parameters(new_param, new_item)
    changed = false
    # パラメータ変化判定
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each { |k|
      if @new_param[k] != new_param[k]
        changed = true
        break
      end
    }
    changed |= (@new_item != new_item)

    if changed
      @new_item = new_item
      @new_param = new_param
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 能力値の描画
  #     x    : 描画先 X 座標
  #     y    : 描画先 Y 座標
  #     type : 能力値の種類
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type)
    case type
    when :maxhp
      value = @actor.maxhp
    when :maxmp
      value = @actor.maxmp
    when :atk
      value = @actor.atk
    when :def
      value = @actor.def
    when :spi
      value = @actor.spi
    when :agi
      value = @actor.agi
    when :hit
      value = @actor.hit
    when :eva
      value = @actor.eva
    when :cri
      value = @actor.cri
    end
    new_value = @new_param[type]
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 106, y, 48, WLH, value, 2)
    if new_value != nil
      self.contents.font.color = new_parameter_color(value, new_value)
      self.contents.draw_text(x + 176, y, 48, WLH, new_value, 2)
    end
  end
end

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

#==============================================================================
# □ Window_ExtendedEquipAPViewer
#------------------------------------------------------------------------------
#   拡張装備画面で、習得スキルを表示するウィンドウです。
#==============================================================================

if $imported["EquipLearnSkill"]
class Window_ExtendedEquipAPViewer < Window_APViewer
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :item                     # 表示対象のアイテム
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x      : ウィンドウの X 座標
  #     y      : ウィンドウの Y 座標
  #     width  : ウィンドウの幅
  #     height : ウィンドウの高さ
  #     actor  : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    @item = nil
    super
    self.index = -1
    self.active = false
  end
  #--------------------------------------------------------------------------
  # ○ アイテム設定
  #--------------------------------------------------------------------------
  def item=(new_item)
    @item = new_item
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    @can_gain_ap_skills = @actor.can_gain_ap_skills
    @equipment_skills = @actor.equipment_skills(true)

    skills = (@item == nil ? [] : @item.learn_skills)
    skills.each { |i|
      @data << $data_skills[i]
    }
    @item_max = @data.size
    create_contents
    draw_caption
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ○ キャプションを描画
  #--------------------------------------------------------------------------
  def draw_caption
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, width - 96, WLH,
      KGC::ExtendedEquipScene::AP_WINDOW_CAPTION, 1)
    self.contents.draw_text(width - 96, 0, 64, WLH, Vocab.ap, 1)
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ○ スキルをマスク表示するかどうか
  #     skill : スキル
  #--------------------------------------------------------------------------
  def mask?(skill)
    return false
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    rect.y += WLH
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      draw_item_name(skill, rect.x, rect.y)
      if skill.need_ap > 0
        if @actor.ap_full?(skill) || @actor.skill_learn?(skill)
          # マスター
          text = Vocab.full_ap_skill
        else
          # AP 蓄積中
          text = sprintf("%4d/%4d", @actor.skill_ap(skill.id), skill.need_ap)
        end
      end
      # AP を描画
      rect.x = rect.width - 80
      rect.width = 80
      self.contents.font.color = normal_color
      self.contents.draw_text(rect, text, 2)
    end
  end
end
end  # <-- if $imported["EquipLearnSkill"]

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

#==============================================================================
# ■ Scene_Equip
#==============================================================================

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  STANDARD_WIDTH  = Graphics.width / 2
  ANIMATION_SPPED = 8
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias start_KGC_ExtendedEquipScene start
  def start
    start_KGC_ExtendedEquipScene

    # ステータスウィンドウを作り直す
    @status_window.dispose
    @status_window = Window_ExtendedEquipStatus.new(0, 0, @actor)

    create_command_window

    @last_item = RPG::Weapon.new
    @base_info_window = Window_EquipBaseInfo.new(
      0, @help_window.height, @actor)

    if $imported["EquipLearnSkill"] && KGC::ExtendedEquipScene::SHOW_AP_WINDOW
      @ap_window = Window_ExtendedEquipAPViewer.new(0, 0, 64, 64, @actor)
    end

    adjust_window_for_extended_equiop_scene
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウの座標・サイズを拡張装備画面向けに調整
  #--------------------------------------------------------------------------
  def adjust_window_for_extended_equiop_scene
    @base_info_window.width = @equip_window.width

    @equip_window.x = 0
    @equip_window.y = @base_info_window.y + @base_info_window.height
    @equip_window.height = Graphics.height - @equip_window.y
    @equip_window.active = false
    @equip_window.z = 100

    @status_window.x = 0
    @status_window.y = @equip_window.y
    @status_window.width = STANDARD_WIDTH
    @status_window.height = @equip_window.height
    @status_window.visible = false
    @status_window.z = 100

    @item_windows.each { |window|
      window.x = @equip_window.width
      window.y = @help_window.height
      window.z = 50
      window.height = Graphics.height - @help_window.height
    }

    if @ap_window != nil
      @ap_window.width = @item_windows[0].width
      @ap_window.height =
        (KGC::ExtendedEquipScene::AP_WINDOW_SKILLS + 1) * Window_Base::WLH + 32
      @ap_window.x = @equip_window.width
      @ap_window.y = Graphics.height - @ap_window.height
      @ap_window.z = @item_windows[0].z + 10
      @ap_window.refresh
    end

    # コマンドウィンドウ不使用の場合
    unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
      @command_window.visible = false
      @command_window.active = false
      @equip_window.active = true
      @equip_window.call_update_help
    end
  end
  #--------------------------------------------------------------------------
  # ○ コマンドウィンドウの作成
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_ExtendedEquipCommand.new
    @command_window.help_window = @help_window
    @command_window.active = true
    @command_window.x = (Graphics.width - @command_window.width) / 2
    @command_window.y = (Graphics.height - @command_window.height) / 2
    @command_window.update_help

    # 装備固定なら「最強装備」「すべて外す」を無効化
    if @actor.fix_equipment
      @command_window.draw_item(1, false)
      @command_window.draw_item(2, false)
    end
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  alias terminate_KGC_ExtendedEquipScene terminate
  def terminate
    terminate_KGC_ExtendedEquipScene

    @command_window.dispose
    @base_info_window.dispose
    @ap_window.dispose if @ap_window != nil
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウをリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_window
    @base_info_window.refresh
    @equip_window.refresh
    @status_window.refresh
    @item_windows.each { |window| window.refresh }
    @ap_window.refresh if @ap_window != nil
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_ExtendedEquipScene update
  def update
    update_command_window
    if @command_window.active
      update_KGC_ExtendedEquipScene
      update_command_selection
    else
      update_KGC_ExtendedEquipScene
      update_ap_window
    end
  end
  #--------------------------------------------------------------------------
  # ○ コマンドウィンドウの更新
  #--------------------------------------------------------------------------
  def update_command_window
    @command_window.update
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの更新
  #--------------------------------------------------------------------------
  def update_status_window
    @base_info_window.update
    @status_window.update

    if @command_window.active || @equip_window.active
      @status_window.set_new_parameters({}, nil)
    elsif @item_window.active
      return if @last_item == @item_window.item

      @last_item = @item_window.item
      temp_actor = Marshal.load(Marshal.dump(@actor))
      temp_actor.change_equip(@equip_window.index, @item_window.item, true)
      param = {
        :maxhp => temp_actor.maxhp,
        :maxmp => temp_actor.maxmp,
        :atk   => temp_actor.atk,
        :def   => temp_actor.def,
        :spi   => temp_actor.spi,
        :agi   => temp_actor.agi,
        :hit   => temp_actor.hit,
        :eva   => temp_actor.eva,
        :cri   => temp_actor.cri,
      }
      @status_window.equip_type = @equip_window.index
      @status_window.set_new_parameters(param, @last_item)
      Graphics.frame_reset
    end
  end
  #--------------------------------------------------------------------------
  # ○ AP ウィンドウの更新
  #--------------------------------------------------------------------------
  def update_ap_window
    return if @ap_window == nil

    # 表示/非表示切り替え
    button = KGC::ExtendedEquipScene::AP_WINDOW_BUTTON
    if button != nil && Input.trigger?(button)
      Sound.play_decision
      if @ap_window.openness == 255
        @ap_window.close
      else
        @ap_window.open
      end
    end

    # 表示内容更新
    @ap_window.update
    new_item = (@equip_window.active ? @equip_window.item : @item_window.item)
    @ap_window.item = new_item if @ap_window.item != new_item

    # 位置更新
    ay = @ap_window.y
    ayb = @ap_window.y + @ap_window.height  # AP window: Bottom
    cy = @item_window.y + 16
    cy += @item_window.cursor_rect.y if @item_window.active
    cyb = cy + Window_Base::WLH             # Cursor rect: Bottom
    bottom = (ay != @item_window.y)
    if bottom
      # 下で被る
      @ap_window.y = @item_window.y if ay < cyb
    else
      # 上で被る
      @ap_window.y = Graphics.height - @ap_window.height if cy < ayb
    end
  end
  #--------------------------------------------------------------------------
  # ○ コマンド選択の更新
  #--------------------------------------------------------------------------
  def update_command_selection
    update_window_position_for_equip_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0  # 装備変更
        Sound.play_decision
        # 装備部位ウィンドウに切り替え
        @equip_window.active   = true
        @command_window.active = false
        @command_window.close
      when 1  # 最強装備
        if @actor.fix_equipment
          Sound.play_buzzer
          return
        end
        Sound.play_equip
        process_equip_strongest
      when 2  # すべて外す
        if @actor.fix_equipment
          Sound.play_buzzer
          return
        end
        Sound.play_equip
        process_remove_all
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 装備部位選択の更新
  #--------------------------------------------------------------------------
  alias update_equip_selection_KGC_ExtendedEquipScene update_equip_selection
  def update_equip_selection
    update_window_position_for_equip_selection
    if Input.trigger?(Input::A)
      if @actor.fix_equipment
        Sound.play_buzzer
        return
      end
      # 選択している装備品を外す
      Sound.play_equip
      @actor.change_equip(@equip_window.index, nil)
      refresh_window
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      if KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
        show_command_window
      else
        # コマンドウィンドウ不使用なら終了
        return_scene
      end
      return
    elsif Input.trigger?(Input::R)
      unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
        # コマンドウィンドウ不使用時のみ切り替え
        Sound.play_cursor
        next_actor
        return
      end
    elsif Input.trigger?(Input::L)
      unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
        # コマンドウィンドウ不使用時のみ切り替え
        Sound.play_cursor
        prev_actor
        return
      end
    elsif Input.trigger?(Input::C)
      # 前回のアイテムをダミーにする
      @last_item = RPG::Weapon.new
    end

    update_equip_selection_KGC_ExtendedEquipScene
  end
  #--------------------------------------------------------------------------
  # ○ コマンドウィンドウに切り替え
  #--------------------------------------------------------------------------
  def show_command_window
    @equip_window.active   = false
    @command_window.active = true
    @command_window.open
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の更新
  #--------------------------------------------------------------------------
  alias update_item_selection_KGC_ExtendedEquipScene update_item_selection
  def update_item_selection
    update_window_position_for_item_selection

    update_item_selection_KGC_ExtendedEquipScene

    if Input.trigger?(Input::C)
      @base_info_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ位置の更新 (装備部位選択)
  #--------------------------------------------------------------------------
  def update_window_position_for_equip_selection
    return if @item_window.x == @equip_window.width

    @base_info_window.width = @equip_window.width
    @item_window.x = [@item_window.x + ANIMATION_SPPED, @equip_window.width].min
    if @ap_window != nil
      @ap_window.x = @item_window.x
    end
    @equip_window.visible  = true
    @status_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ位置の更新 (アイテム選択)
  #--------------------------------------------------------------------------
  def update_window_position_for_item_selection
    return if @item_window.x == STANDARD_WIDTH

    @base_info_window.width = STANDARD_WIDTH
    @item_window.x = [@item_window.x - ANIMATION_SPPED, STANDARD_WIDTH].max
    if @ap_window != nil
      @ap_window.x = @item_window.x
    end
    @equip_window.visible  = false
    @status_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ○ 最強装備の処理
  #--------------------------------------------------------------------------
  def process_equip_strongest
    # 以前のパラメータを保存
    last_hp = @actor.hp
    last_mp = @actor.mp
    # 最強装備対象の種別を取得
    types = [-1]
    types += ($imported["EquipExtension"] ? @actor.equip_type : [0, 1, 2, 3])
    ignore_types   = KGC::ExtendedEquipScene::IGNORE_STRONGEST_KIND.clone
    judged_indices = []
    weapon_range   = 0..(@actor.two_swords_style ? 1 : 0)

    # 装備対象の武具をすべて外す
    types.each_with_index { |t, i|
      @actor.change_equip(i, nil) unless ignore_types.include?(t)
    }

    # 最強武器装備
    weapon_range.each { |i|
      judged_indices << i
      # 1本目が両手持ちの場合は2本目を装備しない
      if @actor.two_swords_style
        weapon = @actor.weapons[0]
        next if weapon != nil && weapon.two_handed
      end
      weapon = get_strongest_weapon(i)
      @actor.change_equip(i, weapon) if weapon != nil
    }

    # 両手持ち武器を持っている場合は盾 (防具1) を装備しない
    weapon = @actor.weapons[0]
    if weapon != nil && weapon.two_handed
      judged_indices |= [1]
    end

    # 最強防具装備
    exist = true
    while exist
      strongest = get_strongest_armor(types, ignore_types, judged_indices)
      if strongest != nil
        @actor.change_equip(strongest.index, strongest.item)
        judged_indices << strongest.index
      else
        exist = false
      end
    end

    # 以前のパラメータを復元
    @actor.hp = last_hp
    @actor.mp = last_mp

    refresh_window
  end
  #--------------------------------------------------------------------------
  # ○ 最も強力な武器を取得
  #     equip_type : 装備部位
  #    該当するアイテムがなければ nil を返す。
  #--------------------------------------------------------------------------
  def get_strongest_weapon(equip_type)
    # 装備可能な武器を取得
    equips = $game_party.items.find_all { |item|
      valid = item.is_a?(RPG::Weapon) && @actor.equippable?(item)
      if valid && $imported["EquipExtension"]
        valid = @actor.ep_condition_clear?(equip_type, item)
      end
      valid
    }
    return nil if equips.empty?

    param_order = KGC::ExtendedEquipScene::STRONGEST_WEAPON_PARAM_ORDER
    return get_strongest_item(equips, param_order)
  end
  #--------------------------------------------------------------------------
  # ○ 最も強力なアイテムを取得
  #     equips      : 装備品リスト
  #     param_order : パラメータ優先順位
  #--------------------------------------------------------------------------
  def get_strongest_item(equips, param_order)
    result = []
    param_order.each { |param|
      # パラメータ順にソート
      get_proc = KGC::ExtendedEquipScene::GET_PARAM_PROC[param]
      equips   = equips.sort_by { |item| -get_proc.call(item) }
      # 最もパラメータが高いアイテムを取得
      highest = equips[0]
      result  = equips.find_all { |item|
        get_proc.call(highest) == get_proc.call(item)
      }
      # 候補が1つに絞れたら終了
      break if result.size == 1
      equips = result.clone
    }

    # 最も ID が大きいアイテムを取得
    return (result.sort_by { |v| -v.id })[0]
  end
  #--------------------------------------------------------------------------
  # ○ 最も強力な防具を取得 (StrongestItem)
  #     types          : 装備部位リスト
  #     ignore_types   : 無視する部位リスト
  #     judged_indices : 判定済み部位番号リスト
  #    該当するアイテムがなければ nil を返す。
  #--------------------------------------------------------------------------
  def get_strongest_armor(types, ignore_types, judged_indices)
    # 装備可能な防具を取得
    equips = $game_party.items.find_all { |item|
      item.is_a?(RPG::Armor) &&
        !ignore_types.include?(item.kind) &&
        @actor.equippable?(item)
    }
    return nil if equips.empty?

    param_order = KGC::ExtendedEquipScene::STRONGEST_ARMOR_PARAM_ORDER

    # 最強防具を探す
    until equips.empty?
      armor = get_strongest_item(equips, param_order)
      types.each_with_index { |t, i|
        next if judged_indices.include?(i)
        next if armor.kind != t
        if $imported["EquipExtension"]
          next unless @actor.ep_condition_clear?(i, armor)
        end
        return KGC::ExtendedEquipScene::StrongestItem.new(i, armor)
      }
      equips.delete(armor)
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # ○ すべて外す処理
  #--------------------------------------------------------------------------
  def process_remove_all
    type_max = ($imported["EquipExtension"] ? @actor.equip_type.size : 4) + 1
    type_max.times { |i| @actor.change_equip(i, nil) }
    refresh_window
  end
end

적용했을시의 스크린샷

장비확장스샷.bmp
장비장착을 선택했을경우
장비장착선택시.bmp
모두해제 선택시
모두해제선택시.bmp

Comment '15'
  • ?
    루시페르 2009.03.28 17:25
    우어어어!@
    댓글이 없다! 댓글이!
  • profile
    미니♂ban♀ 2009.03.28 23:33
    이거 쓰고 싶지 않은건 어케 하나요?
    예를 들어 무기 방패 갑옷 투구 신발 장갑이 있다면 여기서 투구만 빼고 하고 싶다면..?
  • ?
    Last H 2009.03.28 23:38
    이 스크립트는 말 그대로 장비 메뉴창을 바꿔주는 스크립트입니다. 
    장구류의 종류를 늘이거나 줄이고 싶으시면 이 스크립트가 아닌 장비확장 스크립트를 쓰셔야 할 겁니다. 
  • ?
    루시페르 2009.03.28 23:38
    말 그대로, 지금 제가 올려놓은 스크립트창에 보시면
    신발, 장갑등이 있잖아요?
    그건 이것과는 별개의 스크립트인데, 그건 또 바로 올려드릴테니
    사용법을 보시고 사용하시면 됩니다.
  • ?
    트랜스푸마 2009.03.29 22:32
    와 정말 고맙습니다^^
  • ?
    훈덕 2009.04.02 00:52
    감사합니다.
  • ?
    정검중 2009.06.01 17:00
    땡큐~
  • ?
    백년술사 2009.06.09 22:59
    재밌겠다..ㅎㅎ
  • ?
    칼리아 2009.06.24 19:11
    잘씁니다.
  • ?
    페트릭스타 2009.06.27 11:26

    감사 잘씁니다.ㅎㅎ

  • ?
    카린저 2009.11.27 23:52

    적용해도 장비창이 늘어나지 않는데 어떻게 된거죠 ?

  • ?
    꽯뚧 2010.02.05 15:02

    감사합니다. 질문이 하나 있습니다.

    이거 장비 확장창의 스타일을 모그 메뉴 스타일로 바꿀순 없습니까?

    스크립트 완전 초보라... 알려주시면 감사합니다!

  • ?
    낙서 2010.02.16 19:40

  • ?
    굴다리안에싱하 2010.08.19 10:56

    어디다 붙여넣을까요?

  • ?
    메이퍼 2010.09.01 16:52

    감사합니다아


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
297 메뉴 몬스터도감 Tankentai사이드뷰에 작동하도록 수정 13 카르와푸딩의아틀리에 2009.05.22 3775
296 기타 스크립트강좌 4 아하!잘봤어요. 2009.05.04 2158
295 이동 및 탈것 대각선 이동 스크립트 17 아방스 2009.05.02 3676
294 이동 및 탈것 A* 알고리즘을 이용한 길찾기 스크립트 3 file 허걱 2009.04.20 3527
293 기타 KGC 리버스 데미지! 28 루시페르 2009.04.13 2979
292 타이틀/게임오버 [자작] 타이틀 화면 없이 게임을 시작하자! Title Skiper 29 케류 2009.04.05 4423
291 기타 [자작] 횡스크롤 점프스크립트 18 file 좀비사냥꾼 2009.04.03 4276
290 키입력 답을 입력하는 텍스트박스 스크립트!! 21 file 좀비사냥꾼 2009.03.29 4206
289 기타 캐릭터 소개화면 16 file 좀비사냥꾼 2009.03.29 6044
288 장비 KGC장비종류 추가 스크립트. 36 file 루시페르 2009.03.28 4674
» 장비 KGC확장장비창 스크립트 15 file 티라엘 2009.03.27 3622
286 상태/속성 어떤 상태일때에만 사용가능한 스킬 14 file 좀비사냥꾼 2009.03.25 3266
285 메뉴 [자작]명성치 사용 시스템(메뉴 출력) 16 Rainsy 2009.03.22 4360
284 기타 시야범위 스크립트 18 file 좀비사냥꾼 2009.03.19 4047
283 메시지 문자픽쳐 표시 스크립트 7 file 좀비사냥꾼 2009.03.19 4144
282 이름입력 한글로 이름 입력하는 스크립트입니다. 55 file 헤르코스 2009.03.18 6662
281 타이틀/게임오버 타이틀화면 커스터마이즈 29 file 可わいい 2009.03.16 6141
280 전투 ORBS [새로운 전투 방식] 48 file 아방스 2009.03.04 10207
279 기타 액터선택지제작 간편화 스크립트 7 Evangelista 2009.02.26 4082
278 이름입력 아이템 이름을 내마음대로 정하자! name_changer 1.0v 26 file Last H 2009.02.25 4067
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 32 Next
/ 32