XP 스크립트

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

#---------------여기서부터
# (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]

이런식으로요^^

출처는 수수께끼의 정사면체입니다

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'
  • ?
    29488 2010.02.21 22:57

    감사합니다

  • ?
    gkssdfsdf 2018.12.30 00:07
    지정된 외의 아이템을 모든 클래스가 사용가능하게 할려면 일일이 해야하나요?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
381 메시지 TXT 메세지 렌더링 스크립트 16 에돌이 2011.07.14 4069
380 전투 Trickster씨의 전투 시스템 (SDK 필수?) Alkaid 2012.09.18 3261
379 메뉴 Trickster's Plug 'n' Play Gradient Bar 2.0 1 file 백호 2009.02.22 2051
378 이동 및 탈것 Trickster's Caterpillar System 0.99 3 Alkaid 2010.12.23 1590
377 스킬 Trickster's Bag of Skill Effects (SDK 필요) Alkaid 2012.09.17 1291
376 스킬 Trickster's Bag of Skill Effects file 백호 2009.02.22 1077
375 그래픽 Transition Pack 1.11 by Fantasist Alkaid 2011.01.22 2044
374 기타 Trailing Characters ver.1 by SephirothSpawn 6 file 백호 2009.02.22 1551
373 변수/스위치 The Self Data Suite by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1237
372 전투 The Lycan ABS by DerVVulfman Alkaid 2013.07.22 1898
371 기타 The General Monster Generator 1.1 by DerVVulfman 1 file Alkaid 2011.03.02 1496
370 영상 The AVI Player 1.3 by DerVVulfman 3 Alkaid 2010.10.08 1707
369 기타 Text to RGSS by DerVVulfman Alkaid 2011.04.18 1319
368 기타 Text Scroll by Dubealex (Release 3) 2 file 백호 2009.02.22 940
367 기타 Tetris Attack by trickster 1 file 백호 2009.02.22 986
366 기타 Terrain Encounter Areas by SephirothSpawn 백호 2009.02.22 778
365 메시지 Taylor's Simple Message System 2000 Alkaid 2020.07.05 247
364 기타 Tax Script 1.2 by The Darklord@rmxp.org 2 file 백호 2009.02.22 1130
363 메뉴 Tales Of Symphonia Menu 8 file 백호 2009.02.21 1744
362 변수/스위치 Switchless Common Events by PK8(XP/VX/VXA) Alkaid 2012.09.15 1202
Board Pagination Prev 1 ... 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ... 52 Next
/ 52