RPGXP 스크립트
2013.09.24 08:06

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

조회 수 947 추천 수 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. 아이디 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1030 Votes0
    Read More
  2. 아이템 갯수 제한

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1063 Votes0
    Read More
  3. 아이템 사용 클래스 한정 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views947 Votes0
    Read More
  4. 아이템 소지수 무제한 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1001 Votes0
    Read More
  5. 아이템 조합 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views890 Votes0
    Read More
  6. 아이템 조합 스크립트

    Date2013.12.06 CategoryRPGXP 스크립트 By 운 Views2715 Votes0
    Read More
  7. 아이템소지 한계돌파

    Date2010.10.24 CategoryRPGXP 스크립트 ByA.M.S Views1964 Votes0
    Read More
  8. 아이템소지 한계돌파

    Date2010.10.24 CategoryRPGXP 스크립트 ByA.M.S Views2248 Votes0
    Read More
  9. 아이템창을 아이템 분류별로 나누어 지게 개조.

    Date2007.12.02 CategoryRPGXP 스크립트 By창조도시 Views1641 Votes1
    Read More
  10. 아이템창을 아이템 분류별로 나누어 지게 개조.

    Date2007.12.02 CategoryRPGXP 스크립트 By창조도시 Views2148 Votes1
    Read More
  11. 아이템획득 표시

    Date2010.10.14 CategoryRPGXP 스크립트 ByA.M.S Views2276 Votes0
    Read More
  12. 아이템획득 표시

    Date2010.10.14 CategoryRPGXP 스크립트 ByA.M.S Views2494 Votes0
    Read More
  13. 안티 렉 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views3327 Votes1
    Read More
  14. 액알 스크립트

    Date2014.11.23 CategoryRPGXP 스크립트 By커비♥ Views1444 Votes1
    Read More
  15. 액터선택지이벤트제작 간편화 스크립트

    Date2009.04.30 CategoryRPGVX 스크립트 ByEvangelista Views2078 Votes3
    Read More
  16. 액터선택지이벤트제작 간편화 스크립트

    Date2009.04.30 CategoryRPGVX 스크립트 ByEvangelista Views2539 Votes3
    Read More
  17. 얼굴표시/문장을 한글자씩 나타내주는 스크립트 (출처-히페리온)

    Date2014.06.22 CategoryRPGXP 스크립트 By시르카 Views1191 Votes0
    Read More
  18. 업적플러그인

    Date2020.09.02 CategoryRPGMV 플러그인 By스트레이보우 Views1654 Votes0
    Read More
  19. 에너미 아이템 변화 스크립트

    Date2009.05.29 CategoryRPGVX 스크립트 ByEvangelista Views2460 Votes1
    Read More
  20. 에너미 아이템 변화 스크립트

    Date2009.05.29 CategoryRPGVX 스크립트 ByEvangelista Views2837 Votes1
    Read More
Board Pagination Prev 1 ... 5 6 7 8 9 10 11 12 13 14 15 Next
/ 15






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

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