Advertisement
Dekita

item limit

Oct 10th, 2012
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Item Limits™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8.  
  9. This is a simple script to enable different max item limits for different items
  10. via notetags.
  11.  
  12. ================================================================================
  13. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  14. ================================================================================
  15. 1. You must give credit to "Dekita"
  16. 2. You are NOT allowed to repost this script.(or modified versions)
  17. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  18. 4. You are NOT allowed to use this script for Commercial games.
  19. 5. ENJOY!
  20.  
  21. "FINE PRINT"
  22. By using this script you hereby agree to the above terms and conditions,
  23. if any violation of the above terms occurs "legal action" may be taken.
  24. Not understanding the above terms and conditions does NOT mean that
  25. they do not apply to you.
  26. If you wish to discuss the terms and conditions in further detail you can
  27. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  28.  
  29. ================================================================================
  30. History:
  31. =========
  32. D /M /Y
  33. 08/10/2o12 - Started/Finished Script,
  34.  
  35. ================================================================================
  36. INSTRUCTIONS:
  37. ==============
  38. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  39.  
  40. ================================================================================
  41. =end #######################
  42. # CUSTOMISATION BEGIN #
  43. #######################
  44.  
  45. module Dekita__Item_Amount
  46.  
  47. Default_Limit = 99
  48.  
  49. Notetag = /<max amnt: (.*)>/i
  50.  
  51. end # module Dekita__Item_Amount
  52. #####################
  53. # CUSTOMISATION END #
  54. #####################
  55. #===============================================================================#
  56. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  57. # YES?\.\. #
  58. # OMG, REALLY? #
  59. # WELL SLAP MY FACE AND CALL ME A DRAGON.\..\.. #
  60. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  61. #===============================================================================#
  62.  
  63. $imported = {} if $imported.nil?
  64. $imported["DPB-Item-Limits"] = true
  65.  
  66. #==============================================================================
  67. module DataManager
  68. #==============================================================================
  69.  
  70. class <<self; alias load_database_item_count load_database; end
  71. def self.load_database
  72. load_database_item_count
  73. load_notetags_item_count
  74. end
  75.  
  76. def self.load_notetags_item_count
  77. groups = [$data_weapons, $data_armors, $data_items]
  78. for group in groups
  79. for obj in group
  80. next if obj.nil?
  81. obj.load_notetags_item_count
  82. end
  83. end
  84. end
  85.  
  86. end # DataManager
  87.  
  88. #==============================================================================
  89. class RPG::Item < RPG::UsableItem
  90. #==============================================================================
  91.  
  92. attr_accessor :max_item_amount_DPBz
  93.  
  94. def load_notetags_item_count
  95. @max_item_amount_DPBz = Dekita__Item_Amount::Default_Limit
  96. self.note.split(/[\r\n]+/).each { |line|
  97. case line
  98. when Dekita__Item_Amount::Notetag
  99. @max_item_amount_DPBz = $1.to_i
  100. end
  101. } # self.note.split
  102. end
  103.  
  104.  
  105. end # RPG::Item < RPG::UsableItem
  106.  
  107. #==============================================================================
  108. class RPG::EquipItem < RPG::BaseItem
  109. #==============================================================================
  110.  
  111. attr_accessor :max_item_amount_DPBz
  112.  
  113. def load_notetags_item_count
  114. @max_item_amount_DPBz = Dekita__Item_Amount::Default_Limit
  115. self.note.split(/[\r\n]+/).each { |line|
  116. case line
  117. when Dekita__Item_Amount::Notetag
  118. @max_item_amount_DPBz = $1.to_i
  119. end
  120. } # self.note.split
  121. end
  122.  
  123.  
  124. end # RPG::EquipItem < RPG::BaseItem
  125.  
  126. #==============================================================================
  127. class Game_Party < Game_Unit
  128. #==============================================================================
  129.  
  130. def max_item_number(item)
  131. return item.max_item_amount_DPBz
  132. end
  133.  
  134. end # end class Game_Party
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement