RPGXP 스크립트
2013.10.01 06:34

아이템 갯수 제한

조회 수 1061 추천 수 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. 미니맵 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views2177 Votes0
    Read More
  2. 부활 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views2765 Votes0
    Read More
  3. 발소리 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1730 Votes0
    Read More
  4. 메뉴 스크립트 Zer0 CMS

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1384 Votes0
    Read More
  5. 상점에서 아이템 능력치를 표시해주는 스크립트

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

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1076 Votes0
    Read More
  7. 복권 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1146 Votes0
    Read More
  8. 아이템 갯수 제한

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1061 Votes0
    Read More
  9. 레벨업시 능력치 표시

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1081 Votes0
    Read More
  10. 현재 시간 확인

    Date2013.10.01 CategoryRPGXP 스크립트 By Views899 Votes0
    Read More
  11. 화면의 쉐이크를 더 어지럽게 바꿔보자!

    Date2013.10.01 CategoryRPGXP 스크립트 By Views986 Votes0
    Read More
  12. 현재위치&임무 표시

    Date2013.10.01 CategoryRPGXP 스크립트 By Views968 Votes0
    Read More
  13. 윈도우 링 메뉴

    Date2013.10.01 CategoryRPGXP 스크립트 By Views840 Votes0
    Read More
  14. 장비 레벨 제한

    Date2013.10.01 CategoryRPGXP 스크립트 By Views903 Votes1
    Read More
  15. 텔레포트 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views896 Votes0
    Read More
  16. 밤낮 설정

    Date2013.10.01 CategoryRPGXP 스크립트 By Views994 Votes0
    Read More
  17. 전메뉴 반투명화

    Date2013.10.01 CategoryRPGXP 스크립트 By Views768 Votes0
    Read More
  18. Initial Switches and Variables

    Date2013.10.01 CategoryRPGXP 스크립트 By Views602 Votes0
    Read More
  19. Switchless Common Events

    Date2013.10.01 CategoryRPGXP 스크립트 By Views588 Votes0
    Read More
  20. Universal Message System 1.8.0 by ccoa

    Date2013.10.01 CategoryRPGXP 스크립트 By Views581 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(김원배) | 사신지(김병국)