RPGXP 스크립트
2013.09.24 08:06

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

조회 수 1032 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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

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


출처: 게임공작소

?

  1. Mog_Battle_hud(MZ버전도 있습니다)

    Date2021.03.05 CategoryRPGMV 플러그인 By스트레이보우 Views1847 Votes0
    Read More
  2. 컷신 플러그인

    Date2020.10.30 CategoryRPGMV 플러그인 By스트레이보우 Views2453 Votes0
    Read More
  3. 업적플러그인

    Date2020.09.02 CategoryRPGMV 플러그인 By스트레이보우 Views2090 Votes0
    Read More
  4. 한글조합입력기(영어가능)

    Date2019.11.10 CategoryRPGXP 스크립트 By조규진1 Views946 Votes0
    Read More
  5. 게임에서 제공해주는 노래가 아닌 외부에서 다운받고 안에 넣어쓰려면 어떻게 해야하나요?

    Date2019.07.26 CategoryRPGMV 플러그인 ByBigOrca Views1463 Votes0
    Read More
  6. Ghost Effect

    Date2019.01.20 CategoryRPGMV 플러그인 By러닝은빛 Views1156 Votes0
    Read More
  7. RPG XP Xas액알

    Date2018.10.30 CategoryRPGXP 스크립트 By심심치 Views1161 Votes0
    Read More
  8. 커스텀 숫자 입력 패드

    Date2018.10.19 CategoryRPGMV 플러그인 By러닝은빛 Views1222 Votes0
    Read More
  9. 9마리 이상의 몬스터 설정 | More Enemies

    Date2018.08.31 CategoryRPGMV 플러그인 By러닝은빛 Views974 Votes0
    Read More
  10. 동적 맵 타일 수정 플러그인

    Date2018.07.17 CategoryRPGMV 플러그인 By베지테리안카카오 Views1035 Votes0
    Read More
  11. VXA에서 XBOX360 컨트롤러 사용 여부 체크

    Date2018.07.15 CategoryRPGVX Ace 스크립트 By러닝은빛 Views891 Votes0
    Read More
  12. RMMV 옵션 창에 메시지 속도 및 글자 크기 변경 기능 추가

    Date2018.07.15 CategoryRPGMV 플러그인 By러닝은빛 Views1636 Votes0
    Read More
  13. 한글 데미지 표시

    Date2018.07.09 CategoryRPGMV 플러그인 By러닝은빛 Views1420 Votes0
    Read More
  14. [ MV ] 심장[체력표시 하트] 플러그인

    Date2018.07.01 CategoryRPGMV 플러그인 By수성의물 Views2257 Votes0
    Read More
  15. [鳥小屋] 실적 플러그인(인게임 트로피 시스템)

    Date2017.10.31 CategoryRPGMV 플러그인 By이니군 Views1747 Votes0
    Read More
  16. LuD Script Package

    Date2017.08.16 CategoryRPGVX Ace 스크립트 ByLuD Views1674 Votes0
    Read More
  17. [VXAce] 레이어 맵 <layer> 시스템

    Date2017.08.07 CategoryRPGVX Ace 스크립트 ByLuD Views1272 Votes0
    Read More
  18. [RPG MV] 퀘스트 마커 지속 표시 플러그인

    Date2017.04.09 CategoryRPGMV 플러그인 Bylklslel Views1697 Votes0
    Read More
  19. Mirror Area - RPG Maker MV

    Date2017.01.03 CategoryRPGMV 플러그인 By러닝은빛 Views5033 Votes0
    Read More
  20. Keyboard Event - RPG Maker MV

    Date2017.01.03 CategoryRPGMV 플러그인 By러닝은빛 Views2311 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)