질문과 답변

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 12451
RMMV 전투 중 배틀 BGM 변경에 관한 질문입니다. 2 file hdkmwq 2016.04.21 450
플러그인 추천 RMMV 전투 중 스킬에 조건을 넣고 싶습니다. 악덕팬더 2024.05.05 51
RMVX 전투 중 액터 순서 식별하는 법이 궁금합니다. MMM 2014.04.22 579
RMVXA 전투 중 장비 변경 스크립트 질문 2 echisyryok 2012.07.03 788
RMVX 전투 중 적 캐릭터 만들때 옆에 공간 채우기 질문이요 5 file 여미형님 2014.02.07 878
RMVXA 전투 중 적의 HP와 MP 게이지가 뜨게하는 스크립트가 필요합니다. 2 RPG란무엇인가? 2018.02.28 154
RMMV 전투 중 주인공 스탠딩CG를 바꾸는 게 가능할까요? 조하루 2016.05.13 221
RMMV 전투 중 캐릭터칩을 임의로 이동시킬 방법이 있나요? 1 잠행인 2016.07.20 120
RMVXA 전투 중에 매 턴 확률적으로 특정캐릭이 상태변화에 들어갈수있게 할수 있나요? 1 game 光 ㅋㅋ 2015.04.03 201
에러 해결 RMVXA 전투 중에 메시지 뜨고 튕김 오류 file 슈필러 2019.02.26 98
이벤트 작성 RMVXA 전투 중에 메시지가 딱 1번만 뜨게 하는 법 1 슈필러 2019.02.25 85
턴제 전투 RMMV 전투 중에 스킬 사용 시 사용자 이름이 뜨는 것 대신 스킬 이름과 아이콘이 어떻게 뜨게 하나요... 1 바다에요 2020.03.04 73
RMXP 전투 지고나서 쓰러지는 그래픽 변경이 잘 되지 않습니다. 2 file 구름의영혼 2011.08.19 1646
RMXP 전투 질문입니다. 1 나다니엘 renko 2011.01.21 592
RMMV 전투 처리가 된 이후, 배경이 반씩 짤려서 이상하게 나옵니다. 2 file 파란소리 2018.04.02 191
기타 RMMZ 전투 커맨드 커스텀 질문입니다. 니노미야 2021.08.12 56
RMVXA 전투 텍스트의 일본어 번역방법(설명이 애매하네요...) 2 file 크루마 2013.12.10 1002
RMVXA 전투 파티의 대열보행문제 1 쿠쿠밥솥 2012.02.11 2263
기타 전투 할때 몬스터가 움직이게 하는 스크립트 있나요? 2 귀객 2013.09.15 948
RMXP 전투 화면 그래픽 바꾸기 1 끼룩 2012.02.18 2451
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