질문과 답변

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 12454
RMVXA 변수 난수에 대해 질문드립니다. 1 몽롱하다 2015.11.21 168
이벤트 작성 RMMV rm2k 이벤트 불러오기(변수x 이벤트 y페이지) mv에서 사용방법 11 file apark 2019.02.13 168
기본툴 사용법 RMMV 이동속도 조절하는 법 알려주세요 1 퐁핑퐁 2019.06.28 168
RMVXA 대열 변경을 했을때, 선두 캐릭터의 그래픽이 바뀌지않는 방법이 있나요? 2 겜맨602 2015.04.04 168
RMVXA 싸우다, 도망치다를 없애고 싶어요. file 로멘렉스 2016.01.12 168
플러그인 사용 RMMV 기본키 이외에 다른키 입력 받는법을 알고 싶습니다. 2 MSM 2019.02.11 168
RMVXA Rpg vx ace 자작 칩 file SEWASHI 2017.10.20 168
플러그인 추천 RMMV 전투속 아이템 사용자의 tp만 줄이는방법 있을까요 2 다람지 2022.01.02 167
기타 RMMV yanfly 2 abang 2020.12.27 167
라이선스 RMMV MV 모바일 포팅때 글꼴파일을 게임 안에 넣어야하나요? 잠행인 2016.08.26 167
RMMV rpg mv 플러그인 사이트 2 BKJNK 2018.05.16 167
RMMV 일정 씬 이하 메뉴 호출 금지 4 FNS키리토 2016.04.20 167
RMMV 앱으로 변환시 조이스틱 질문합니다. 2 ung 2015.12.15 167
RMVX 스크립트 두개를 합쳐주실 수 있나요? file KAHP 2015.12.15 167
RMVXA 스킬을 사용한 캐릭터와 스킬의 대상이 된 캐릭터의 번호를 저장할 수 있나요? 2 폴라 2015.08.12 167
RMMV 대기 스크립트에 대해 2 최다킬 2016.01.05 167
RMVXA 전투 시스템에 대해 1 만땅몬 2016.03.15 167
툴선택 게임 만들 프로그램 추천 질문부탁드립니다 2 DoubleU 2017.09.13 167
RMMV MV에서 스크립트를 사용하는 방법을 알고 싶습니다. 4 시우A 2017.09.21 167
RM2k3 추격 이벤트를 만들 때 1 인큐버스 2018.04.26 167
Board Pagination Prev 1 ... 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 ... 516 Next
/ 516