질문과 답변

Extra Form

돈으로 주고 스킬북 사는 시스템을 구현하던 중

직업제한이 필요한 것 같아서 구글링으로 찾은 스크립트인데요

사용은 문제가 없는데

다른 것 사용해서 튕기는지는 실험하지 못했습니다만

전투 중에 힐을 하면 튕기네요

 

Script 'item class' line 113: NoMethodError occurred.

undefined method 'include?' for nil:NilClass


요렇게 뜨면서 꺼집니다.

뭔 말인진 알겠는데 스크립트 건드릴 줄도 모르고

어떻게 고치는 줄도 모르겠어서 질문드립니다.

아무리 구글에 검색해도 오류나 따로 나오는 건 없네요


밑은 스크립트 전문입니다.

 #==============================================================================

# Szyu's Item's Class Restriction

# Version 1.2

# By Szyu

#

# About:

# Easily specify items, weapons and armors, which can only be used/equipped

# by certain classes

#

# Instructions:

# - Place below "▼ Materials" but above "▼ Main Process".

#

# How to Use:

# - An item's note have to contain one of these:

# <classes: x> # This will allow specified classes to use this item

# <!classes: x> # This will forbit specified classes to use this item

#

# Seperate multiple classes with ','!

# Allowed Database Items, which can be restricted by this script:

# - Items

# - Weapons

# - Armors

#

# If There is none of those tags in the items note, every class is permitted to

# use or equip this item

#

#

# Requires:

# - RPG Maker VX Ace

#

# Terms of Use:

# - Free for commercal and non-commercial use. Please list me

#   in the credits to support my work.

#

#

# Changelog:

# - Same syntax can now be used to restrict for actors:

#   <actors: x>

#   <!actors: x>

# - Added Use Restriction for battles too. Restricted classes and actors can no

#   longer use restricted items in battle

#

#

#

# Pastebin:

# http://adf.ly/rYIZm

#

#

#==============================================================

#   * Game_BattlerBase

#==============================================================

class Game_BattlerBase

  alias sz_iucr_equippable? equippable?

 

  def equippable?(item)

    return false unless item.is_a?(RPG::EquipItem)

    return false if self.is_a?(Game_Actor) &&

      (item.forbid_classes.include?(self.class_id) || item.forbid_actors.include?(self.id))

    return sz_iucr_equippable?(item)

  end

end

 

#==============================================================

#   * Game_Battler

#==============================================================

class Game_Battler < Game_BattlerBase

  alias sz_iucr_item_test item_test

 

  def item_test(user, item)

    return false if item.is_a?(RPG::Item) &&

      (item.forbid_classes.include?(self.class_id) || item.forbid_actors.include?(self.id))

    return sz_iucr_item_test(user, item)

  end

end

 

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

#==============================================================

#   * Initialize BaseItems

#==============================================================

module DataManager

  class << self

    alias load_db_iucr_sz load_database

  end

 

  def self.load_database

    load_db_iucr_sz

    load_iucr_items

  end

 

  def self.load_iucr_items

    groups = [$data_items, $data_weapons, $data_armors]

    for group in groups

      for obj in group

        next if obj.nil?

        obj.load_iucr_notetags_sz

      end

    end

  end

end

 

#==============================================================================

# ** Window_BattleActor

#------------------------------------------------------------------------------

#  This window is for selecting an actor's action target on the battle screen.

#==============================================================================

class Window_BattleActor < Window_BattleStatus

  #--------------------------------------------------------------------------

  # * Get Activation State of Selection Item

  #--------------------------------------------------------------------------

  def current_item_enabled?

    return false if !BattleManager.actor.input.item.is_a?(RPG::UsableItem) ||

      BattleManager.actor.input.item.forbid_classes.include?(BattleManager.actor.input.subject.class_id) ||

      BattleManager.actor.input.item.forbid_actors.include?(BattleManager.actor.input.subject.id)

    return true

  end

end

 

#==============================================================

#   * Content of Recycling Items

#==============================================================

class RPG::BaseItem

  attr_accessor :forbid_classes

  attr_accessor :forbid_actors

 

  def load_iucr_notetags_sz

    @forbid_classes = []

    @forbid_actors = []

    self.note.split(/[\r\n]+/).each do |line|

      # Forbid Classes

      if line =~ /<classes:([\d+,?\s*]+)>/i

        $data_classes.each do |cl|

          @forbid_classes.push(cl.id) if cl

        end

        $1.scan(/\s*,?\d+,?\s*/i).each do |cl|

          @forbid_classes.delete(cl.to_i)

        end

      elsif line =~ /<!classes:([\d+,?\s*]+)>/i

        $1.scan(/\s*,?\d+,?\s*/i).each do |cl|

          @forbid_classes.push(cl.to_i)

        end

        # Forbid Actors

      elsif line =~ /<actors:([\d+,?\s*]+)>/i

        $data_actors.each do |ac|

          @forbid_actors.push(ac.id) if ac

        end

        $1.scan(/\s*,?\d+,?\s*/i).each do |ac|

          @forbid_actors.delete(ac.to_i)

        end

      elsif line =~ /<!actors:([\d+,?\s*]+)>/i

        $1.scan(/\s*,?\d+,?\s*/i).each do |ac|

          @forbid_actors.push(ac.to_i)

        end

      end

    end

  end  

