VX 스크립트

예전에 올라왔던 확장장비 화면의 09/02/15 업데이트 판입니다.

아래부터 스크립트입니다.

기존 장비 화면보다 액터의 장착부위를 나타내는 부분이 좀 더 길어져

만약 신발이나 장갑 등 추가적인 장착부위를 가지는 경우에 유리합니다.

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 = false
  # ◆장비 화면의 커멘드명
  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

Who's 시트르산

?

제작중인 게임 :

Midnight Blue  (미드나잇 블루) - RPGXP

 공동제작 : 휘파람개비님

 시스템 : 45%, 스토리 : 10%, 맵 : 3%, 제작 : 1%

 CG : 2%         총 진행도 : 3%

 

 이번 게임은 공동제작인 만큼 최선을 다하겠습니다 ^^

기다려주세요~~

Comment '13'
  • ?
    니노미야 2010.09.25 14:22

    오- 교체해야 겠네요. ㅎㅎ 잘 받아가겠습니다~

  • ?
    시트르산 2010.09.26 14:23

    최강장비/모두 해제 이런 기능은

    쓸데없이 인터페이스만 귀찮아 지는 느낌이라 false 로 두었어요

    그 기능 사용하실분들은

    USE_COMMAND_WINDOW = true

    로 하심됩니다

  • ?
    곰아저씨 2010.10.03 13:14

    감사합니다 ㅎㅎ 잘쓸게요

  • ?
    포인트팡팡 2010.10.03 13:14
    축하합니다. 곰아저씨님은 65포인트에 당첨되셨습니다
  • ?
    나홀로11호 2010.10.05 22:45

    감사

  • ?
    시옷청룡 2010.11.13 14:39

    감사합니다~

  • ?
    이경로 2010.11.26 22:43

    감사합니다~ 근데요,이런것도 추가해주실 수 있나요?

    1.옷을 상의와 하의로 변경

    2.망토,귀걸이, 반지, 목걸이, 벨트, 훈장, 눈장식, 얼굴장식 추가

    꼭 부탁드립니다.

  • ?
    이렐 2010.12.27 22:02

    감사합니다

  • ?
    미니프레시 2011.05.21 13:51

    감사합니다

  • ?
    rsh9894 2011.05.30 23:48

    감사합니다

  • ?
    웃자 2011.07.30 09:31

    감사합니다

  • ?
    승비 2011.10.03 15:13

    감사합니다~

  • ?
    Maxim_Cool 2012.01.25 12:24

    감사합니다~


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
23 장비 방어구 착용시 최대HP, MP증가 스크립트(턴알) 3 file 기관차 2014.11.06 1222
22 장비 카드 슬롯 장비 스크립트[수정] 2 빙하 2012.11.11 2058
21 장비 카드 슬롯 장비 스크립트 18 file 아이미르 2011.10.13 4130
20 장비 초보적인 장비레벨 개념 스크립트 - 수정 및 덤 9 아이미르 2011.09.06 2657
19 장비 장비 레벨 개념 추가 스크립트 14 아방스 2010.12.06 3275
» 장비 KGC 확장 장비 화면 2009/02/15 13 시트르산 2010.09.25 3112
17 장비 장비의 착용조건 설정 v1.0 27 file 까까까 2010.09.20 3740
16 장비 장비에 레벨제한 스크립트!! 21 ijsh515 2010.09.19 3040
15 장비 Equipment Constraints 2.5b by Modern Algebra 3 Alkaid 2010.09.17 2001
14 장비 Multi-Slot Equipment VX 1.6 by DerVVulfman 1 file Alkaid 2010.09.02 1637
13 장비 아이템 장비시 스킬습득, 'SW_EquipFinisher' by Siot Warrior 19 file 시옷전사 2010.08.31 3029
12 장비 루시퍼님이올리신 rei의 보이는 장비 아주 조금 해석본 2 file 비류 2010.01.08 2184
11 장비 남성 / 여성전용 장비 스크립트 (수정 v1.1) 16 Evangelista 2009.11.15 3070
10 장비 YERD - Extra Equipment Options ReDONE 7 훈덕 2009.11.08 2287
9 장비 Rei(레이)의 Paperdoll(비쥬얼 장비)스크립트 20 file 루시페르 2009.07.29 4467
8 장비 KGC장비종류 추가 스크립트. 36 file 루시페르 2009.03.28 4674
7 장비 KGC확장장비창 스크립트 15 file 티라엘 2009.03.27 3622
6 장비 Disposable Ammo(또 있는 곳을 잘 읽으셔야 합니다.) 2 Man... 2008.10.29 1696
5 장비 Equipment Set Bonus 6 Man... 2008.10.25 1849
4 장비 Expansion_Suite V2.1! 6 Man... 2008.10.25 1593
Board Pagination Prev 1 2 Next
/ 2