RPGXP スクリプト
2013.09.24 08:06

아이템 사용 클래스 한정 스크립트

閲覧数 1163 推奨数 0 コメント 0
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷

아이템사용을 클래스 마다 한정시키는 기능을 추가합니다 
예를들어 전사는 포션을 사용할 수 없다 이런식으로 설정할 수가 있습니다 
또 설정하지 않은 아이템은 모두사용 가능하게 설정되있습니다. 

#---------------여기서부터 
# (XRXS39)아이템 사용자 클래스 한정 built20060210 
# by Tetra-Z 

# 아이템을 사용할 수 있는 클래스를 한정합니다. 

#============================================================================== 
# ■ Game_Party 
#============================================================================== 
class Game_Party 
  #-------------------------------------------------------------------------- 
  # ○ 클래스에 의한 아이템 사용자의 한정 데이타베이스 
  #-------------------------------------------------------------------------- 
  def item_user_class_limitation(item_id) 
    # 아이템ID에 의한 클래스 한정 
    case item_id 
    
    #======================================================================== 
    # □ 커스터마이즈 포인트 
    #======================================================================== 
    when 1 
      return [2, 8] 
    # 
    # 기술 형식: 
    # 
    # when 수치(Numeric) - 아이템ID 
    #  return 배열(Array) - 클래스ID배열 
    # 
    # 기술예:「아이템ID 12(디 스펠 허브) (을)를 
    #          클래스ID 7(와)과8(쿠레릭크와 메이지)만 취급해 가능하게 한다」 
    # when 12 
    #  return [7, 8] 
    # 
    # 
    # 
    # when 1 
    #  return [1] 
    # when 4 
    #  return [5] 
    # (와)과 같이, 몇행이나 기술 가능. 
    # 
    # 또↓, [] (은)는 「모든 클래스가 사용 가능」을 의미한다. 
    # 
    #======================================= 커스터마이즈 포인트 여기까지 =┘ 
    
    end 
    # 그 외 
    return [] 
  end 
  #-------------------------------------------------------------------------- 
  # ● 아이템의 사용 가능 판정 
  #    item_id : 아이템 ID 
  #-------------------------------------------------------------------------- 
  alias tetraz_7_item_can_use? item_can_use? 
  def item_can_use?(item_id) 
    # 초기화 
    judge = false 
    a = $game_temp.now_item_user 
 act = ($game_temp.in_battle and $game_temp.now_item_selecting) ? [a] : $game_party.actors 
    for actor in act # 본인이or멤버내에 
      # 사용 가능한 행동 가능자가 있다 
      if (actor.follow_item_use_condition?(item_id) and !(actor.dead?)) 
        judge |= true 
        break 
      end 
    end 
    # 귀환시킨다 
    return (judge and tetraz_7_item_can_use?(item_id)) 
  end 
end 
#============================================================================== 
# ■ Game_Temp 
#============================================================================== 
class Game_Temp 
  #-------------------------------------------------------------------------- 
  # ● 공개 인스턴스 변수 
  #-------------------------------------------------------------------------- 
  attr_accessor :now_item_user            # 아이템 사용자 
  attr_accessor :now_item_selecting      # 아이템 셀렉트중인가 
end 
#============================================================================== 
# ■ Game_Actor 
#============================================================================== 
class Game_Actor < Game_Battler 
  #-------------------------------------------------------------------------- 
  # ● 아이템의 사용 조건에 따를까?(액터 판정) 
  #    item_id : 아이템 ID 
  #-------------------------------------------------------------------------- 
  def follow_item_use_condition?(item_id) 
    a = $game_party.item_user_class_limitation(item_id) 
    return (a == [] or a.include?(self.class_id)) 
  end 
end 
#============================================================================== 
# ■ Scene_Item 
#============================================================================== 
class Scene_Item 
  alias tetraz7_update_target update_target 
  def update_target 
    tetraz7_update_target 
    # C 버튼이 밀렸을 경우 
    if Input.trigger?(Input::C) 
      # 전투 불능 해제 아이템 사용에 의해 사용 가능 상황이 변화할 가능성이 있으므로 
      @item_window.refresh 
    end 
  end 
