XP 스크립트

중복일 수도 있습니다만, 소지한 아이템 갯수가 99개를 넘어도 가게에서 해당물건 구입이 가능하도록 수정한 것입니다.  원 스크립트는:
http://www.geocities.jp/gamergss/rgss/rgss001.html



#==============================================================================
#   ◆ 所持数限界突破 - item_maximum◆
#------------------------------------------------------------------------------
#  アイテムの持てる数を99以上にするスクリプトです
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

#アイテムの所持数
ITEM_MAXIMUM = 999 #소지/구입 최대수는 여기서 지정

#所持数の桁
ITEM_MAXIMUM_PLACE= 4

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

class Game_Party
  #--------------------------------------------------------------------------
  # ● アイテムの増加 (減少)
  #    item_id : アイテム ID
  #    n      : 個数
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
    # ハッシュの個数データを更新
    if item_id > 0
      @items[item_id] = [[item_number(item_id) + n, 0].max, ITEM_MAXIMUM].min
    end
  end
  #--------------------------------------------------------------------------
  # ● 武器の増加 (減少)
  #    weapon_id : 武器 ID
  #    n        : 個数
  #--------------------------------------------------------------------------
  def gain_weapon(weapon_id, n)
    # ハッシュの個数データを更新
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, ITEM_MAXIMUM].min
    end
  end
  #--------------------------------------------------------------------------
  # ● 防具の増加 (減少)
  #    armor_id : 防具 ID
  #    n        : 個数
  #--------------------------------------------------------------------------
  def gain_armor(armor_id, n)
    # ハッシュの個数データを更新
    if armor_id > 0
      @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, ITEM_MAXIMUM].min
    end
  end 
end

#-------------------------------------------------------------------------------

#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
#  アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 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)
    width = 24 + (ITEM_MAXIMUM_PLACE - 2) * 12
    x_i = x - width + 24
    self.contents.draw_text(x_i + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x_i + 256, y, width, 32, number.to_s, 2)
  end
end

#-------------------------------------------------------------------------------

#==============================================================================
# ■ Window_ShopNumber
#------------------------------------------------------------------------------
#  ショップ画面で、購入または売却するアイテムの個数を入力するウィンドウです。
#==============================================================================

class Window_ShopNumber < Window_Base
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_item_name(@item, 4, 96)
    self.contents.font.color = normal_color
    width = 24 + (ITEM_MAXIMUM_PLACE - 2) * 12
    widths = 32 + (ITEM_MAXIMUM_PLACE - 2) * 12
    self.contents.draw_text(272 - width + 24, 96, 32, 32, "×")
    self.contents.draw_text(308 - width + 24, 96, width, 32, @number.to_s, 2)
    self.cursor_rect.set(304 - width + 24, 96, widths, 32)
#    self.cursor_rect.set(304, 96, 32, 32)
    # 合計価格と通貨単位を描画
    domination = $data_system.words.gold
    cx = contents.text_size(domination).width
    total_price = @price * @number
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    if self.active
      # カーソル右 (+1)
      if Input.repeat?(Input::RIGHT) and @number < @max
        $game_system.se_play($data_system.cursor_se)
        @number += 1
        refresh
      end
      # カーソル左 (-1)
      if Input.repeat?(Input::LEFT) and @number > 1
        $game_system.se_play($data_system.cursor_se)
        @number -= 1
        refresh
      end
      # カーソル上 (+10)
      if Input.repeat?(Input::UP) and @number < @max
        $game_system.se_play($data_system.cursor_se)
        @number = [@number + 10, @max].min
        refresh
      end
      # カーソル下 (-10)
      if Input.repeat?(Input::DOWN) and @number > 1
        $game_system.se_play($data_system.cursor_se)
        @number = [@number - 10, 1].max
        refresh
      end
      # R(最大数)
      if Input.repeat?(Input::R) and @number < @max
        $game_system.se_play($data_system.cursor_se)
        @number = @max
        refresh
      end
      # L(1)
      if Input.repeat?(Input::L) and @number > 1
        $game_system.se_play($data_system.cursor_se)
        @number = 1
        refresh
      end
    end
  end
end
 
#-------------------------------------------------------------------------------

