RPGXP 스크립트
2013.09.24 08:06

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

조회 수 945 추천 수 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청담 Views716 Votes0
    Read More
  2. 커다란 그래픽 좁은 길 못지나가는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views866 Votes0
    Read More
  3. 복권 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views925 Votes0
    Read More
  4. 창고 시스템

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views984 Votes0
    Read More
  5. 레벨업시 전회복 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views687 Votes0
    Read More
  6. 대화 글씨가 한글자씩 나오는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1415 Votes0
    Read More
  7. 간단한 여관 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views909 Votes0
    Read More
  8. 자동으로 장애물을 피해가는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views860 Votes0
    Read More
  9. 경험치 표시 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views747 Votes0
    Read More
  10. 지정한 아이템 갯수 제한 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1133 Votes0
    Read More
  11. 아이템 사용 클래스 한정 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views945 Votes0
    Read More
  12. 자동 세이브 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views841 Votes0
    Read More
  13. 죽었을경우 마을로이동 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1065 Votes0
    Read More
  14. 플레이어 발소리 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views937 Votes0
    Read More
  15. 상점 메뉴 개조시킨 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1002 Votes0
    Read More
  16. 몬스터 도감

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1421 Votes0
    Read More
  17. 메뉴에 얼굴 그래픽 표시

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views831 Votes0
    Read More
  18. 직업명 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views769 Votes0
    Read More
  19. 동료가 기차처럼 따라오는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1117 Votes0
    Read More
  20. 아이디 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1027 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 15 Next
/ 15






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

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