질문과 답변

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 플레이어 뒤에 이벤트가 따라붙게 하고싶어요. 4 Virtus 2013.11.27 1183
이벤트 작성 RMVXA 플레이어 x,y 좌표 기억법? 2 유리컵 2023.10.07 26
RMVXA 플레이시간이 100시간이 될 수도 있나요? 2 님믹 2012.11.02 1021
RMVXA 플레이 화면 구성 관련 질문 2 file 천지설화 2017.06.27 150
RMVXA 플레이 할때 중간에 플레이어를 바꾸는 방법을 모르겠어요..... 4 a코코아a 2014.04.07 673
RMVXA 플레이 내에서 게임 시스템에 영향을 주게하는 방법은 없나요 2 언더마인드 2014.09.28 532
RMVXA 프롤로그(맵스크롤 및) 6 혲이 2014.01.30 575
RMVXA 프론트 뷰를 하고 싶은데 어떻게 하면 될까요? 3 file H.M. 2013.10.18 1315
RMVXA 프로젝트를 불러오는데, 실행이 안 됩니다. 3 file 으악새 2013.05.26 552
에러 해결 RMVXA 프로세스 작성에 실패했습니다? file 김빡빡 2019.07.22 138
RMVXA 프로세스 인식 스크립트가 궁금합니다 mona 2013.04.08 980
RMVXA 프로그램을 실행하면 갑자기... 1 메익게임 2014.09.30 386
RMVXA 프레임이 툭 툭 끊기는 현상의 원인은 뭐죠? 4 repola 2014.05.07 578
RMVXA 표지판 말걸기 관련 질문좀할게요 ㅠㅠ 2 신이다1 2017.12.13 215
RMVXA 표시할 수 있는 픽쳐의 제한을 깨는 스크립트는 없을까요? 양갱님 2015.07.04 170
RMVXA 폰트적용법 4 HunnJee 2013.01.08 1636
RMVXA 폰트가 지저분하게 나옵니다 도와주세요 4 file 햇냔 2016.12.02 269
RMVXA 폰트가 적용되질 않습니다. 7 file 뿌잉뿌잉쨔응 2013.07.20 1746
RMVXA 폰트가 깨져서 나오네요... %#$@$언어랑 네모언어로... 2 file 요툰헤임 2013.11.27 1857
스크립트 사용 RMVXA 폰트...적...용... 3 tokki 2019.06.02 357
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