end 
#============================================================================== 
# ■ Scene_Battle 
#============================================================================== 
class Scene_Battle 
  #-------------------------------------------------------------------------- 
  # ● 메인 처리 
  #-------------------------------------------------------------------------- 
  alias tetraz7_main main 
  def main 
    # 만일을 위해 전투 개시시와 종료시에 스윗치 리셋트 
    $game_temp.now_item_selecting = false 
    tetraz7_main 
    $game_temp.now_item_selecting = false 
  end 
  #-------------------------------------------------------------------------- 
  # ● 아이템 선택 개시 
  #-------------------------------------------------------------------------- 
  alias tetraz7_start_item_select start_item_select 
  def start_item_select 
    $game_temp.now_item_user = $game_party.actors[@actor_index] if $game_temp.in_battle 
    $game_temp.now_item_selecting = true 
    tetraz7_start_item_select 
  end 
  #-------------------------------------------------------------------------- 
  # ● 아이템 선택 종료 
  #-------------------------------------------------------------------------- 
  alias tetraz7_end_item_select end_item_select 
  def end_item_select 
    $game_temp.now_item_user = 0 
    $game_temp.now_item_selecting = false 
    tetraz7_end_item_select 
  end 
end 
#--------------끝 

사용법 
주석에 보면 다 나와있지만.. 모르실 수도 있으니 
우선 스크립트 20번째줄에 가시면 
#======================================================================== 
# □ 커스터마이즈 포인트 
#======================================================================== 
    when 1 
      return [2, 8] 

이렇게 있습니다.. 
이뜻은 1번아이템을 2번과,8번 클래스만 사용가능 하게 설정되있는것입니다. 
이것을 계속 만드실 수도 있고 사용 가능한 클래스를 더 추가시킬 수도 있습니다. 

예를들어 
#======================================================================== 
# □ 커스터마이즈 포인트 
#======================================================================== 
    when 1 
      return [2, 8] 
    when 2 
      return [2, 8, 5] 
    when 7 
      return [1, 5, 3, 7] 


출처: 게임공작소

?

List of Articles
番号 カテゴリ タイトル 投稿者 日付 閲覧数 推奨数
160 RPGXP スクリプト 한글조합입력기(영어가능) file 조규진1 2019.11.10 1196 0
159 RPGXP スクリプト RPG XP Xas액알 1 file 심심치 2018.10.30 1317 0
158 RPGXP スクリプト Font Setup file 운님 2016.07.22 1772 0
157 RPGXP スクリプト 대화에 얼굴이 나오는 스크립트 by: killarot(네이버 dust_mite)(수정버전) 1 부초 2016.02.22 2174 0
156 RPGXP スクリプト RPGXP ATB전투 시스템 예제(스크립트는 예제 안에 포함) 3 MagNesium 2015.11.17 1005 0
155 RPGXP スクリプト 스테이터스,보수,골드,플레임 타임 삭제 rpgmakingbot 2015.06.02 991 0
154 RPGXP スクリプト 헤드 업 디스플레이 스크립트 3  운 2015.01.30 1089 0
153 RPGXP スクリプト 컬러 비트맵 타이틀 스크립트 3  운 2015.01.20 1041 1
152 RPGXP スクリプト 로고 스크립트 1  운 2014.12.10 1392 1
151 RPGXP スクリプト 타이틀 로딩 스크립트  운 2014.12.07 1298 0
150 RPGXP スクリプト 타이틀 스크립트 3  운 2014.12.05 1260 0
149 RPGXP スクリプト 액알 스크립트 4 커비♥ 2014.11.23 1653 1
148 RPGXP スクリプト 공포게임에 장비착용메뉴 3  운 2014.08.24 1666 0
147 RPGXP スクリプト 얼굴표시/문장을 한글자씩 나타내주는 스크립트 (출처-히페리온) 4 시르카 2014.06.22 1409 0
146 RPGXP スクリプト 횡스크롤 점프 [버튼허용스위치추가] 3  운 2014.06.01 1854 0
145 RPGXP スクリプト 말풍선 메세지 스크립트 2 천둥번들 2014.02.24 2042 0
144 RPGXP スクリプト 스텟찍기스크립트 12 천둥번들 2014.02.22 2060 3
143 RPGXP スクリプト 달리기스크립트 4 천둥번들 2014.02.22 2514 2
142 RPGXP スクリプト 8방향 이동스크립트 5 천둥번들 2014.02.22 1970 6
141 RPGXP スクリプト AraLab_MultiStartingPoint (다중 출발점 스크립트, 캐릭터 선택 스크립트) ver.0.2beta 3  운 2014.01.21 2191 1
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8