RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Item Maximums 1.0.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Item Maximums
Version: 1.0.0
Author: modern algebra
Date: July 19, 2012

Version History


  • <Version 1.0> 2012.07.19 - Original Release

Description


This script allows you to set the maximum number of any item that the party can hold at any given time on an individual basis.

Features

  • Allows you to set individual maximums for items, weapons, and armors
  • Can set a default maximum to apply to all items for which you do not assign an individual maximum

Screenshots



Instructions

Paste the script into its own slot in the Script Editor,above Main but below Materials.

Script


Code: [Select]
#==============================================================================
#    Item Maximums
#    Version: 1.0.0
#    Author: modern algebra (rmrk.net)
#    Date: July 19, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to set the maximum number of any item that the
#   party can hold at any given time on an individual basis.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot in the Script Editor, above Main and
#   below Materials.
#
#    To set a new maximum for any item, just place the following code in its
#   notebox:
#
#        \item_max[n]
#      where: n is the maximum number of that item the party can hold at one
#            time.
#
#    EXAMPLES:
#      \item_max[15]   # The party can hold only 15 of this item at any time.
#      \item_max[35]   # The party can hold only 35 of this item at any time.
#
#    For any item where you do not specify a maximum through the note field,
#   its maximum will be determined by the value of MAIM_DEFAULT_ITEM_MAXIMUM,
#   which can be set by you at line 42.
#==============================================================================

$imported ||= {}
if !$imported[:"MA_ItemMaximums 1.0.0"] # If not already installed
$imported[:"MA_ItemMaximums 1.0.0"] = true

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#    BEGIN Editable Region
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  The following value will be the maximum number of items for any items for
# which you do not set a maximum in the note field.
MAIM_DEFAULT_ITEM_MAXIMUM = 99
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#    END Editable Region
#//////////////////////////////////////////////////////////////////////////////

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - maim_item_max
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Instance Max
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maim_item_max
    (@maim_item_max = self.note[/\\ITEM[ _]MAX\[\s*(\d+)\s*\]/i] ? $1.to_i :
      MAIM_DEFAULT_ITEM_MAXIMUM) if !@maim_item_max
    return @maim_item_max
  end
end

#==============================================================================
# ** Game_Party
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - max_item_number
#==============================================================================

class Game_Party
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Max Item Number
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maim_mxitmnum_3fj4 max_item_number
  def max_item_number(item, *args, &block)
    if item && item.maim_item_max > 0
      return item.maim_item_max
    end
    maim_mxitmnum_3fj4(item, *args, &block)
  end
end

else # If Item Maximums already installed
  p "Item Maximums 1.0.0 is already installed. It cannot be installed twice."
end

You can also obtain the script at Pastebin

Credit


  • modern algebra

Support


Please post in this topic at RMRK if you have any questions or suggestions.

Known Compatibility Issues

I am currently unaware of any compatibility issues.

Author's Notes


The acronym for this script is MAIM, which is a huge waste of such a cool acronym on a script for which it is wildly inappropriate.

Terms of Use


I adopt RMRK's default Terms of Use.
« Last Edit: January 31, 2013, 09:48:09 PM by modern algebra »