질문과 답변

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 12442
스크립트 사용 RMVXA 전투화면 내에서 게이지바를 이동시키고 싶어요! file 미맛 2021.09.29 42
기본툴 사용법 RMVXA 전투화면 체력바 디자인?? 바꾸는 법을 모르겠어요ㅠㅠ file 미맛 2021.09.27 147
이벤트 작성 RMVXA NPC가 액터 밀치는 법 아시는 분,,,,,ㅠㅠㅠㅠㅠㅠㅠ 2 미맛 2021.09.27 89
스크립트 사용 RMVXA VXA에서 그림표시 제한을 늘리는 스크립트를 구할수 있을까요? 티안타 2021.09.08 44
스크립트 작성 RMVXA 메시지박스 제목 못 바꾸나요? 2 file 설님 2021.09.01 112
기타 RMVXA 추리겜을 만들려고하는데 어떻게 말을 계속 하게할수 있을까요? dodo&LPG 2021.08.26 81
스크립트 추천 RMVXA 이벤트가 움직이는 다른 이벤트를 향해 움직이는 것은 어떻게 하나요? 2 환경사랑 2021.08.23 70
기본툴 사용법 RMVXA 타일 B 첫번째 칸 연관성 2 겜만들고싶다앙 2021.08.22 75
기본툴 사용법 RMVXA 이벤트 어케 중지해요? 2 file 2021.08.19 47
이벤트 작성 RMVXA 이벤트 1 에이에스디에프 2021.08.11 31
이벤트 작성 RMVXA 플레이어가 있는 위치에 죽는 이벤트를 등장하게 했을때 다른데 밟고 오지 않으면 죽지가 않아요 4 file 유리컵 2021.07.15 55
이벤트 작성 RMVXA 장소이동 후 그림표시가 안되네요 ㅜ 간단한 문제같은데 도통 모르겠습니당 file 체어링2 2021.06.29 57
기본툴 사용법 RMVXA 능력강화 제한 하는법 2 겜만들고싶다앙 2021.06.28 48
이벤트 작성 RMVXA 대화창 이벤트 발생 2 file 스타후르츠 2021.06.10 114
한글 패치 RMVXA RPG Maker VX Ace 한글 출력? 1 ikmyung 2021.05.17 302
이벤트 작성 RMVXA 대사 방향? 이걸 뭐라 해야 하지 암튼 대사 쪽 질문이요 2 둣녀 2021.05.14 90
RMVXA 이벹트 질문 1 마하반야 2021.05.08 38
스크립트 사용 RMVXA 세이브 슬롯 수 줄이는 방법 2 할짓없는인간 2021.05.05 77
이벤트 작성 RMVXA 화면 흔들림이 대화도중에 끊기지 않게 나오는법 있나요? 겜만들고싶다앙 2021.04.24 53
스크립트 추천 RMVXA 스테이터스 애니메이션을 따로 추가할수 있나요? 겜만들고싶다앙 2021.04.22 69
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 149 Next
/ 149