Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Equipment - Requirements
- # -- Author : Dekita
- # -- Version : 1.3
- # -- Level : Easy
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Equip_Reqs]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # o6/o4/2o13 - Bugfix, (Severe FPS Drop)
- # 26/o3/2o13 - Compatibility, (Elements Control)
- # 23/o3/2o13 - Bugfix, (removing equip when negative HRG/MRG/TRG)
- # 21/o3/2o13 - Finished,
- # ??/o3/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script enables additional requirements for equipping equipment.
- # you are now allowed requirements based on almost all other statistics,
- # Such as param / x-param/s-param/atk element rate/def element rate :p
- # simply use notetags in the Weapon Notebox !!
- #
- # Note : all param requirements must be an integer value, eg. 1, 2, 3, 4
- # all x/sparam requirements must be a float value, eg. 0.1, 0.5, 1.6
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- # Place Below Both $D13x Statistic Control && $D13x Elements Control.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For use in weapons and armor noteboxes !
- #-------------------------------------------------------------------------------
- # <req stat: value>
- # req stat = mhp, mmp, agi, luk, cri ect...
- # value = the requirement value for that weapon/armor
- # e.g
- # <req agi: 4> would make the item un-equipable until the actor has 4 agi
- # <req cri: 0.04> item un-equipable until 4% crit rate
- #
- # you can also use switches, variables and even define your own code for
- # requisites using the eval method.
- #
- # v1.2 introduces the ability to have elemental attack and defence requirements
- # IF used with my $D13x Elements Control script.
- # The notetags for these requirements are :
- # <atk ele req: id, value>
- # <def ele req: id, value>
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # PARAMS :
- # mhp, mmp, atk, def, mat, mdf, agi, luk
- # XPARAMS
- # hit, eva, cri, cev, mev, mrf, cnt, hrg, mrg, trg
- # SPARAMS
- # tgr, grd, rec, pha, mcr, tcr, pdr, mdr, fdr, exr
- #
- #-------------------------------------------------------------------------------
- # Remember :
- # All Params work with integer values, eg. 1, 5, 123, 653, 198123
- # All x/s-Params work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
- # All Elemental Values work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01 .
- # 1.0 = 100%, 0.01 = 1%,
- #
- # ALSO:
- # You can have multiple switch, variable and eval requirements.
- #
- #===============================================================================
- module Equip_Reqs
- #===============================================================================
- Notes={}#Notetags Customisation
- Notes[:lvl] = /<req lvl:(.*)>/i
- Notes[:mhp] = /<req mhp:(.*)>/i
- Notes[:mmp] = /<req mmp:(.*)>/i
- Notes[:atk] = /<req atk:(.*)>/i
- Notes[:def] = /<req def:(.*)>/i
- Notes[:mat] = /<req mat:(.*)>/i
- Notes[:mdf] = /<req mdf:(.*)>/i
- Notes[:agi] = /<req agi:(.*)>/i
- Notes[:luk] = /<req luk:(.*)>/i
- Notes[:hit] = /<req hit:(.*)>/i
- Notes[:eva] = /<req eva:(.*)>/i
- Notes[:cri] = /<req cri:(.*)>/i
- Notes[:cev] = /<req cev:(.*)>/i
- Notes[:mev] = /<req mev:(.*)>/i
- Notes[:mrf] = /<req mrf:(.*)>/i
- Notes[:cnt] = /<req cnt:(.*)>/i
- Notes[:hrg] = /<req hrg:(.*)>/i
- Notes[:mrg] = /<req mrg:(.*)>/i
- Notes[:trg] = /<req trg:(.*)>/i
- Notes[:tgr] = /<req tgr:(.*)>/i
- Notes[:grd] = /<req grd:(.*)>/i
- Notes[:rec] = /<req rec:(.*)>/i
- Notes[:pha] = /<req pha:(.*)>/i
- Notes[:mcr] = /<req mcr:(.*)>/i
- Notes[:tcr] = /<req tcr:(.*)>/i
- Notes[:pdr] = /<req pdr:(.*)>/i
- Notes[:mdr] = /<req mdr:(.*)>/i
- Notes[:fdr] = /<req fdr:(.*)>/i
- Notes[:exr] = /<req exr:(.*)>/i
- Notes[:var] = /<req variable:(.*),(.*)>/i # <req variable: id, req>
- Notes[:swi] = /<req switch:(.*)>/i # <req switch: id>
- Notes[:eval]= /<req eval:(.*)>/i # <req eval: 'string of code to be evaluated'>
- Notes[:atk_ele]= /<atk ele req:(.*),(.*)>/
- Notes[:def_ele]= /<def ele req:(.*),(.*)>/
- end #####################
- # CUSTOMISATION END #
- #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- if !$D13x[:CORE]
- #===============================================================================
- module DataManager
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :lbd_unique_eqpreq :load_database
- end
- #---------------------------------------------------------------------------
- # Load Database (alias)
- #---------------------------------------------------------------------------
- def self.load_database
- lbd_unique_eqpreq
- loa_unique_eqpreq
- end
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def self.loa_unique_eqpreq
- classes = [$data_weapons, $data_armors]
- for g in classes
- for o in g
- next if o == nil
- o.load_equip_reqz
- end
- end
- end
- end # DataManager
- end # if $D13x[:CORE]
- #===============================================================================
- class RPG::EquipItem < RPG::BaseItem
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :deki_equip_reqz :load_unique_shit if $D13x[:CORE]
- #---------------------------------------------------------------------------
- # Pi Variables
- #---------------------------------------------------------------------------
- attr_accessor :level_req
- attr_accessor :param_req
- attr_accessor :xpars_req
- attr_accessor :spars_req
- attr_accessor :varis_req
- attr_accessor :swtch_req
- attr_accessor :evals_req
- attr_accessor :atk_ele_req
- attr_accessor :def_ele_req
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def load_unique_shit
- deki_equip_reqz if $D13x[:CORE]
- load_equip_reqz
- end
- #---------------------------------------------------------------------------
- # Load Equip Requirements
- #---------------------------------------------------------------------------
- def load_equip_reqz
- @level_req = 0
- @param_req = [0] * 8
- @xpars_req = [0] * 10
- @spars_req = [0] * 10
- @varis_req = []
- @swtch_req = []
- @evals_req = []
- @atk_ele_req = [-2.0] * $data_system.elements.size
- @def_ele_req = [-2.0] * $data_system.elements.size
- 3.times {|i| @xpars_req[i+7] = -1.0 }
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Equip_Reqs::Notes[:lvl] then @level_req = $1.to_i
- when Equip_Reqs::Notes[:mhp] then @param_req[0] = $1.to_i
- when Equip_Reqs::Notes[:mmp] then @param_req[1] = $1.to_i
- when Equip_Reqs::Notes[:atk] then @param_req[2] = $1.to_i
- when Equip_Reqs::Notes[:def] then @param_req[3] = $1.to_i
- when Equip_Reqs::Notes[:mat] then @param_req[4] = $1.to_i
- when Equip_Reqs::Notes[:mdf] then @param_req[5] = $1.to_i
- when Equip_Reqs::Notes[:agi] then @param_req[6] = $1.to_i
- when Equip_Reqs::Notes[:luk] then @param_req[7] = $1.to_i
- when Equip_Reqs::Notes[:hit] then @xpars_req[0] = $1.to_f
- when Equip_Reqs::Notes[:eva] then @xpars_req[1] = $1.to_f
- when Equip_Reqs::Notes[:cri] then @xpars_req[2] = $1.to_f
- when Equip_Reqs::Notes[:cev] then @xpars_req[3] = $1.to_f
- when Equip_Reqs::Notes[:mev] then @xpars_req[4] = $1.to_f
- when Equip_Reqs::Notes[:mrf] then @xpars_req[5] = $1.to_f
- when Equip_Reqs::Notes[:cnt] then @xpars_req[6] = $1.to_f
- when Equip_Reqs::Notes[:hrg] then @xpars_req[7] = $1.to_f
- when Equip_Reqs::Notes[:mrg] then @xpars_req[6] = $1.to_f
- when Equip_Reqs::Notes[:trg] then @xpars_req[7] = $1.to_f
- when Equip_Reqs::Notes[:tgr] then @spars_req[0] = $1.to_f
- when Equip_Reqs::Notes[:grd] then @spars_req[1] = $1.to_f
- when Equip_Reqs::Notes[:rec] then @spars_req[2] = $1.to_f
- when Equip_Reqs::Notes[:pha] then @spars_req[3] = $1.to_f
- when Equip_Reqs::Notes[:mcr] then @spars_req[4] = $1.to_f
- when Equip_Reqs::Notes[:tcr] then @spars_req[5] = $1.to_f
- when Equip_Reqs::Notes[:pdr] then @spars_req[6] = $1.to_f
- when Equip_Reqs::Notes[:mdr] then @spars_req[7] = $1.to_f
- when Equip_Reqs::Notes[:fdr] then @spars_req[6] = $1.to_f
- when Equip_Reqs::Notes[:exr] then @spars_req[7] = $1.to_f
- when Equip_Reqs::Notes[:swi] then @swtch_req << $1.to_i
- when Equip_Reqs::Notes[:var] then @varis_req << [$1.to_i,$2.to_i]
- when Equip_Reqs::Notes[:eval] then @evals_req << $1.to_s
- when Equip_Reqs::Notes[:atk_ele] then @atk_ele_req[$1.to_i] = $2.to_f
- when Equip_Reqs::Notes[:def_ele] then @def_ele_req[$1.to_i] = $2.to_f
- end
- end
- end
- end # RPG::EquipItem
- #===============================================================================
- class Game_BattlerBase
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :sd13x_FPS_fixx :initialize
- alias :param_FPS_fix :param
- alias :xparam_FPS_fix :xparam if $D13x[:Stats_Control]
- alias :sparam_FPS_fix :sparam if $D13x[:Stats_Control]
- alias :atk_ele_FPS_fix :atk_element_rate if $D13x[:Elems_Control]
- alias :def_ele_FPS_fix :element_rate if $D13x[:Elems_Control]
- alias :equip_reqz :equippable?
- #--------------------------------------------------------------------------
- # Initialize Data
- #--------------------------------------------------------------------------
- def initialize
- @param_fix = [0] * 8
- @xparam_fix = [0] * 10
- @sparam_fix = [0] * 10
- @def_ele_fix = [0] * $data_system.elements.size
- @atk_ele_fix = [0] * $data_system.elements.size
- sd13x_FPS_fixx
- end
- #--------------------------------------------------------------------------
- # Get Parameter
- #--------------------------------------------------------------------------
- def param(param_id)
- @param_fix[param_id] = param_FPS_fix(param_id)
- @param_fix[param_id]
- end
- if $D13x[:Stats_Control]
- #--------------------------------------------------------------------------
- # Get Ex-Parameter
- #--------------------------------------------------------------------------
- def xparam(xparam_id)
- @xparam_fix[xparam_id] = xparam_FPS_fix(xparam_id)
- @xparam_fix[xparam_id]
- end
- #--------------------------------------------------------------------------
- # Get Sp-Parameter
- #--------------------------------------------------------------------------
- def sparam(sparam_id)
- @sparam_fix[sparam_id] = sparam_FPS_fix(sparam_id)
- @sparam_fix[sparam_id]
- end
- end
- if $D13x[:Elems_Control]
- #--------------------------------------------------------------------------
- # Get Def Element Rate
- #--------------------------------------------------------------------------
- def element_rate(element_id)
- @def_ele_fix[element_id] = def_ele_FPS_fix(element_id)
- @def_ele_fix[element_id]
- end
- #--------------------------------------------------------------------------
- # Get Atk Element Rate
- #--------------------------------------------------------------------------
- def atk_element_rate(element_id)
- @atk_ele_fix[element_id] = atk_ele_FPS_fix(element_id)
- @atk_ele_fix[element_id]
- end
- end
- #---------------------------------------------------------------------------
- # Can Be Equipped ?
- #---------------------------------------------------------------------------
- def equippable?(item)
- return false unless item.is_a?(RPG::EquipItem)
- return false if @level < item.level_req
- 8.times do |i|
- return false if @param_fix[i] < item.param_req[i]
- end
- if $D13x[:Stats_Control]
- 10.times do |i|
- return false if @xparam_fix[i] < item.xpars_req[i]
- end
- 10.times do |i|
- return false if @sparam_fix[i] < item.spars_req[i]
- end
- end
- item.swtch_req.each do |switch|
- return false if !$game_switches[ switch ]
- end
- item.varis_req.each do |vari|
- return false if $game_variables[ vari[0] ] < (vari[1]).to_i
- end
- item.evals_req.each do |evl|
- return false if !eval( evl )
- end
- if $D13x[:Elems_Control]
- $data_system.elements.size.times do |i|
- return false if @def_ele_fix[i] < item.def_ele_req[i]
- return false if @atk_ele_fix[i] < item.atk_ele_req[i]
- end
- end
- return equip_reqz(item)
- end
- end # class Game_BattlerBase
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement