Advertisement
Dekita

$D13x Equip Requirements

Mar 21st, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.72 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # ☆ $D13x - Equipment - Requirements
  4. # -- Author : Dekita
  5. # -- Version : 1.0
  6. # -- Level : Easy
  7. # -- Requires : N/A
  8. # -- Engine : RPG Maker VX Ace.
  9. #
  10. #===============================================================================
  11. # ☆ Import
  12. #-------------------------------------------------------------------------------
  13. $D13x={}if$D13x==nil
  14. $D13x[:Equip_Reqs]=true
  15. #===============================================================================
  16. # ☆ Updates
  17. #-------------------------------------------------------------------------------
  18. # D /M /Y
  19. # 21/o3/2o13 - Finished,
  20. # ??/o3/2o13 - Started
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # This script enables additional requirements for equipping equipment.
  26. # you are now allowed requirements based on almost all other statistics :p
  27. # simply use notetags in the Weapon Notebox !!
  28. #
  29. # Note : all param requirements must be an integer value, eg. 1, 2, 3, 4
  30. # all x/sparam requirements must be a float value, eg. 0.1, 0.5, 1.6
  31. #
  32. #===============================================================================
  33. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  34. #===============================================================================
  35. # 1. You MUST give credit to "Dekita" !!
  36. # 2. You are NOT allowed to repost this script.(or modified versions)
  37. # 3. You are NOT allowed to convert this script.
  38. # 4. You are NOT allowed to use this script for Commercial games.
  39. # 5. ENJOY!
  40. #
  41. # "FINE PRINT"
  42. # By using this script you hereby agree to the above terms and conditions,
  43. # if any violation of the above terms occurs "legal action" may be taken.
  44. # Not understanding the above terms and conditions does NOT mean that
  45. # they do not apply to you.
  46. # If you wish to discuss the terms and conditions in further detail you can
  47. # contact me at http://dekitarpg.wordpress.com/
  48. #
  49. #===============================================================================
  50. # ☆ Instructions
  51. #-------------------------------------------------------------------------------
  52. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  53. #
  54. #===============================================================================
  55. # ☆ Notetags ( default )
  56. # For use in weapons and armor noteboxes !
  57. #-------------------------------------------------------------------------------
  58. # <req stat: value>
  59. # req stat = mhp, mmp, agi, luk, cri ect...
  60. # value = the requirement value for that weapon/armor
  61. # e.g
  62. # <req agi: 4> would make the item un-equipable until the actor has 4 agi
  63. # <req cri: 0.04> item un-equipable until 4% crit rate
  64. #
  65. # you can also use switches, variables and even define your own code for
  66. # requisites using the eval method.
  67. #===============================================================================
  68. # ☆ HELP
  69. #-------------------------------------------------------------------------------
  70. # PARAMS :
  71. # mhp, mmp, atk, def, mat, mdf, agi, luk
  72. # XPARAMS
  73. # hit, eva, cri, cev, mev, mrf, cnt, hrg, mrg, trg
  74. # SPARAMS
  75. # tgr, grd, rec, pha, mcr, tcr, pdr, mdr, fdr, exr
  76. #
  77. #-------------------------------------------------------------------------------
  78. # Remember :
  79. # All Params work with integer values, eg. 1, 5, 123, 653, 198123
  80. # All x/s-Params work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
  81. # 1.0 = 100%, 0.01 = 1%,
  82. #
  83. # ALSO:
  84. # You can have multiple switch, variable and eval requirements.
  85. #
  86. #===============================================================================
  87. module Equip_Reqs
  88. #===============================================================================
  89.  
  90. Notes={}#Notetags Customisation
  91. Notes[:lvl] = /<req lvl:(.*)>/i
  92. Notes[:mhp] = /<req mhp:(.*)>/i
  93. Notes[:mmp] = /<req mmp:(.*)>/i
  94. Notes[:atk] = /<req atk:(.*)>/i
  95. Notes[:def] = /<req def:(.*)>/i
  96. Notes[:mat] = /<req mat:(.*)>/i
  97. Notes[:mdf] = /<req mdf:(.*)>/i
  98. Notes[:agi] = /<req agi:(.*)>/i
  99. Notes[:luk] = /<req luk:(.*)>/i
  100. Notes[:hit] = /<req hit:(.*)>/i
  101. Notes[:eva] = /<req eva:(.*)>/i
  102. Notes[:cri] = /<req cri:(.*)>/i
  103. Notes[:cev] = /<req cev:(.*)>/i
  104. Notes[:mev] = /<req mev:(.*)>/i
  105. Notes[:mrf] = /<req mrf:(.*)>/i
  106. Notes[:cnt] = /<req cnt:(.*)>/i
  107. Notes[:hrg] = /<req hrg:(.*)>/i
  108. Notes[:mrg] = /<req mrg:(.*)>/i
  109. Notes[:trg] = /<req trg:(.*)>/i
  110. Notes[:tgr] = /<req tgr:(.*)>/i
  111. Notes[:grd] = /<req grd:(.*)>/i
  112. Notes[:rec] = /<req rec:(.*)>/i
  113. Notes[:pha] = /<req pha:(.*)>/i
  114. Notes[:mcr] = /<req mcr:(.*)>/i
  115. Notes[:tcr] = /<req tcr:(.*)>/i
  116. Notes[:pdr] = /<req pdr:(.*)>/i
  117. Notes[:mdr] = /<req mdr:(.*)>/i
  118. Notes[:fdr] = /<req fdr:(.*)>/i
  119. Notes[:exr] = /<req exr:(.*)>/i
  120. Notes[:var] = /<req variable:(.*),(.*)>/i # <req variable: id, req>
  121. Notes[:swi] = /<req switch:(.*)>/i # <req switch: id>
  122. Notes[:eval]= /<req eval:(.*)>/i # <req eval: 'string of code to be evaluated'>
  123.  
  124. end #####################
  125. # CUSTOMISATION END #
  126. #####################
  127. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  128. # #
  129. # http://dekitarpg.wordpress.com/ #
  130. # #
  131. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  132. #===============================================================================#
  133. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  134. # YES?\.\. #
  135. # OMG, REALLY? \| #
  136. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  137. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  138. #===============================================================================#
  139. if !$D13x[:CORE]
  140. #===============================================================================
  141. module DataManager
  142. #===============================================================================
  143. #---------------------------------------------------------------------------
  144. # Alias List
  145. #---------------------------------------------------------------------------
  146. class << self
  147. alias :lbd_unique_wepreq :load_database
  148. end
  149. #---------------------------------------------------------------------------
  150. # Load Database (alias)
  151. #---------------------------------------------------------------------------
  152. def self.load_database
  153. lbd_unique_wepreq
  154. loa_unique_wepreq
  155. end
  156. #---------------------------------------------------------------------------
  157. # Load Unique Shit
  158. #---------------------------------------------------------------------------
  159. def self.loa_unique_wepreq
  160. gr = [$data_weapons, $data_armors]
  161. for g in gr
  162. for o in g
  163. next if o == nil
  164. o.load_weapon_reqz
  165. end
  166. end
  167. end
  168.  
  169. end # DataManager
  170. end # if $D13x[:CORE]
  171.  
  172. #==============================================================================
  173. class RPG::EquipItem < RPG::BaseItem
  174. #==============================================================================
  175. #---------------------------------------------------------------------------
  176. # Alias List
  177. #---------------------------------------------------------------------------
  178. alias :deki_equip_reqz :load_unique_shit if $D13x[:CORE]
  179. #---------------------------------------------------------------------------
  180. # Pi Variables
  181. #---------------------------------------------------------------------------
  182. attr_accessor :level_req
  183. attr_accessor :param_req
  184. attr_accessor :xpars_req
  185. attr_accessor :spars_req
  186. attr_accessor :variable_req
  187. attr_accessor :switch_req
  188. attr_accessor :evals_req
  189. #---------------------------------------------------------------------------
  190. # Load Unique Shit
  191. #---------------------------------------------------------------------------
  192. def load_unique_shit
  193. deki_equip_reqz if $D13x[:CORE]
  194. load_weapon_reqz
  195. end
  196. #---------------------------------------------------------------------------
  197. # Load Equip Requirements
  198. #---------------------------------------------------------------------------
  199. def load_weapon_reqz
  200. @level_req = 0
  201. @param_req = [0] * 8
  202. @xpars_req = [0] * 10
  203. @spars_req = [0] * 10
  204. @variable_req = []
  205. @switch_req = []
  206. @evals_req = []
  207. self.note.split(/[\r\n]+/).each do |line|
  208. case line
  209. when Equip_Reqs::Notes[:lvl] then @level_req = $1.to_i
  210. when Equip_Reqs::Notes[:mhp] then @param_req[0] = $1.to_i
  211. when Equip_Reqs::Notes[:mmp] then @param_req[1] = $1.to_i
  212. when Equip_Reqs::Notes[:atk] then @param_req[2] = $1.to_i
  213. when Equip_Reqs::Notes[:def] then @param_req[3] = $1.to_i
  214. when Equip_Reqs::Notes[:mat] then @param_req[4] = $1.to_i
  215. when Equip_Reqs::Notes[:mdf] then @param_req[5] = $1.to_i
  216. when Equip_Reqs::Notes[:agi] then @param_req[6] = $1.to_i
  217. when Equip_Reqs::Notes[:luk] then @param_req[7] = $1.to_i
  218. when Equip_Reqs::Notes[:hit] then @xpars_req[0] = $1.to_f
  219. when Equip_Reqs::Notes[:eva] then @xpars_req[1] = $1.to_f
  220. when Equip_Reqs::Notes[:cri] then @xpars_req[2] = $1.to_f
  221. when Equip_Reqs::Notes[:cev] then @xpars_req[3] = $1.to_f
  222. when Equip_Reqs::Notes[:mev] then @xpars_req[4] = $1.to_f
  223. when Equip_Reqs::Notes[:mrf] then @xpars_req[5] = $1.to_f
  224. when Equip_Reqs::Notes[:cnt] then @xpars_req[6] = $1.to_f
  225. when Equip_Reqs::Notes[:hrg] then @xpars_req[7] = $1.to_f
  226. when Equip_Reqs::Notes[:mrg] then @xpars_req[6] = $1.to_f
  227. when Equip_Reqs::Notes[:trg] then @xpars_req[7] = $1.to_f
  228. when Equip_Reqs::Notes[:tgr] then @spars_req[0] = $1.to_f
  229. when Equip_Reqs::Notes[:grd] then @spars_req[1] = $1.to_f
  230. when Equip_Reqs::Notes[:rec] then @spars_req[2] = $1.to_f
  231. when Equip_Reqs::Notes[:pha] then @spars_req[3] = $1.to_f
  232. when Equip_Reqs::Notes[:mcr] then @spars_req[4] = $1.to_f
  233. when Equip_Reqs::Notes[:tcr] then @spars_req[5] = $1.to_f
  234. when Equip_Reqs::Notes[:pdr] then @spars_req[6] = $1.to_f
  235. when Equip_Reqs::Notes[:mdr] then @spars_req[7] = $1.to_f
  236. when Equip_Reqs::Notes[:fdr] then @spars_req[6] = $1.to_f
  237. when Equip_Reqs::Notes[:exr] then @spars_req[7] = $1.to_f
  238. when Equip_Reqs::Notes[:swi] then @switch_req << $1.to_i
  239. when Equip_Reqs::Notes[:var] then @variable_req << [$1.to_i,$2.to_i]
  240. when Equip_Reqs::Notes[:eval] then @evals_req << $1.to_s
  241. end
  242. end
  243. end
  244.  
  245. end # RPG::EquipItem
  246.  
  247. #==============================================================================
  248. class Game_BattlerBase
  249. #==============================================================================
  250. #---------------------------------------------------------------------------
  251. # Alias List
  252. #---------------------------------------------------------------------------
  253. alias :equip_reqz :equippable?
  254. #---------------------------------------------------------------------------
  255. # Can Be Equipped ?
  256. #---------------------------------------------------------------------------
  257. def equippable?(item)
  258. return false unless item.is_a?(RPG::EquipItem)
  259. return false if @level < item.level_req
  260. return false if param(0) < item.param_req[0]
  261. return false if param(1) < item.param_req[1]
  262. return false if param(2) < item.param_req[2]
  263. return false if param(3) < item.param_req[3]
  264. return false if param(4) < item.param_req[4]
  265. return false if param(5) < item.param_req[5]
  266. return false if param(6) < item.param_req[6]
  267. return false if param(7) < item.param_req[7]
  268. return false if xparam(0) < item.xpars_req[0]
  269. return false if xparam(1) < item.xpars_req[1]
  270. return false if xparam(2) < item.xpars_req[2]
  271. return false if xparam(3) < item.xpars_req[3]
  272. return false if xparam(4) < item.xpars_req[4]
  273. return false if xparam(5) < item.xpars_req[5]
  274. return false if xparam(6) < item.xpars_req[6]
  275. return false if xparam(7) < item.xpars_req[7]
  276. return false if xparam(8) < item.xpars_req[8]
  277. return false if xparam(9) < item.xpars_req[9]
  278. return false if sparam(0) < item.spars_req[0]
  279. return false if sparam(1) < item.spars_req[1]
  280. return false if sparam(2) < item.spars_req[2]
  281. return false if sparam(3) < item.spars_req[3]
  282. return false if sparam(4) < item.spars_req[4]
  283. return false if sparam(5) < item.spars_req[5]
  284. return false if sparam(6) < item.spars_req[6]
  285. return false if sparam(7) < item.spars_req[7]
  286. return false if sparam(8) < item.spars_req[8]
  287. return false if sparam(9) < item.spars_req[9]
  288. item.switch_req.each do |switch|
  289. return false if !$game_switches[ switch ]
  290. end
  291. item.variable_req.each do |vari|
  292. return false if $game_variables[ vari[0] ] < (vari[1]).to_i
  293. end
  294. item.evals_req.each do |evl|
  295. return false if !eval( evl )
  296. end
  297. return equip_reqz(item)
  298. end
  299.  
  300. end # class Game_BattlerBase
  301. #==============================================================================#
  302. # http://dekitarpg.wordpress.com/ #
  303. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement