RPGXP 스크립트
2013.10.01 06:34

아이템 갯수 제한

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

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

스크립트 붙이신 후 13행에 가보세요.
그쪽에서 설정하시면 됩니다.
 @rx_t_limit_item_num[1] = 24 이렇게 되있는것은 1번아이템에 갯수가 24개로 제한되는거에요
  여기서  가운데 영어를 바꾸면 무기 방어구 설정도 가능합니다.
@rx_t_limit_weapon_num[id] = 숫자  ←특정 무기 갯수 제한
@rx_t_limit_armor_num[id] = 숫자 ← 특정방어구 갯수 제한
입니다.

 

 


#시작~~~~~~~~~
module RX_T_LIM
  # 初期設定
  @rx_t_limit_weapon_num = []
  @rx_t_limit_armor_num = []    #건들지마세요
  @rx_t_limit_item_num = []
 
  /-設定例:
  ここではアイテムID:1?ポ?ションの最大所持?を24個に
      アイテムID:3?フルポ?ションの最大所持?を48個に
      それぞれ設定しています。
      お好みにより色?設定して下さい。-/
  # -------------★설정하세요★-------------
  @rx_t_limit_item_num[1] = 24                        # ↓ 아이템 입니다
  @rx_t_limit_item_num[2] = 48        # @rx_t_limit_item_num[id] =  갯수
                                                    #만약 @rx_t_limit_weapon_num[id] = 갯수 면무기
                                                    #@rx_t_limit_armor_num[id] = 갯수 면방어구
                                                    #이런식으로 계속 만드실 수 있어요 ㅎ

 # -------------★설정 끝 ㅅㄱ~★-------------
  def RX_T_LIM.weapon(id, num)
    if @rx_t_limit_weapon_num[id] != nil
      if num > @rx_t_limit_weapon_num[id]
        num = @rx_t_limit_weapon_num[id]
      end
    end
  end
  def RX_T_LIM.armor(id, num)
    if @rx_t_limit_armor_num[id] != nil
      if num > @rx_t_limit_armor_num[id]
        num = @rx_t_limit_armor_num[id]
      end
    end
  end
  def RX_T_LIM.item(id, num)
    if @rx_t_limit_item_num[id] != nil
      if num > @rx_t_limit_item_num[id]
        num = @rx_t_limit_item_num[id]
      end
    end
  end
  def RX_T_LIM.d_weapon(id)
    if @rx_t_limit_weapon_num[id] != nil
      num = @rx_t_limit_weapon_num[id]
    end
  end
  def RX_T_LIM.d_armor(id)
    if @rx_t_limit_armor_num[id] != nil
      num = @rx_t_limit_armor_num[id]
    end
  end
  def RX_T_LIM.d_item(id)
    if @rx_t_limit_item_num[id] != nil
      num = @rx_t_limit_item_num[id]
    end
  end
end

#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  パ?ティを扱うクラスです。ゴ?ルドやアイテムなどの情報が含まれます。このク
# ラスのインスタンスは $game_party で?照されます。
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # ● アイテムの所持?取得
  #    item_id : アイテム ID
  #--------------------------------------------------------------------------
  alias rx_rg11_item_number item_number
  def item_number(item_id)
    # ★ ハッシュに個?デ?タがあれば所持?制限があるかチェック
    if @items.include?(item_id)
      rx_num = RX_T_LIM.item(item_id, @items[item_id])
      # 所持制限?を超えていたら制限?まで減らす
      if rx_num != nil
        @items[item_id] = rx_num
      end
    end
    rx_rg11_item_number(item_id)
  end
  #--------------------------------------------------------------------------
  # ● 武器の所持?取得
  #    weapon_id : 武器 ID
  #--------------------------------------------------------------------------
  alias rx_rg11_weapon_number weapon_number
  def weapon_number(weapon_id)
    # ★ ハッシュに個?デ?タがあれば所持?制限があるかチェック
    if @weapons.include?(weapon_id)
      rx_num = RX_T_LIM.weapon(weapon_id, @weapons[weapon_id])
      # 所持制限?を超えていたら制限?まで減らす
      if rx_num != nil
        @weapons[weapon_id] = rx_num
      end
    end
    rx_rg11_weapon_number(weapon_id)
  end
  #--------------------------------------------------------------------------
  # ● 防具の所持?取得
  #    armor_id : 防具 ID
  #--------------------------------------------------------------------------
  alias rx_rg11_armor_number armor_number
  def armor_number(armor_id)
    # ★ ハッシュに個?デ?タがあれば所持?制限があるかチェック
    if @weapons.include?(armor_id)
      rx_num = RX_T_LIM.armor(armor_id, @armors[armor_id])
      # 所持制限?を超えていたら制限?まで減らす
      if rx_num != nil
        @armors[armor_id] = rx_num
      end
    end
    rx_rg11_armor_number(armor_id)
  end
