질문과 답변

Extra Form
#------------------------------------------------------------------------------
#設定項目
module MARU_battleequip
  SWITCH = 1 #「装備コマンド」を有効にするスイッチ
#------------------------------------------------------------------------------
end

#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
#  バトル画面で、アクターの行動を選択するウィンドウです。
#==============================================================================

class Window_ActorCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  alias ma0075make_command_list make_command_list
  def make_command_list
    ma0075make_command_list
    add_equip_command if $game_switches[MARU_battleequip::SWITCH] == true
  end
  #--------------------------------------------------------------------------
  # ● アイテムコマンドをリストに追加
  #--------------------------------------------------------------------------
  def add_equip_command
    add_command("装備", :equip)
  end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 全ウィンドウの作成
  #--------------------------------------------------------------------------
  alias ma0075_create_all_windows create_all_windows
  def create_all_windows
    ma0075_create_all_windows
    create_equip_window if $game_switches[MARU_battleequip::SWITCH] == true
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウの作成
  #--------------------------------------------------------------------------
  alias ma0075_create_actor_command_window create_actor_command_window
  def create_actor_command_window
    ma0075_create_actor_command_window
    @actor_command_window.set_handler(:equip, method(:command_equip))
  end
  #--------------------------------------------------------------------------
  # ● 装備ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_equip_window
    @status_equip_window = Window_EquipStatus.new(0, @help_window.height)
    @status_equip_window.visible = false
    @status_equip_window.viewport = @viewport
    wx = @status_equip_window.width
    wy = @help_window.height
    ww = Graphics.width - @status_equip_window.width
    @command_equip_window = Window_EquipCommand.new(wx, wy, ww)
    @command_equip_window.visible = false
    @command_equip_window.deactivate
    @command_equip_window.viewport = @viewport
    @command_equip_window.help_window = @help_window
    @command_equip_window.set_handler(:equip,    method(:command_equip_e))
    @command_equip_window.set_handler(:optimize, method(:command_optimize))
    @command_equip_window.set_handler(:clear,    method(:command_clear))
    @command_equip_window.set_handler(:cancel,   method(:on_command_cancel))
    wx = @status_equip_window.width
    wy = @command_equip_window.y + @command_equip_window.height
    ww = Graphics.width - @status_equip_window.width
    @slot_window = Window_EquipSlot.new(wx, wy, ww)
    @slot_window.visible = false
    @slot_window.viewport = @viewport
    @slot_window.help_window = @help_window
    @slot_window.status_window = @status_equip_window
    @slot_window.set_handler(:ok,       method(:on_slot_ok))
    @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
    wx = 0
    wy = @slot_window.y + @slot_window.height
    ww = Graphics.width
    wh = Graphics.height - wy
    @item_equip_window = Window_EquipItem.new(wx, wy, ww, wh)
    @item_equip_window.visible = false
    @item_equip_window.viewport = @viewport
    @item_equip_window.help_window = @help_window
    @item_equip_window.status_window = @status_equip_window
    @item_equip_window.set_handler(:ok,     method(:on_item_equip_ok))
    @item_equip_window.set_handler(:cancel, method(:on_item_equip_cancel))
    @slot_window.item_window = @item_equip_window
  end
  #--------------------------------------------------------------------------
  # ● コマンド[装備]
  #--------------------------------------------------------------------------
  def command_equip
    @help_window.show
    @actor = BattleManager.actor
    @status_equip_window.actor = @actor
    @slot_window.actor = @actor
    @item_equip_window.actor = @actor
    @status_equip_window.refresh
    @status_equip_window.show
    @command_equip_window.refresh
    @command_equip_window.show.activate
    @slot_window.refresh
    @slot_window.show
    @item_equip_window.refresh
    @item_equip_window.show
  end
  #--------------------------------------------------------------------------
  # ● コマンド[装備変更]
  #--------------------------------------------------------------------------
  def command_equip_e
    @slot_window.activate
    @slot_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● コマンド[最強装備]
  #--------------------------------------------------------------------------
  def command_optimize
    Sound.play_equip
    @actor.optimize_equipments
    @status_equip_window.refresh
    @slot_window.refresh
    @command_equip_window.activate
  end
  #--------------------------------------------------------------------------
  # ● コマンド[全て外す]
  #--------------------------------------------------------------------------
  def command_clear
    Sound.play_equip
    @actor.clear_equipments
    @status_equip_window.refresh
    @slot_window.refresh
    @command_equip_window.activate
  end
  #--------------------------------------------------------------------------
  # ● コマンド[キャンセル]
  #--------------------------------------------------------------------------
  def on_command_cancel
    @help_window.hide
    @status_equip_window.hide
    @command_equip_window.hide
    @slot_window.hide
    @item_equip_window.hide
    @actor_command_window.activate
    @actor_command_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● スロット[決定]
  #--------------------------------------------------------------------------
  def on_slot_ok
    @item_equip_window.activate
    @item_equip_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● スロット[キャンセル]
  #--------------------------------------------------------------------------
  def on_slot_cancel
    @slot_window.unselect
    @command_equip_window.activate
  end
  #--------------------------------------------------------------------------
  # ● アイテム[決定]
  #--------------------------------------------------------------------------
  def on_item_equip_ok
    Sound.play_equip
    @actor.change_equip(@slot_window.index, @item_equip_window.item)
    @slot_window.activate
    @slot_window.refresh
    @item_equip_window.unselect
    @item_equip_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● アイテム[キャンセル]
  #--------------------------------------------------------------------------
  def on_item_equip_cancel
    @slot_window.activate
    @item_equip_window.unselect
  end
