Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Party : Max Item Quantities

Party : Max Item Quantities
Version: 2.0
By: Kain Nobel

Introduction

This script basically allows you to adjust the maximum ammount of certain items that can be gained, ie you can only gain 3 of [this] or 10 of [that].

Features

  • Adjust the maximum ammount of certain items that can be carried
  • Maximums can exceed the default 99 limit (might require edits to Window_Item)

Script

Code:
#===============================================================================

# ** Party : Maximum Item Quantities

#===============================================================================

 

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

# * SDK Log

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

if Object.const_defined?(:SDK)

  SDK.log('Party.MaxItemQuants', 'Kain Nobel ©', 2.5, '12.10.2008')

  SDK.log_overwrite(:Game_Party, :gain_item)

  SDK.log_overwrite(:Game_Party, :gain_weapon)

  SDK.log_overwrite(:Game_Party, :gain_armor)

end

 

#===============================================================================

# ** Game_Party

#===============================================================================

 

class Game_Party

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

  # * Maximum Items   = {item_id => max_quantity}

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

  Max_Items = {}

  Max_Items.default = 99

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

  # * Maximum Weapons = {item_id => max_quantity}

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

  Max_Weapons = {}

  Max_Weapons.default = 99

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

  # * Maximum Armors  = {item_id => max_quantity

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

  Max_Armors = {}

  Max_Armors.default = 99

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

  # * Gain Item

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

  def gain_item(id, n)

    unless $data_items[id].nil?

      @items[id] = [[item_number(id) + n, 0].max, Max_Items[id]].min

    end

  end

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

  # * Gain Armor

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

  def gain_armor(id, n)

    unless $data_armors[id].nil?

      @armors[id] = [[armor_number(id) + n, 0].max, Max_Armors[id]].min

    end

  end

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

  # * Gain Weapon

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

  def gain_weapon(id, n)

    unless $data_weapons[id].nil?

      @weapons[id] = [[weapon_number(id) + n, 0].max, Max_Weapons[id]].min

    end

  end

end

Instructions

This script doesn't require SDK, but if SDK is present it logs the overwritten methods. Please place this script below 'SDK' (if using) and above 'main'.

Compatibility

This script overwrites the following...

Game_Party.gain_item
Game_Party.gain_armor
Game_Party.gain_weapon


...please place it *ABOVE* scripts which alias these methods.

Terms and Conditions

Free to use in commercial and non-commercial games, please credit yours truely!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top