设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 110|回复: 0

[转载发布] Limited Inventory

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9068

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58857
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68819

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    A somewhat simple limited inventory based from my previous Resident Evil scripts. This time it is a bit more generic though for those who doesn't want to make such a game.











    It's completely free to use and/or edit to your liking.

    All you have to do is copy/paste the following script into a new project and read the instructions.
                    Ruby:       
    1. =begin
    2. ================================================================================
    3. Limited Inventory 1.0
    4. by R_Valkyrie
    5. --------------------------------------------------------------------------------
    6. You are free to use, edit, and share this in any way you like.
    7. Please credit me if you do.
    8. ================================================================================
    9. An item is usable if it has a valid effect. Healing items won't be usable if
    10. you already have full health or don't have a curable state for example.
    11. --------------------------------------------------------------------------------
    12. The Evasion sound effect in the database is used for discarding items.
    13. --------------------------------------------------------------------------------
    14. You can use the following notetags on items/weapons/armors in the database:
    15.   <undiscardable>  #cannot discard this item.
    16.                    #key items cannot be discarded by default.
    17.   <hide_number>    #hides the item number.
    18.   <variable_id: x> #will draw variable x instead of the item number. Useful
    19.                    #when having ammo for a gun or something.
    20. --------------------------------------------------------------------------------
    21. Use the following scriptline to:
    22.   SceneManager.call(Scene_Storage) #open the storage menu.
    23.   $game_party.gain_slot(x)         #increase your inventory.
    24.                                    # x = how many slots you gain.
    25. --------------------------------------------------------------------------------
    26. Use the following scriptline when you want to pick up items:
    27.   $game_party.take_item(x, y) # x = $data_items[id]
    28.                               #     $data_weapons[id]
    29.                               #     $data_armors[id]
    30.                               # y = the amount you get.
    31. Directly after, use the scriptline $game_party.item_taken?() in a conditional
    32. branch. There you can erase the event or have other stuff happen.
    33. ================================================================================
    34. =end
    35. module INVENTORY_OPTIONS
    36.   HELP_POS    = true #changes the position of the help window in item/shop menu.
    37.                      # true = bottom, false = top
    38.                   
    39.   DRAW_EQUIP  = true #draws the player's equipment in the status menu.
    40.                      #if false, item name will be colored when equipped instead.
    41.                   
    42.   DRAW_PARAM  = true #draws the atk/def/agi/mat/mdf/luk parameters in the
    43.                      #status menu if set to true.
    44.                   
    45.   MAX_SLOT    = 4    #how many item slots you start with.
    46.   MAX_ITEM    = 999  #max number of any one item.
    47.   ITEM_ORDER  = [2, 3, 1] #how items are sorted in the menu.
    48.                           # 1 = items, 2 = weapons, 3 = armors
    49.   VOCAB_NIL   = "no item" #text for an empty item slot.
    50.   VOCAB_SOLD  = "SOLD" #text for bought weapons and armors.
    51.                        #weapons and armors can only be bought once until you
    52.                        #discard or sell it.
    53.   COLOR_ITEM  = 1 #color for the number of regular items
    54.   COLOR_KEY   = 2 #color for the number of key items
    55.   COLOR_VAR   = 3 #color for variable assigned to items.
    56.   COLOR_EQUIP = 2 #color for equipped items.
    57. end
    58. #===============================================================================
    59. # Don't edit anything below unless you know what you're doing.
    60. #===============================================================================
    61. class << DataManager
    62.   alias make_inventory_contents make_save_contents
    63.   def make_save_contents
    64.     contents = make_inventory_contents
    65.     contents[:storage] = $game_storage
    66.     return contents
    67.   end
    68. end
    69. class << DataManager
    70.   alias extract_inventory_contents extract_save_contents
    71.   def extract_save_contents(contents)
    72.     extract_inventory_contents(contents)
    73.     $game_storage = contents[:storage]
    74.   end
    75. end
    76. ################################################################################
    77. class Game_Actor < Game_Battler
    78.   def change_equip(slot_id, item)
    79.     return if item && equip_slots[slot_id] != item.etype_id
    80.     @equips[slot_id].object = item
    81.     refresh
    82.   end
    83. end
    84. #-------------------------------------------------------------------------------
    85. class Game_Party < Game_Unit
    86.   include INVENTORY_OPTIONS
    87.   alias initialize_inventory_slots initialize
    88.   def initialize
    89.     initialize_inventory_slots
    90.     @occupied_slots  = 0
    91.     @max_slot_number = MAX_SLOT
    92.   end
    93.   def items; @items.keys.collect {|id| $data_items[id] }; end
    94.   def weapons; @weapons.keys.collect {|id| $data_weapons[id] }; end
    95.   def armors; @armors.keys.collect {|id| $data_armors[id] }; end
    96.   def all_items
    97.     item_a = ITEM_ORDER[0] == 1 ? items : ITEM_ORDER[0] == 2 ? weapons : armors
    98.     item_b = ITEM_ORDER[1] == 1 ? items : ITEM_ORDER[1] == 2 ? weapons : armors
    99.     item_c = ITEM_ORDER[2] == 1 ? items : ITEM_ORDER[2] == 2 ? weapons : armors
    100.     item_a + item_b + item_c
    101.   end
    102.   def max_slot_number; @max_slot_number; end
    103.   def max_item_number(item); return MAX_ITEM; end
    104.   def full_inventory?(item)
    105.     max_number = item_number(item) == max_item_number(item)
    106.     (@occupied_slots == @max_slot_number) && (!has_item?(item) || max_number)
    107.   end
    108.   def gain_slot(n); @max_slot_number += n; end
    109.   def gain_item(item, amount, include_equip = false)
    110.     container = item_container(item.class)
    111.     return unless container
    112.     last_number = item_number(item)
    113.     new_number = last_number + amount
    114.     unless has_item?(item)
    115.       return if full_inventory?(item)
    116.       @occupied_slots += 1
    117.     end
    118.     container[item.id] = [[new_number, 0].max, max_item_number(item)].min
    119.     if container[item.id] == 0
    120.       @occupied_slots -= 1
    121.       container.delete(item.id)
    122.     end
    123.     $game_map.need_refresh = true
    124.   end
    125.   def take_item(item, amount)
    126.     SceneManager.call(Scene_ItemTake)
    127.     SceneManager.scene.prepare(item, amount)
    128.     Fiber.yield
    129.   end
    130.   def item_taken?(n = nil)
    131.     @taken = n unless n == nil
    132.     return @taken
    133.   end
    134. end
    135. #-------------------------------------------------------------------------------
    136. class Game_Storage < Game_Party
    137.   def initialize
    138.     init_all_items
    139.     @occupied_slots  = 0
    140.     @max_slot_number = 999
    141.   end
    142. end
    143. ################################################################################
    144. class Window_Base < Window
    145.   include INVENTORY_OPTIONS
    146.   def translucent_alpha; return 120; end
    147.   def draw_item_name(item, x, y, enabled = true, width = 172)
    148.     return unless item
    149.     draw_icon(item.icon_index, x, y, enabled)
    150.     change_color(normal_color, enabled)
    151.     if !DRAW_EQUIP && $game_party.leader.equips.include?(item)
    152.       change_color(text_color(COLOR_EQUIP), enabled)
    153.     end
    154.     draw_text(x + 24, y, width, line_height, item.name)
    155.   end
    156.   def draw_variable(item, x, y)
    157.     return unless item.note =~ /<variable_id:/i
    158.     var_number = $game_variables[item.note[/<variable_id:(.*?)>/i, 1].to_i]
    159.     change_color(text_color(COLOR_VAR))
    160.     draw_text(x, y, contents_width - 4, line_height, var_number, 2)
    161.   end
    162. end
    163. #-------------------------------------------------------------------------------
    164. class Window_ItemCategory < Window_HorzCommand
    165.   def make_command_list
    166.     at_storage = SceneManager.scene_is?(Scene_Storage)
    167.     add_command(Vocab::item, :item)
    168.     add_command("Empty", :empty, at_storage)
    169.     add_command(Vocab::save, :save, !$game_system.save_disabled && !at_storage)
    170.     add_command(Vocab::game_end, :game_end, !at_storage)
    171.   end
    172. end
    173. #-------------------------------------------------------------------------------
    174. class Window_ItemList < Window_Selectable
    175.   def col_max; return 1; end
    176.   def item_max; $game_party.max_slot_number; end
    177.   def enable?(item)
    178.     return true if item || SceneManager.scene_is?(Scene_Storage)
    179.   end
    180.   def make_item_list; @data = $game_party.all_items; end
    181.   def draw_item(index)
    182.     item = @data[index]
    183.     rect = item_rect(index)
    184.     slot_color = text_color(15)
    185.     slot_color.alpha = 120
    186.     contents.fill_rect(rect.x + 2, rect.y + 2, rect.width - 4,
    187.       item_height - 4, slot_color)
    188.     reset_font_settings
    189.     if item
    190.       rect.width -= 4
    191.       draw_item_name(item, rect.x, rect.y, enable?(item))
    192.       draw_item_number(rect, item)
    193.     else
    194.       rect.x += 24
    195.       change_color(text_color(8), false)
    196.       draw_text(rect, VOCAB_NIL)
    197.     end
    198.   end
    199.   def draw_item_number(rect, item)
    200.     return if item.note =~ /<hide_number>/i
    201.     draw_variable(item, rect.x, rect.y)
    202.     return if !item.is_a?(RPG::Item) || item.note =~ /<variable_id:/i
    203.     change_color(text_color(item.key_item? ? COLOR_KEY : COLOR_ITEM))
    204.     draw_text(rect, sprintf("%3d", item_number(item)), 2)
    205.   end
    206.   def item_number(item); $game_party.item_number(item); end
    207. end
    208. #-------------------------------------------------------------------------------
    209. class Window_StorageList < Window_ItemList
    210.   def item_max; @data ? @data.size + 1 : 1; end
    211.   def make_item_list; @data = $game_storage.all_items; end
    212.   def item_number(item); $game_storage.item_number(item); end
    213. end
    214. #-------------------------------------------------------------------------------
    215. class Window_ItemCommand < Window_Command
    216.   def window_width; return 120; end
    217.   def make_command_list
    218.     if SceneManager.scene_is?(Scene_ItemTake)
    219.       add_command("Yes", :take_item, @takable)
    220.       add_command("No",  :leave_item)
    221.     else
    222.       add_command(@command,  :use,     @usable)
    223.       add_command("Discard", :discard, @discard)
    224.     end
    225.   end
    226.   def set_command_for(item, valid_use)
    227.     is_equipment = (item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor))
    228.     @command = is_equipment ? "Equip" : "Use"
    229.     @command = "Unequip" if $game_party.leader.equips.include?(item)
    230.     @usable  = valid_use
    231.     @takable = valid_use
    232.     is_key   = item.is_a?(RPG::Item) && item.key_item?
    233.     if item.note =~ /<undiscardable>/i || is_key
    234.       @discard = false
    235.     else
    236.       @discard = true
    237.     end
    238.   end
    239. end
    240. #-------------------------------------------------------------------------------
    241. class Window_ActorStatus < Window_Base
    242.   def initialize(y, height)
    243.     super(Graphics.width / 2, y, Graphics.width / 2, height)
    244.     refresh
    245.   end
    246.   def draw_actor_health(actor)
    247.     change_color(normal_color, false)
    248.     draw_text(0, 0, contents_width - 4, line_height,
    249.       "/" + sprintf("%4d", actor.mhp), 2)
    250.     change_color(text_color(3))
    251.     change_color(text_color(21)) if actor.hp <= (actor.mhp * 0.75)
    252.     change_color(text_color(20)) if actor.hp <= (actor.mhp * 0.5)
    253.     change_color(text_color(18)) if actor.hp <= (actor.mhp * 0.25)
    254.     draw_text(0, 0, contents_width - 54, line_height,
    255.       sprintf("%4d", actor.hp), 2)
    256.   end
    257.   def draw_actor_equipment(actor)
    258.     return unless DRAW_EQUIP
    259.     draw_horz_line(1.5)
    260.     5.times do |i|
    261.       item = actor.equips[i]
    262.       line_y = line_height * (i + 2)
    263.       if item
    264.         draw_item_name(item, 4, line_y)
    265.         draw_variable(item, 0, line_y)
    266.       else
    267.         change_color(normal_color, false)
    268.         draw_text(28, line_y, contents_width, line_height, "-")
    269.       end
    270.     end
    271.   end
    272.   def draw_actor_parameters(actor)
    273.     return unless DRAW_PARAM
    274.     draw_horz_line(7.5)
    275.     change_color(normal_color, false)
    276.     param_id = [2, 3, 6, 4, 5, 7]
    277.     param_id.size.times do |i|
    278.       px = i < 3 ? 4 : contents_width / 2
    279.       py = i < 3 ? i + 8 : i + 5
    280.       draw_text(px, line_height * py, contents_width, line_height,
    281.         Vocab::param(param_id[i]) + sprintf("%4d", actor.param(param_id[i])))
    282.     end
    283.   end
    284.   def draw_horz_line(y)
    285.     line_color = text_color(8)
    286.     line_color.alpha = translucent_alpha
    287.     contents.fill_rect(0, line_height * y - 1, contents_width, 2, line_color)
    288.   end
    289.   def refresh
    290.     contents.clear
    291.     reset_font_settings
    292.     draw_text(4, 0, contents_width, line_height, $game_party.leader.name)
    293.     draw_actor_health($game_party.leader)
    294.     draw_actor_equipment($game_party.leader)
    295.     draw_actor_parameters($game_party.leader)
    296.   end
    297. end
    298. #-------------------------------------------------------------------------------
    299. class Window_ShopBuy < Window_Selectable
    300.   def window_width; Graphics.width / 2; end
    301.   def enable?(item)
    302.     return false if has_item?(item)
    303.     full = $game_party.full_inventory?(item)
    304.     item && price(item) <= @money && !$game_party.item_max?(item) && !full
    305.   end
    306.   def draw_item(index)
    307.     item = @data[index]
    308.     rect = item_rect(index)
    309.     draw_item_name(item, rect.x, rect.y, enable?(item))
    310.     rect.width -= 4
    311.     if has_item?(item)
    312.       change_color(text_color(18))
    313.       draw_text(rect, VOCAB_SOLD, 2)
    314.     else
    315.       draw_text(rect, price(item), 2)
    316.     end
    317.   end
    318.   def has_item?(item)
    319.     is_equipment = item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
    320.     has_item = $game_party.has_item?(item) || $game_storage.has_item?(item)
    321.     is_equipment && has_item
    322.   end
    323. end
    324. #-------------------------------------------------------------------------------
    325. class Window_ShopNumber < Window_Selectable
    326.   def window_width; Graphics.width / 2; end
    327.   def figures; return 3; end
    328.   def change_number(amount)
    329.     return if @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
    330.     @number = [[@number + amount, @max].min, 1].max
    331.   end
    332. end
    333. ################################################################################
    334. class Scene_Base; include INVENTORY_OPTIONS; end
    335. #-------------------------------------------------------------------------------
    336. class Scene_Title < Scene_Base
    337.   alias setup_game_extras command_new_game
    338.   def command_new_game
    339.     setup_game_extras
    340.     $game_storage = Game_Storage.new
    341.   end
    342. end
    343. #-------------------------------------------------------------------------------
    344. class Scene_Map < Scene_Base
    345.   def call_menu
    346.     Sound.play_ok
    347.     Input.update
    348.     SceneManager.call(Scene_Item)
    349.   end
    350. end
    351. #-------------------------------------------------------------------------------
    352. class Scene_ItemBase < Scene_MenuBase
    353.   def item_target_actors; [$game_party.leader]; end
    354. end
    355. #-------------------------------------------------------------------------------
    356. class Scene_Item < Scene_ItemBase
    357.   alias start_extra start
    358.   def start
    359.     start_extra
    360.     if HELP_POS
    361.       @help_window.y = Graphics.height - @help_window.height
    362.       @category_window.y -= @help_window.height
    363.       @item_window.y -= @help_window.height
    364.     end
    365.     create_storage_window
    366.     create_command_window
    367.   end
    368.   def create_item_window
    369.     wy = @category_window.y + @category_window.height
    370.     wh = Graphics.height - wy
    371.     @item_window = Window_ItemList.new(0, wy, Graphics.width / 2, wh)
    372.     @item_window.viewport = @viewport
    373.     @item_window.help_window = @help_window
    374.     @item_window.set_handler(:ok,     method(:on_item_ok))
    375.     @item_window.set_handler(:cancel, method(:on_item_cancel))
    376.     @item_window.refresh
    377.   end
    378.   def create_storage_window
    379.     @status_window = Window_ActorStatus.new(@item_window.y, @item_window.height)
    380.   end
    381.   def create_command_window
    382.     @command_window = Window_ItemCommand.new(@item_window.width, @item_window.y)
    383.     @command_window.back_opacity = 255
    384.     @command_window.openness = 0
    385.     @command_window.viewport = Viewport.new
    386.     @command_window.viewport.z = 200
    387.     @command_window.set_handler(:ok,     method(:on_command_ok))
    388.     @command_window.set_handler(:cancel, method(:on_command_cancel))
    389.   end
    390.   def on_category_ok
    391.     case @category_window.current_symbol
    392.     when :item
    393.       @item_window.activate
    394.       @item_window.select_last
    395.     when :empty
    396.       $game_party.max_slot_number.times do |i|
    397.         @item_window.select(i)
    398.         $game_storage.gain_item(item, $game_party.item_number(item))
    399.         $game_party.leader.discard_equip(item)
    400.         $game_party.lose_item(item, $game_party.item_number(item))
    401.       end
    402.       @item_window.unselect
    403.       @item_window.refresh
    404.       @storage_window.refresh
    405.       @category_window.activate
    406.     when :save
    407.       SceneManager.call(Scene_Save)
    408.     when :game_end
    409.       SceneManager.call(Scene_End)
    410.     end
    411.   end
    412.   def on_item_ok
    413.     if item
    414.       valid_use = false
    415.       valid_use = true if $game_party.leader.equippable?(item)
    416.       valid_use = true if item_usable?
    417.       @command_window.set_command_for(item, valid_use)
    418.       @command_window.refresh
    419.       @command_window.open.activate
    420.       @command_window.select(0)
    421.     else
    422.       activate_item_window
    423.     end
    424.   end
    425.   def on_command_ok
    426.     case @command_window.current_symbol
    427.     when :use
    428.       is_equipment = (item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor))
    429.       if is_equipment && $game_party.leader.equippable?(item)
    430.         Sound.play_equip
    431.         if $game_party.leader.equips.include?(item)
    432.           $game_party.leader.discard_equip(item)
    433.         else
    434.           $game_party.leader.change_equip(item.etype_id, item)
    435.         end
    436.       else
    437.         use_item
    438.       end
    439.       on_command_cancel
    440.     when :discard
    441.       Sound.play_evasion
    442.       $game_party.leader.discard_equip(item)
    443.       $game_party.lose_item(item, $game_party.item_number(item))
    444.       on_command_cancel
    445.     end
    446.   end
    447.   def on_command_cancel
    448.     @status_window.refresh
    449.     @command_window.close
    450.     activate_item_window
    451.   end
    452. end
    453. #-------------------------------------------------------------------------------
    454. class Scene_ItemTake < Scene_Item
    455.   def prepare(item, amount)
    456.     @item = item
    457.     @amount = amount
    458.   end
    459.   alias deactivate_category_window start
    460.   def start
    461.     deactivate_category_window
    462.     @category_window.deactivate
    463.     @category_window.unselect
    464.     @command_window.x = Graphics.width - @command_window.width
    465.     @command_window.y = @help_window.y
    466.     @command_window.opacity = 0
    467.   end
    468.   def post_start
    469.     perform_transition
    470.     Input.update  
    471.     @item_name = sprintf("\\I[%d]", @item.icon_index) + @item.name
    472.     @help_window.set_text("Will you take the \\C[3]" + @item_name + "\\C[0]?")
    473.     takable = !$game_party.full_inventory?(@item)
    474.     @command_window.set_command_for(@item, takable)
    475.     @command_window.refresh
    476.     @command_window.openness = 255
    477.   end
    478.   def on_command_ok
    479.     case @command_window.current_symbol
    480.     when :take_item
    481.       $game_party.gain_item(@item, @amount)
    482.       $game_party.item_taken?(true)
    483.       @help_window.set_text("You have taken \\C[3]" + @item_name + "\\C[0].")
    484.       @item_window.refresh
    485.       @command_window.close.deactivate
    486.       update until @command_window.openness == 0
    487.       Graphics.wait(60)
    488.       return_scene
    489.     when :leave_item
    490.       on_command_cancel
    491.     end
    492.   end
    493.   def on_command_cancel
    494.     $game_party.item_taken?(false)
    495.     @command_window.close.deactivate
    496.     update until @command_window.openness == 0
    497.     return_scene
    498.   end
    499. end
    500. #-------------------------------------------------------------------------------
    501. class Scene_Storage < Scene_Item
    502.   def create_storage_window
    503.     wx = @item_window.width
    504.     wh = @item_window.height
    505.     @storage_window = Window_StorageList.new(wx, @item_window.y, wx, wh)
    506.     @storage_window.viewport = @viewport
    507.     @storage_window.help_window = @help_window
    508.     @storage_window.set_handler(:ok,     method(:on_storage_ok))
    509.     @storage_window.set_handler(:cancel, method(:on_storage_cancel))
    510.     @storage_window.refresh
    511.     @storage_index = 0
    512.   end
    513.   def on_item_ok
    514.     @storage_window.activate
    515.     @storage_window.select(@storage_index)
    516.   end
    517.   def on_storage_ok
    518.     n1 = item ? $game_party.item_number(item) : 0
    519.     n2 = storage_item ? $game_storage.item_number(storage_item) : 0
    520.     if item == storage_item
    521.       swap = [storage_item, n2, nil, 0]
    522.     else
    523.       swap = [storage_item, n2, item, n1]
    524.     end
    525.     $game_party.leader.discard_equip(swap[2])
    526.     $game_party.lose_item(swap[2], swap[3])
    527.     $game_party.gain_item(swap[0], swap[1])
    528.     $game_storage.lose_item(swap[0], swap[1])
    529.     $game_storage.gain_item(swap[2], swap[3])
    530.     @storage_window.refresh
    531.     on_storage_cancel
    532.   end
    533.   def on_storage_cancel
    534.     @storage_index = @storage_window.index
    535.     @storage_window.unselect
    536.     @storage_window.deactivate
    537.     activate_item_window
    538.   end
    539.   def storage_item; @storage_window.item; end
    540. end
    541. #-------------------------------------------------------------------------------
    542. class Scene_Shop < Scene_MenuBase
    543.   def start
    544.     super
    545.     create_help_window
    546.     create_gold_window
    547.     create_command_window
    548.     if HELP_POS
    549.       @help_window.y = Graphics.height - @help_window.height
    550.       @gold_window.y = 0
    551.       @command_window.y = 0
    552.     end
    553.     create_dummy_window
    554.     create_number_window
    555.     create_status_window
    556.     create_buy_window
    557.     create_category_window
    558.     create_sell_window
    559.     @status_window.x = Graphics.width
    560.     @category_window.x = Graphics.width
    561.   end
    562.   def create_dummy_window
    563.     wy = @command_window.y + @command_window.height
    564.     wh = Graphics.height - @help_window.height - @command_window.height
    565.     @dummy_window = Window_Base.new(0, wy, Graphics.width / 2, wh)
    566.     @dummy_window.viewport = @viewport
    567.   end
    568.   def create_sell_window
    569.     wx = Graphics.width / 2
    570.     wh = @dummy_window.height
    571.     @sell_window = Window_ShopSell.new(wx, @category_window.y, wx, wh)
    572.     @sell_window.viewport = @viewport
    573.     @sell_window.help_window = @help_window
    574.     @sell_window.set_handler(:ok,     method(:on_sell_ok))
    575.     @sell_window.set_handler(:cancel, method(:on_sell_cancel))
    576.     @category_window.item_window = @sell_window
    577.   end
    578.   def command_sell
    579.     @sell_window.activate
    580.     @sell_window.select(0)
    581.   end
    582.   def on_sell_ok
    583.     @dummy_window.hide
    584.     @item = @sell_window.item
    585.     @status_window.item = @item
    586.     @number_window.set(@item, max_sell, selling_price, currency_unit)
    587.     @number_window.show.activate
    588.   end
    589.   def on_sell_cancel
    590.     @dummy_window.show
    591.     @sell_window.unselect
    592.     @command_window.activate
    593.     @status_window.item = nil
    594.     @help_window.clear
    595.   end
    596.   def on_number_ok
    597.     Sound.play_shop
    598.     case @command_window.current_symbol
    599.     when :buy
    600.       do_buy(@number_window.number)
    601.     when :sell
    602.       $game_party.leader.discard_equip(@item)
    603.       do_sell(@number_window.number)
    604.     end
    605.     end_number_input
    606.     @gold_window.refresh
    607.     @sell_window.refresh
    608.   end
    609.   def end_number_input
    610.     @number_window.hide
    611.     case @command_window.current_symbol
    612.     when :buy
    613.       activate_buy_window
    614.     when :sell
    615.       activate_sell_window
    616.       @dummy_window.show
    617.     end
    618.   end
    619. end
    复制代码




    本贴来自国际rpgmaker官方论坛作者:R_Valkyrie处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/limited-inventory.154353/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-8 07:55 , Processed in 0.067435 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表