end
돌아다니다가 발견한 자료인데요,
여기 스크립트에서
    add_equip_command if $game_switches[MARU_battleequip::SWITCH] == true
부분이 초기 스위치 값을 인식하지 못하는 것 같아서
    add_equip_command
부분만 남기고 지우고 전투 중 장비메뉴가 추가되어서 커맨드를 실행해 보려니
undefinded method 'actor=' for nil:NilClass
라는 스크립트 에서가 떠서 보니
    @status_equip_window.actor = @actor
부분인데, 여기서 actor가 확인이 되지 않는 이유는 뭔가요?
 
이 외에도 다른 스크립트 에러가 발생할 경우가 있을까요?
Comment '2'
  • ?
    허걱 2012.07.03 09:58
    actor가 확인 안된 이유는 @status_equip_window 가 정의되지 않았거나 @status_equip_window 안에 actor 라는 메소드가 존재하지 않기 때문입니다.
    제작자가 만들어둔 부분은 모르겠다면 수정하지 않는것이 좋습니다.
    수정을 할 경우 그에 따른 다른 오류가 생길 가능성이 있기 때문이죠.

    또한 스크립트 에러의 경우는 다른 스크립트와의 충돌로도 발생할 가능성도 있습니다.
  • ?
    echisyryok 2012.07.03 10:03
    그렇군요, 감사합니다.
    조금더 알아봐야겠군요

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12390
RMVXA 스페이스 키 입력 설정 방법?! 4 파튤라 2012.07.14 1306
RMVXA 지형에 관한 질문입니다 6 zerlo 2012.07.14 1357
RMVXA 업그레이드 배틀 시스템에 대해 질문이 있습니다. 1 빙룡군 2012.07.08 995
RMVXA RPG VX ACE 윈도우 7유저의 한글 깨짐 현상. 3 kila233 2012.07.07 8627
RMVXA 현재 VX Ace 버전의 [오메가 퀘스트] 스크립트는 없나요? 1 세븐체크 2012.07.05 1546
RMVXA 절벽에서 내려가기 O 올라가기X 5 file 세븐체크 2012.07.05 1447
RMVXA 상인 npc가 사라져서 안보입니다. 2 file 어느날부터 2012.07.04 1257
RMVXA 흔들림 효과 질문 3 달밤에왈츠 2012.07.03 1677
RMVXA 전투 중 장비 변경 스크립트 질문 2 echisyryok 2012.07.03 788
RMVXA 가입인사 및 질문입니다. ^^;; [서로 교체하는 두 캐릭터의 경험치 공유 방법] 3 건설로봇 2012.06.29 1428
RMVXA 같은 아이템을 다른 가격에 판매하기 4 세븐체크 2012.06.28 1304
RMVXA 장비확장 질문 1 세계의질서 2012.06.27 1152
RMVXA Database Limit Breaker 3 세계의질서 2012.06.27 1149
RMVXA ace의 해상도 변경은 가능한가요? 5 스탄즈 2012.06.25 3692
RMVXA VX ACE 온라인 스크립트 질문과 그외질문 anrkd23 2012.06.21 1183
RMVXA 변수 대입에 대한 스크립트가 궁금한데요. cjk2000 2012.06.18 1221
RMVXA ACE버젼에서 타이틀화면전에 동영상을 재생시키려는데 어떻게 해야하죠? 1 hillstate 2012.06.16 1481
RMVXA 타일셋 불러오기에 실패했습니다. 벌레신 2012.06.13 2038
RMVXA 음악 추천 부탁드려요! 대자연, 맹수와의 사투를 주제로 하는 게임을 제작 중입니다. 2 달밤에왈츠 2012.06.13 1381
RMVXA 일정 장소에서 메뉴창 커멘드를 바꾸는 방법 2 난현이라는 2012.06.11 2541
Board Pagination Prev 1 ... 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 Next
/ 149