#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
#  ショップ画面で、アイテムの所持数やアクターの装備を表示するウィンドウです。
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @item == nil
      return
    end
    case @item
    when RPG::Item
      number = $game_party.item_number(@item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(@item.id)
    when RPG::Armor
      number = $game_party.armor_number(@item.id)
    end
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "Owned")
    self.contents.font.color = normal_color
    width = 36 + (ITEM_MAXIMUM_PLACE - 2) * 16
    self.contents.draw_text(204 - width + 36, 0, width, 32, number.to_s, 2)
    if @item.is_a?(RPG::Item)
      return
    end
    # 装備品追加情報
    for i in 0...$game_party.actors.size
      # アクターを取得
      actor = $game_party.actors[i]
      # 装備可能なら通常文字色に、不可能なら無効文字色に設定
      if actor.equippable?(@item)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      # アクターの名前を描画
      self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
      # 現在の装備品を取得
      if @item.is_a?(RPG::Weapon)
        item1 = $data_weapons[actor.weapon_id]
      elsif @item.kind == 0
        item1 = $data_armors[actor.armor1_id]
      elsif @item.kind == 1
        item1 = $data_armors[actor.armor2_id]
      elsif @item.kind == 2
        item1 = $data_armors[actor.armor3_id]
      else
        item1 = $data_armors[actor.armor4_id]
      end
      # 装備可能な場合
      if actor.equippable?(@item)
        # 武器の場合
        if @item.is_a?(RPG::Weapon)
          atk1 = item1 != nil ? item1.atk : 0
          atk2 = @item != nil ? @item.atk : 0
          change = atk2 - atk1
        end
        # 防具の場合
        if @item.is_a?(RPG::Armor)
          pdef1 = item1 != nil ? item1.pdef : 0
          mdef1 = item1 != nil ? item1.mdef : 0
          pdef2 = @item != nil ? @item.pdef : 0
          mdef2 = @item != nil ? @item.mdef : 0
          change = pdef2 - pdef1 + mdef2 - mdef1
        end
        # パラメータの変化値を描画
        self.contents.draw_text(124, 64 + 64 * i, 112, 32,
          sprintf("%+d", change), 2)
      end
      # アイテムを描画
      if item1 != nil
        x = 4
        y = 64 + 64 * i + 32
        bitmap = RPG::Cache.icon(item1.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, item1.name)
      end
    end
  end
end

#-------------------------------------------------------------------------------
#소지개수가 99개를 넘어도 구입이 가능하게 하려면 원 스크립트에 아래 부분을 추가합니다.
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
#  ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
#==============================================================================

class Window_ShopBuy < Window_Selectable
    #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    # アイテムの所持数を取得
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    # 価格が所持金以下、かつ所持数が 99 でなければ通常文字色に、
    # そうでなければ無効文字色に設定
    if item.price <= $game_party.gold and number < ITEM_MAXIMUM #소지 아이템 갯수가 99개를 넘어도 구입가능
      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
#추가 끝
#-------------------------------------------------------------------------------
#==============================================================================
# ■ Window_ShopSell
#------------------------------------------------------------------------------
#  ショップ画面で、売却のために所持アイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_ShopSell < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    # 売却可能なら通常文字色に、そうでないなら無効文字色に設定
    if item.price > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 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)
    width = 24 + (ITEM_MAXIMUM_PLACE - 2) * 12
    x_i = x - width + 24
    self.contents.draw_text(x_i + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x_i + 256, y, width, 32, number.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
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      # すでに 99 個所持している場合
      if number == ITEM_MAXIMUM
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # 最大購入可能個数を計算
      max = @item.price == 0 ? ITEM_MAXIMUM : $game_party.gold / @item.price
      max = [max, ITEM_MAXIMUM - 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

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'
  • ?
    누군가 2010.05.21 09:58

    중복!중복!

  • ?
    무뇌인 2010.07.22 10:09

    중복이라두 전 못찾았음ㅇㅇ 그니까 이건 필요한그임


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
1021 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11823
1020 온라인 채팅 가능 온라인 스크립트 배포 107 file 아방스 2009.01.03 10680
1019 온라인 RPG 만들기 xp 온라인 스크립트 33 아방스 2007.11.09 9592
1018 맵/타일 [유니크급] RPG XP 게임을 3D화로 보자! Neo Mode7 script / 52 file 쉴더 2009.02.28 9442
1017 온라인 온라인 스크립트 Unis Net RMXP 공식 배포! 25 file 뮤바보 2011.12.25 9400
1016 온라인 광넷[ 광땡 온라인 + 넷플레이 ] 62 - 하늘 - 2009.08.02 9003
1015 전투 [액알]neo_a-rpg_module_1[1][1].2 스크립트 83 file 은빛바람 2009.10.03 8298
1014 이름입력 대화창에 얼굴, 이름 띄우기 37 킬라롯 2008.11.09 7497
1013 온라인 넷플레이1.7.0+abs5.5+한챗 49 쀍뛝쒧 2009.01.24 7286
1012 메뉴 메이플스토리처럼 메뉴를^^ 57 file 딸기님 2010.07.13 7141
1011 메시지 대화창에 얼굴 그래픽 띠우기 73 아방스 2007.11.09 7119
1010 스킬 ABP액알 v1.2 스킬추가, 버그수정판 36 file 백호 2009.02.22 6919
1009 전투 [신기술 체험] 강회된 횡스크롤 액알 13 file 백호 2009.02.22 6841
1008 메뉴 온라인메뉴처럼!! 메이플 메뉴처럼!! 변신~스크립트 33 WMN 2008.03.17 6816
1007 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6561
1006 온라인 Mr.Metring NPE 1.0 [RPG XP 온라인 스크립트] 35 아방스 2009.01.07 6535
1005 이름입력 케릭터 위에 또는 NPC 위에 이름 뛰우기 [헬악이님 제공] 49 file 아방스 2007.11.09 6407
1004 액터 시트르산의 XP용 감정 말풍선 표시 스크립트 37 file 시트르산 2011.01.25 6110
1003 HUD 주인공,NPC이름 머리 나타내기 49 file 송긔 2010.11.28 6060
1002 전투 액알 스크립트 24 백호 2009.02.22 6013
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52