end

#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
#  ショップ?面で、購入できる商品の一?を表示するウィンドウです。
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描?
  #    index : 項目番?
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    # アイテムの所持?を取得
    case item
    # -------------★改造ここから★-------------
    when RPG::Item
      # ★ 個?制限があるかチェック
      rx_num = RX_T_LIM.d_item(item.id)
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      # ★ 個?制限があるかチェック
      rx_num = RX_T_LIM.d_weapon(item.id)
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      # ★ 個?制限があるかチェック
      rx_num = RX_T_LIM.d_armor(item.id)
      number = $game_party.armor_number(item.id)
    end
    # ★ 個?制限最終判定
    if rx_num == nil
      rx_num = 99
    end
    # ★ ?格が所持金以下、かつ所持?が 99(若しくは制限個?)でなければ通常文字色に、
    # そうでなければ無?文字色に設定
    if item.price <= $game_party.gold and number < rx_num
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    # -------------★改造ここまで★-------------
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  end
end

#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
#  ショップ?面の?理を行うクラスです。
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # ● フレ?ム更新 (購入ウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_buy
    # ステ?タスウィンドウのアイテムを設定
    @status_window.item = @buy_window.item
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # ウィンドウの?態を初期モ?ドへ
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      # ヘルプテキストを消去
      @help_window.set_text("")
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # アイテムを取得
      @item = @buy_window.item
      # アイテムが無?の場合、または?格が所持金より上の場合
      if @item == nil or @item.price > $game_party.gold
        # ブザ? SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # アイテムの所持?を取得
      case @item
      # -------------★改造ここから★-------------
      when RPG::Item
        # ★ 購入?制限があるかチェック
        rx_num = RX_T_LIM.d_item(@item.id)
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        # ★ 購入?制限があるかチェック
        rx_num = RX_T_LIM.d_weapon(@item.id)
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        # ★ 購入?制限があるかチェック
        rx_num = RX_T_LIM.d_armor(@item.id)
        number = $game_party.armor_number(@item.id)
      end
      # ★ 特に購入?制限がなければ購入?を99に。
      if rx_num == nil
        rx_num = 99
      end
      # ★ すでに 99 個(もしくは制限個?分)所持している場合
      if number == rx_num
        # ブザ? SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # -------------★改造ここまで★-------------
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # 最大購入可能個?を計算
      max = @item.price == 0 ? 99 : $game_party.gold / @item.price
      max = [max, rx_num - number].min
      # ウィンドウの?態を個?入力モ?ドへ
      @buy_window.active = false
      @buy_window.visible = false
      @number_window.set(@item, max, @item.price)
      @number_window.active = true
      @number_window.visible = true
      end
  end
end
#------------------끝

 

 

 

?

  1. 얼굴표시/문장을 한글자씩 나타내주는 스크립트 (출처-히페리온)

    Date2014.06.22 CategoryRPGXP 스크립트 By시르카 Views1195 Votes0
    Read More
  2. 모든 글자에 외곽선 넣는 스크립트

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1189 Votes0
    Read More
  3. 로고 스크립트

    Date2014.12.10 CategoryRPGXP 스크립트 By 운 Views1180 Votes1
    Read More
  4. FPS 표시 스크립트

    Date2013.09.27 CategoryRPGXP 스크립트 By 운 Views1177 Votes0
    Read More
  5. 복권 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1149 Votes0
    Read More
  6. 지정한 아이템 갯수 제한 스크립트

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

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1119 Votes0
    Read More
  8. 횡스크롤 스크립트

    Date2013.09.27 CategoryRPGXP 스크립트 By 운 Views1115 Votes0
    Read More
  9. [아힝흥행]레벨한계 돌파 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By아힝흥행 Views1100 Votes0
    Read More
  10. UNR (아시려나... ) - 상태 이상

    Date2013.01.20 CategoryRPGXP 스크립트 By동동주 Views1088 Votes0
    Read More
  11. 타이틀 로딩 스크립트

    Date2014.12.07 CategoryRPGXP 스크립트 By 운 Views1085 Votes0
    Read More
  12. 레벨업시 능력치 표시

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1083 Votes0
    Read More
  13. 대기 회복 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1078 Votes0
    Read More
  14. 죽었을경우 마을로이동 스크립트

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

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1066 Votes0
    Read More
  16. 타이틀 스크립트

    Date2014.12.05 CategoryRPGXP 스크립트 By 운 Views1036 Votes0
    Read More
  17. 아이디 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1034 Votes0
    Read More
  18. 장비제련 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1029 Votes0
    Read More
  19. c[n] 명령어 줄때의 색상 결정.

    Date2008.02.14 CategoryRPGXP 스크립트 By창조도시 Views1019 Votes1
    Read More
  20. 상점 메뉴 개조시킨 스크립트

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






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

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