end

 

 

■ 질문전 필독!
  • 질문할 내용이 이 게시판이나 강좌에 이미 있는지 확인합니다.
  • 하나의 게시물에는 하나의 질문만 합니다.
  • 제목은 질문의 핵심 내용으로 작성합니다.
  • 질문 내용은 답변자가 쉽게 이해할 수 있도록 최대한 상세하게 작성합니다.
  • 스크립트의 전문이 필요할 경우 txt 파일 등으로 첨부해 주시기 바랍니다.
  • 답변받은 게시물은 삭제하지 않습니다.
  • 답변이 완료된 경우 해당 답변해주신 분들께 감사의 댓글을 달아줍니다.
    • 처음 오신 분들은 공지 게시물을 반드시 읽어주세요!

※ 미준수시 사전경고 없이 게시물을 삭제합니다.

Comment '2'
  • ?
    KuKuKu 2017.03.19 21:14

    자문자답이 되겠지만 우선 112번째 !battlemanager 부분에서 !표 부분을 빼니 튕기진 않네요.
    아마 이 스크립트 만든 분이 전투 중에 아이템 클래스 제한 추가한 부분 때문에 문제인 것 같은데
    포션이나 힐, 버프같이 아군 대상지정스킬은 전투 중에 쓸 수가 없네요.


    그냥 window battle actor부분 다 날려버리면 전투 중 스킬도 사용가능하네요.

  • ?
    KuKuKu 2017.03.19 22:03
    왜 되는지는 완벽히 이해는 못하겠지만, 일단 해결완료로 해놓겠습니다.

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12387
이벤트 작성 RMMV BGM 이벤트에 관해 3 ∃rrorcOd∃:716 2019.05.12 143
이벤트 작성 RMVX 물체를 특정위치로 이동시키면 이벤트를 만들고싶은데 어떻게 만드나요? 1 백말띠 2019.05.19 66
이벤트 작성 RMMV 아이템을 사용하면 액터 바로 아래에 함정을 만드는 방법 있나요? 2 호구랑 2019.05.19 56
이벤트 작성 RMMV 플레이어 주위만 밝게 만들 때 문제점 3 file 소녀160 2019.05.20 148
이벤트 작성 RMVX 메세지 창 어떻게 띄우나요? 2 file tokki 2019.05.23 110
이벤트 작성 RMMV 얼음위에서 미끄러지는 이벤트 3 file 빵떡2 2019.09.13 116
이벤트 작성 RMMV 알툴만 mv 조각퍼즐 맞투기 1 초보제작기 2019.06.04 100
이벤트 작성 RMMV 플레이어가 이동할때 미끄러지듯이 이동하게 하는 법 없나요? 5 file 이누_ 2019.06.11 162
이벤트 작성 RMVXA 날라오는 투사체 구현 2 힘들다 2019.06.12 168
이벤트 작성 RMVXA 물체를 특정위치에 옮겼을 때 이벤트가 실행되게 하고싶습니다. 1 file lys4154 2019.06.15 80
이벤트 작성 RMMV 키보드 입력 게임은 어떻게 만드나요? 1 file Lyc5 2019.06.20 147
이벤트 작성 RMMV 스위치 ON 상태일때 이벤트가 안나오게 하고싶습니다. 2 file Graper 2022.06.20 109
이벤트 작성 RMMV 대화창에 캐릭터 전신 나오게 하는 법 6 퐁핑퐁 2019.07.03 344
이벤트 작성 RMMV 그림표시 없애는 법 1 퐁핑퐁 2019.07.06 138
이벤트 작성 RMMV 이전 대화 안나오게 하는 법 좀 알려주세요ㅜㅜ 3 두돧둗 2019.07.07 146
이벤트 작성 RMMV 캐릭터한테 아이템을 시작부터 쥐어주고 싶은데 2 두돧둗 2019.07.08 143
이벤트 작성 RMMV 병렬처리에서 중단한 이벤트 처리를 다시 반복하고 싶습니다. 2 file 겐마 2020.08.25 74
이벤트 작성 RMMV 한 쪽 문을 열었을 때 옆에 있던 다른 문도 동시에 열리도록 할 수 있나요? 4 슈퍼변기정령 2019.07.15 84
이벤트 작성 RMVX 조사 이벤트가 하고싶습니다!!!!!!!이왕이면 아이템 획득도!!!!1 2 여랑밈 2019.07.22 90
이벤트 작성 RMMV 또..질문이여..ㅠㅠ 5개의 재료가 있어야 1개의 템이 만들어지게 하고싶습니다. 2 file 쿠우쿠우0 2019.07.23 82
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ... 82 Next
/ 82