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 - Learn Skill Requirements
- # -- Author : Dekita
- # -- Version : 1.3
- # -- Level : Easy / Normal
- # -- Requires : $D13x - Statistic Control
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Skill_Reqs]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 14/o5/2o13 - Update, (Skill/Skill Level Requirements)
- # - Bugfix, (eval notetag)
- # 26/o3/2o13 - Compatibility, (Elements Control)
- # 23/o3/2o13 - Bugfix, (forgetting skills when negative HRG/MRG/TRG)
- # 21/o3/2o13 - Fixed typo in notetag info section,
- # 13/o3/2o13 - Finished,
- # 1o/o3/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script enables additional requirements for learning skills.
- # other than the default level requirement, 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 CLASS Skill Learn Notebox !!
- #
- # You can also allow for skills to be forgotten if the requirements
- # are no longer met.
- # eg. removed equipment / leveled down ...
- #
- # 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 Under My $D13x - Staistic Control Script.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For use with Class Skill Learn noteboxes only !
- #-------------------------------------------------------------------------------
- # <stat req: value>
- # stat req = mhp, mmp, agi, luk, cri ect...
- # value = the value for that skill, for that class
- # e.g
- # <agi req: 4> would make the skill unlearnable until the actor has 4 agi
- # <cri req: 0.04> unlearnable 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>
- #
- # v1.3 introduces the ability to have skill / skill level requirements.
- # eg.. need skill 5 before learning skill 6
- # or need skill 6 @ level 10 before learning skill 7 ect..
- # This could of course be done by using the <eval: X> notetag like this...
- # <eval req: skills_lv(6) < 10 > (TESTED and works 100%)
- #
- # NOTE:
- # eval notetag return FALSE if eval condition is TRUE,
- # eg.. the above notetag would return false if the skill 6's level is < 10
- #
- # you could also do things like equip requirements or actor name requirements
- # or playtime requirements or whatever by using the eval notetag,
- # this, of course, requires basic scripting knowledge.
- #
- #===============================================================================
- # ☆ 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:
- # If you want to have multiple requirements for learning skills,
- # simply seperate the notetags with \n
- # this will trigger a new note to be read :)
- #===============================================================================
- module Skill_Reqz
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ General Settings
- #--------------------------------------------------------------------------
- # Make this true if you wish to forget skills if a character
- # levels down and no longer meets the requirements.
- Lv_Down_Remove_Skills = true # false
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Notetag Settings
- #--------------------------------------------------------------------------
- Notes={}
- Notes[:mhp] = /<mhp req:(.*)>/i
- Notes[:mmp] = /<mmp req:(.*)>/i
- Notes[:atk] = /<atk req:(.*)>/i
- Notes[:def] = /<def req:(.*)>/i
- Notes[:mat] = /<mat req:(.*)>/i
- Notes[:mdf] = /<mdf req:(.*)>/i
- Notes[:agi] = /<agi req:(.*)>/i
- Notes[:luk] = /<luk req:(.*)>/i
- Notes[:hit] = /<hit req:(.*)>/i
- Notes[:eva] = /<eva req:(.*)>/i
- Notes[:cri] = /<cri req:(.*)>/i
- Notes[:cev] = /<cev req:(.*)>/i
- Notes[:mev] = /<mev req:(.*)>/i
- Notes[:mrf] = /<mrf req:(.*)>/i
- Notes[:cnt] = /<cnt req:(.*)>/i
- Notes[:hrg] = /<hrg req:(.*)>/i
- Notes[:mrg] = /<mrg req:(.*)>/i
- Notes[:trg] = /<trg req:(.*)>/i
- Notes[:tgr] = /<tgr req:(.*)>/i
- Notes[:grd] = /<grd req:(.*)>/i
- Notes[:rec] = /<rec req:(.*)>/i
- Notes[:pha] = /<pha req:(.*)>/i
- Notes[:mcr] = /<mcr req:(.*)>/i
- Notes[:tcr] = /<tcr req:(.*)>/i
- Notes[:pdr] = /<pdr req:(.*)>/i
- Notes[:mdr] = /<mdr req:(.*)>/i
- Notes[:fdr] = /<fdr req:(.*)>/i
- Notes[:exr] = /<exr req:(.*)>/i
- Notes[:swi] = /<switch req:(.*)>/i # <switch req: switch_id>
- Notes[:var] = /<variable req:(.*),(.*)>/i # <variable req: vari_id, value>
- Notes[:eval]= /<eval req:(.*)>/i # <eval req: 'string of code to be evaluated'>
- Notes[:atk_ele]= /<atk ele req:(.*),(.*)>/
- Notes[:def_ele]= /<def ele req:(.*),(.*)>/
- Notes[:skills] = [/<skill req:(.*),(.*)>/i,/<skill req:(.*)>/i]
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- # The following code is protected under the 2013 Dekita Data Protection Act. #
- # Ie. The “Do Not Fucking Look” Law. #
- # Breaking This One And Only Rule WILL Result in SEVERE BRAIN FREEZE. #
- # That is all ! #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- if !$D13x[:CORE]
- #===============================================================================
- module DataManager
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- class << self
- alias :load_database_skillreqz :load_database
- end
- #--------------------------------------------------------------------------
- # Load Database
- #--------------------------------------------------------------------------
- def self.load_database
- load_database_skillreqz
- load_notetags_skillreqz
- end
- #--------------------------------------------------------------------------
- # Load Notetags
- #--------------------------------------------------------------------------
- def self.load_notetags_skillreqz
- for obj in $data_classes
- next if obj.nil?
- obj.load_skill_requirements
- end
- end
- end # DataManager
- end # if !$D13x[:CORE]
- #===============================================================================
- class RPG::Class < RPG::BaseItem
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :deki_ls_reqz_load :load_unique_shit if $D13x[:CORE]
- #---------------------------------------------------------------------------
- # load unique shit
- #---------------------------------------------------------------------------
- def load_unique_shit
- deki_ls_reqz_load if $D13x[:CORE]
- load_skill_requirements
- end
- #--------------------------------------------------------------------------
- # Load All Learnable Skills Requirements
- #--------------------------------------------------------------------------
- def load_skill_requirements
- @learnings.each { |l| l.load_skill_requirements }
- end
- end # RPG::Class
- #===============================================================================
- class RPG::Class::Learning
- #===============================================================================
- #--------------------------------------------------------------------------
- # Pi Variables
- #--------------------------------------------------------------------------
- attr_accessor :param_req
- attr_accessor :xpars_req
- attr_accessor :spars_req
- attr_accessor :swtch_req
- attr_accessor :varis_req
- attr_accessor :evals_req
- attr_accessor :atk_ele_req
- attr_accessor :def_ele_req
- attr_accessor :skill_req
- #--------------------------------------------------------------------------
- # Load All Skill Requirements
- #--------------------------------------------------------------------------
- def load_skill_requirements
- @param_req = [0] * 8
- @xpars_req = [0] * 10
- @spars_req = [0] * 10
- @swtch_req = []
- @varis_req = []
- @evals_req = []
- @skill_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(/\\n/i).each do |line|
- case line
- when Skill_Reqz::Notes[:mhp] then @param_req[0] = $1.to_i
- when Skill_Reqz::Notes[:mmp] then @param_req[1] = $1.to_i
- when Skill_Reqz::Notes[:atk] then @param_req[2] = $1.to_i
- when Skill_Reqz::Notes[:def] then @param_req[3] = $1.to_i
- when Skill_Reqz::Notes[:mat] then @param_req[4] = $1.to_i
- when Skill_Reqz::Notes[:mdf] then @param_req[5] = $1.to_i
- when Skill_Reqz::Notes[:agi] then @param_req[6] = $1.to_i
- when Skill_Reqz::Notes[:luk] then @param_req[7] = $1.to_i
- when Skill_Reqz::Notes[:hit] then @xpars_req[0] = $1.to_f
- when Skill_Reqz::Notes[:eva] then @xpars_req[1] = $1.to_f
- when Skill_Reqz::Notes[:cri] then @xpars_req[2] = $1.to_f
- when Skill_Reqz::Notes[:cev] then @xpars_req[3] = $1.to_f
- when Skill_Reqz::Notes[:mev] then @xpars_req[4] = $1.to_f
- when Skill_Reqz::Notes[:mrf] then @xpars_req[5] = $1.to_f
- when Skill_Reqz::Notes[:cnt] then @xpars_req[6] = $1.to_f
- when Skill_Reqz::Notes[:hrg] then @xpars_req[7] = $1.to_f
- when Skill_Reqz::Notes[:mrg] then @xpars_req[6] = $1.to_f
- when Skill_Reqz::Notes[:trg] then @xpars_req[7] = $1.to_f
- when Skill_Reqz::Notes[:tgr] then @spars_req[0] = $1.to_f
- when Skill_Reqz::Notes[:grd] then @spars_req[1] = $1.to_f
- when Skill_Reqz::Notes[:rec] then @spars_req[2] = $1.to_f
- when Skill_Reqz::Notes[:pha] then @spars_req[3] = $1.to_f
- when Skill_Reqz::Notes[:mcr] then @spars_req[4] = $1.to_f
- when Skill_Reqz::Notes[:tcr] then @spars_req[5] = $1.to_f
- when Skill_Reqz::Notes[:pdr] then @spars_req[6] = $1.to_f
- when Skill_Reqz::Notes[:mdr] then @spars_req[7] = $1.to_f
- when Skill_Reqz::Notes[:fdr] then @spars_req[6] = $1.to_f
- when Skill_Reqz::Notes[:exr] then @spars_req[7] = $1.to_f
- when Skill_Reqz::Notes[:swi] then @swtch_req << $1.to_i
- when Skill_Reqz::Notes[:var] then @varis_req << [$1.to_i,$2.to_i]
- when Skill_Reqz::Notes[:eval] then @evals_req << $1.to_s
- when Skill_Reqz::Notes[:atk_ele] then @atk_ele_req[$1.to_i] = $2.to_f
- when Skill_Reqz::Notes[:def_ele] then @def_ele_req[$1.to_i] = $2.to_f
- when Skill_Reqz::Notes[:skills][0] then @skill_req << [$1.to_i, $2.to_i]
- when Skill_Reqz::Notes[:skills][1] then @skill_req << [$1.to_i, 1]
- end
- end
- end
- end # RPG::Class::Learning
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :lv_dwn_xtra_reqzz__sD13x :lv_down_extra
- alias :ls_reqzz__sD13x :learn_skill_conditions_met?
- #--------------------------------------------------------------------------
- # Level Down Extra Shit
- #--------------------------------------------------------------------------
- def lv_down_extra
- lv_dwn_xtra_reqzz__sD13x
- forget_skill__lv_down
- end
- #--------------------------------------------------------------------------
- # Level Down Extra Shit
- #--------------------------------------------------------------------------
- def forget_skill__lv_down
- if Skill_Reqz::Lv_Down_Remove_Skills
- self.class.learnings.each do |lning|
- forget_skill(lning.skill_id) if !learn_skill_conditions_met?(lning)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Get Learning Skill Conditions
- #--------------------------------------------------------------------------
- def learn_skill_conditions_met?(learning, mult = 1.0 )
- return false if param(0) < (learning.param_req[0] * mult).to_i
- return false if param(1) < (learning.param_req[1] * mult).to_i
- return false if param(2) < (learning.param_req[2] * mult).to_i
- return false if param(3) < (learning.param_req[3] * mult).to_i
- return false if param(4) < (learning.param_req[4] * mult).to_i
- return false if param(5) < (learning.param_req[5] * mult).to_i
- return false if param(6) < (learning.param_req[6] * mult).to_i
- return false if param(7) < (learning.param_req[7] * mult).to_i
- return false if xparam(0) < (learning.xpars_req[0] * mult).to_f
- return false if xparam(1) < (learning.xpars_req[1] * mult).to_f
- return false if xparam(2) < (learning.xpars_req[2] * mult).to_f
- return false if xparam(3) < (learning.xpars_req[3] * mult).to_f
- return false if xparam(4) < (learning.xpars_req[4] * mult).to_f
- return false if xparam(5) < (learning.xpars_req[5] * mult).to_f
- return false if xparam(6) < (learning.xpars_req[6] * mult).to_f
- return false if xparam(7) < (learning.xpars_req[7] * mult).to_f
- return false if xparam(8) < (learning.xpars_req[8] * mult).to_f
- return false if xparam(9) < (learning.xpars_req[9] * mult).to_f
- return false if sparam(0) < (learning.spars_req[0] * mult).to_f
- return false if sparam(1) < (learning.spars_req[1] * mult).to_f
- return false if sparam(2) < (learning.spars_req[2] * mult).to_f
- return false if sparam(3) < (learning.spars_req[3] * mult).to_f
- return false if sparam(4) < (learning.spars_req[4] * mult).to_f
- return false if sparam(5) < (learning.spars_req[5] * mult).to_f
- return false if sparam(6) < (learning.spars_req[6] * mult).to_f
- return false if sparam(7) < (learning.spars_req[7] * mult).to_f
- return false if sparam(8) < (learning.spars_req[8] * mult).to_f
- return false if sparam(9) < (learning.spars_req[9] * mult).to_f
- learning.swtch_req.each do |switch|
- return false if !$game_switches[ switch ]
- end
- learning.varis_req.each do |vari|
- return false if $game_variables[ vari[0] ] < (vari[1] * mult).to_i
- end
- learning.evals_req.each do |evl|
- return false if eval( evl.to_s )
- end
- if $D13x[:Elems_Control]
- $data_system.elements.size.times do |i|
- return false if element_rate(i) < learning.def_ele_req[i]
- return false if atk_element_rate(i) < learning.atk_ele_req[i]
- end
- end
- learning.skill_req.each do |skil|
- return false if !skills.include?($data_skills[skil[0]])
- return false if skills_lv(skil[0]) < skil[1] if $D13x[:Skill_Lv]
- end
- return ls_reqzz__sD13x(learning, mult)
- end
- end # Game_Actor
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement