Advertisement
modern_algebra

Item Maximums 1.0.0

Jul 19th, 2012
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.50 KB | None | 0 0
  1. #==============================================================================
  2. #    Item Maximums
  3. #    Version: 1.0.0
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: July 19, 2012
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script allows you to set the maximum number of any item that the
  10. #   party can hold at any given time on an individual basis.
  11. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12. #  Instructions:
  13. #
  14. #    Paste this script into its own slot in the Script Editor, above Main and
  15. #   below Materials.
  16. #
  17. #    To set a new maximum for any item, just place the following code in its
  18. #   notebox:
  19. #
  20. #        \item_max[n]
  21. #      where: n is the maximum number of that item the party can hold at one
  22. #            time.
  23. #
  24. #    EXAMPLES:
  25. #      \item_max[15]   # The party can hold only 15 of this item at any time.
  26. #      \item_max[35]   # The party can hold only 35 of this item at any time.
  27. #
  28. #    For any item where you do not specify a maximum through the note field,
  29. #   its maximum will be determined by the value of MAIM_DEFAULT_ITEM_MAXIMUM,
  30. #   which can be set by you at line 42.
  31. #==============================================================================
  32.  
  33. $imported ||= {}
  34. if !$imported[:"MA_ItemMaximums 1.0.0"] # If not already installed
  35. $imported[:"MA_ItemMaximums 1.0.0"] = true
  36.  
  37. #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  38. #    BEGIN Editable Region
  39. #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  40. #  The following value will be the maximum number of items for any items for
  41. # which you do not set a maximum in the note field.
  42. MAIM_DEFAULT_ITEM_MAXIMUM = 99
  43. #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  44. #    END Editable Region
  45. #//////////////////////////////////////////////////////////////////////////////
  46.  
  47. #==============================================================================
  48. # ** RPG::BaseItem
  49. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  50. #  Summary of Changes:
  51. #    new method - maim_item_max
  52. #==============================================================================
  53.  
  54. class RPG::BaseItem
  55.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56.   # * Instance Max
  57.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58.   def maim_item_max
  59.     (@maim_item_max = self.note[/\\ITEM[ _]MAX\[\s*(\d+)\s*\]/i] ? $1.to_i :
  60.       MAIM_DEFAULT_ITEM_MAXIMUM) if !@maim_item_max
  61.     return @maim_item_max
  62.   end
  63. end
  64.  
  65. #==============================================================================
  66. # ** Game_Party
  67. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  68. #  Summary of Changes:
  69. #    aliased methods - max_item_number
  70. #==============================================================================
  71.  
  72. class Game_Party
  73.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74.   # * Max Item Number
  75.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  76.   alias maim_mxitmnum_3fj4 max_item_number
  77.   def max_item_number(item, *args, &block)
  78.     if item && item.maim_item_max > 0
  79.       return item.maim_item_max
  80.     end
  81.     maim_mxitmnum_3fj4(item, *args, &block)
  82.   end
  83. end
  84.  
  85. else # If Item Maximums already installed
  86.   p "Item Maximums 1.0.0 is already installed. It cannot be installed twice."
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement