Advertisement
Dekita

pequip v1.3

Nov 7th, 2012
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.62 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.3
  3. ★ Perfect Equip Requirements™ ★
  4.  
  5. ===============================================================================
  6. ☆ Script Information:
  7. =======================
  8. A simple equipment requirements script, enter notetags into weapon/armor
  9. noteboxes to make item unequippable unless requirements are met.
  10. list of possible requirements is in the customisation.
  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. 21/10/2o12 - Added Requirements for Dekita__Actors_Death_Counter
  34. 19/10/2o12 - Added Compatability for Dekita__CORE && Dekita__Equip
  35. 19/09/2o12 - Added notetag customisation,
  36. Added atl/dfl requirements,
  37. Improved methods,
  38. 22/08/2o12 - Started and finished.
  39.  
  40. ===============================================================================
  41. ☆ Credit and Thanks to :
  42. ==========================
  43. Fomar0153 - for writing an equip requirements script and showing me how its done.
  44.  
  45. ===============================================================================
  46. ☆ INSTRUCTIONS:
  47. =================
  48. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  49.  
  50. ===============================================================================
  51. ☆ NoteTagz:
  52. =============
  53. e.g <reqlvl: 5>
  54. This would make the item unequippable until the actor is level 5.
  55. full list of notetags below.
  56.  
  57. =end #==========================================================================
  58. module DPB ; module EQUIPREQZ
  59. #######################
  60. # CUSTOMISATION BEGIN #
  61. #######################
  62.  
  63. # Here is some customisation for what you type into the notetags
  64. # /<INSERT YOUR NOTETAG VOCAB LIKE THIS: (.*)>/i
  65.  
  66. # <reqlvl: x>
  67. REQ_LVL_NOTE = /<reqlvl: (.*)>/i
  68.  
  69.  
  70. # These notetags require Dekita's - Perfect Stat Point Distribution System
  71.  
  72. # <reqvit: x>
  73. REQ_VIT_NOTE = /<reqvit: (.*)>/i
  74. # <reqstr: x>
  75. REQ_STR_NOTE = /<reqstr: (.*)>/i
  76. # <reqdex: x>
  77. REQ_DEX_NOTE = /<reqdex: (.*)>/i
  78. # <reqmag: x>
  79. REQ_MAG_NOTE = /<reqmag: (.*)>/i
  80.  
  81.  
  82. # These notetags require Dekita's - Perfect Attack and Defence Levels
  83.  
  84. # <reqatl: x>
  85. REQ_ATL_NOTE = /<reqatl: (.*)>/i
  86. # <reqdfl: x>
  87. REQ_DFL_NOTE = /<reqdfl: (.*)>/i
  88.  
  89.  
  90. # This notetag requires Dekita's - Actor Death Counters
  91.  
  92. # <req dc: x>
  93. REQ_DEATHS_NOTE = /<req dc: (.*)>/i
  94.  
  95.  
  96.  
  97. # Dekita__CORE Settings.
  98. Use_Equip_Reqz_Icons = true
  99.  
  100. Req_Lvl_Vocab = "Req Lv"
  101. Lvl_Req_Icon = 159
  102.  
  103. Req_Vit_Vocab = "Req Vit"
  104. Vit_Req_Icon = 160
  105.  
  106. Req_Str_Vocab = "Req Str"
  107. Str_Req_Icon = 161
  108.  
  109. Req_Dex_Vocab = "Req Dex"
  110. Dex_Req_Icon = 162
  111.  
  112. Req_Mag_Vocab = "Req Mag"
  113. Mag_Req_Icon = 163
  114.  
  115. Req_Atl_Vocab = "Req Atk Lv"
  116. Atl_Req_Icon = 164
  117.  
  118. Req_Dfl_Vocab = "Req Def Lv"
  119. Dfl_Req_Icon = 165
  120.  
  121. Req_Death_Vocab = "Req Deaths"
  122. Death_Req_Icon = 166
  123.  
  124.  
  125.  
  126.  
  127. #####################
  128. # CUSTOMISATION END #
  129. #####################
  130.  
  131. def self.Requirements_For_Equip_Icons(stat)
  132. return Lvl_Req_Icon if stat == :req_lvl
  133. return Vit_Req_Icon if stat == :req_vit
  134. return Str_Req_Icon if stat == :req_str
  135. return Dex_Req_Icon if stat == :req_dex
  136. return Mag_Req_Icon if stat == :req_mag
  137. return Atl_Req_Icon if stat == :req_atl
  138. return Dfl_Req_Icon if stat == :req_dfl
  139. return Death_Req_Icon if stat == :req_adc
  140. return 0#nil
  141. end
  142.  
  143. def self.Requirements_For_Equip_Vocab(stat)
  144. return Req_Lvl_Vocab if stat == :req_lvl
  145. return Req_Vit_Vocab if stat == :req_vit
  146. return Req_Str_Vocab if stat == :req_str
  147. return Req_Dex_Vocab if stat == :req_dex
  148. return Req_Mag_Vocab if stat == :req_mag
  149. return Req_Atl_Vocab if stat == :req_atl
  150. return Req_Dfl_Vocab if stat == :req_dfl
  151. return Req_Death_Vocab if stat == :req_adc
  152. return "NuLL"#nil
  153. end
  154.  
  155. def self.Requirements_For_Equip_Value(target, stat)
  156. return Dekita__CORE::N_A_Vocab if target == false
  157. return "#{target.lvlreq}" if stat == :req_lvl
  158. return "#{target.vitreq}" if stat == :req_vit
  159. return "#{target.strreq}" if stat == :req_str
  160. return "#{target.dexreq}" if stat == :req_dex
  161. return "#{target.magreq}" if stat == :req_mag
  162. return "#{target.atlreq}" if stat == :req_atl
  163. return "#{target.dflreq}" if stat == :req_dfl
  164. return "#{target.death_req}" if stat == :req_adc
  165. return Dekita__CORE::N_A_Vocab
  166. end
  167.  
  168. end ; end #module
  169. #===============================================================================
  170. # ☆ Import:
  171. #===========
  172. $imported = {} if $imported.nil?
  173. $imported[:Dekita__Equip_Requirements] = true
  174. #===============================================================================
  175.  
  176. module DPB ; module REGEXP ; module EQUIPITEM
  177.  
  178. REQ_LVL = DPB::EQUIPREQZ::REQ_LVL_NOTE
  179. REQ_VIT = DPB::EQUIPREQZ::REQ_VIT_NOTE
  180. REQ_STR = DPB::EQUIPREQZ::REQ_STR_NOTE
  181. REQ_DEX = DPB::EQUIPREQZ::REQ_DEX_NOTE
  182. REQ_MAG = DPB::EQUIPREQZ::REQ_MAG_NOTE
  183. REQ_ATL = DPB::EQUIPREQZ::REQ_ATL_NOTE
  184. REQ_DFL = DPB::EQUIPREQZ::REQ_DFL_NOTE
  185. REQ_ADC = DPB::EQUIPREQZ::REQ_DEATHS_NOTE
  186.  
  187. end ; end ; end # USEABLEITEMDAMAGE ; REGEXP ; DPB
  188.  
  189. #==============================================================================
  190. module DataManager
  191. #==============================================================================
  192.  
  193. class <<self; alias load_database_req_dpbz load_database; end
  194. def self.load_database
  195. load_database_req_dpbz
  196. load_notetags_req_dpbz
  197. end
  198.  
  199. def self.load_notetags_req_dpbz
  200. groups = [$data_weapons, $data_armors]
  201. for group in groups
  202. for obj in group
  203. next if obj.nil?
  204. obj.load_notetags_req_dpbz
  205. end
  206. end
  207. end
  208.  
  209. end # DataManager
  210.  
  211. #==============================================================================
  212. class RPG::EquipItem < RPG::BaseItem
  213. #==============================================================================
  214.  
  215. attr_accessor :lvlreq
  216. attr_accessor :vitreq
  217. attr_accessor :strreq
  218. attr_accessor :dexreq
  219. attr_accessor :magreq
  220. attr_accessor :atlreq
  221. attr_accessor :dflreq
  222. attr_accessor :death_req
  223.  
  224. def load_notetags_req_dpbz
  225. @lvlreq = 0
  226. @vitreq = 0
  227. @strreq = 0
  228. @dexreq = 0
  229. @magreq = 0
  230. @atlreq = 0
  231. @dflreq = 0
  232. @death_req = 0
  233. self.note.split(/[\r\n]+/).each { |line|
  234. case line
  235. when DPB::REGEXP::EQUIPITEM::REQ_LVL
  236. @lvlreq = $1.to_i
  237. when DPB::REGEXP::EQUIPITEM::REQ_VIT
  238. @vitreq = $1.to_i if $imported[:Dekita__PSPDS]
  239. when DPB::REGEXP::EQUIPITEM::REQ_STR
  240. @strreq = $1.to_i if $imported[:Dekita__PSPDS]
  241. when DPB::REGEXP::EQUIPITEM::REQ_DEX
  242. @dexreq = $1.to_i if $imported[:Dekita__PSPDS]
  243. when DPB::REGEXP::EQUIPITEM::REQ_MAG
  244. @magreq = $1.to_i if $imported[:Dekita__PSPDS]
  245. when DPB::REGEXP::EQUIPITEM::REQ_ATL
  246. @atlreq = $1.to_i if $imported[:Dekita__ATL_AND_DFL]
  247. when DPB::REGEXP::EQUIPITEM::REQ_DFL
  248. @dflreq = $1.to_i if $imported[:Dekita__ATL_AND_DFL]
  249. when DPB::REGEXP::EQUIPITEM::REQ_ADC
  250. @death_req = $1.to_i if $imported[:Dekita__Actors_Death_Counter]
  251. end
  252. } # self.note.split
  253. end
  254.  
  255. end # RPG::EquipItem
  256.  
  257. #==============================================================================
  258. class Game_BattlerBase
  259. #==============================================================================
  260.  
  261. alias dpbzequippable? equippable?
  262. def equippable?(item)
  263. return false unless item.is_a?(RPG::EquipItem)
  264. return false if @level < item.lvlreq
  265. return false if @death_counter < item.death_req if $imported[:Dekita__Actors_Death_Counter]
  266. return false if reqdpbzstat(0) < item.vitreq if $imported[:Dekita__PSPDS]
  267. return false if reqdpbzstat(1) < item.strreq if $imported[:Dekita__PSPDS]
  268. return false if reqdpbzstat(2) < item.dexreq if $imported[:Dekita__PSPDS]
  269. return false if reqdpbzstat(3) < item.magreq if $imported[:Dekita__PSPDS]
  270. return false if reqdpbzformz(0) < item.atlreq if $imported[:Dekita__ATL_AND_DFL]
  271. return false if reqdpbzformz(1) < item.dflreq if $imported[:Dekita__ATL_AND_DFL]
  272. return dpbzequippable?(item)
  273. end
  274.  
  275. def reqdpbzstat(id)
  276. return unless $imported[:Dekita__PSPDS]
  277. return dpbzparam(id)
  278. end
  279.  
  280. def reqdpbzformz(id)
  281. return unless $imported[:Dekita__ATL_AND_DFL]
  282. return dpbzformulaz(id)
  283. end
  284.  
  285. end # class Game_BattlerBase
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement