Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.3
- ★ Perfect Equip Requirements™ ★
- ===============================================================================
- ☆ Script Information:
- =======================
- A simple equipment requirements script, enter notetags into weapon/armor
- noteboxes to make item unequippable unless requirements are met.
- list of possible requirements is in the customisation.
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ 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.(into other game engines e.g RGSS2)
- 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/ or DekitaRPG@gmail.com
- ================================================================================
- ☆ History:
- ============
- D - M - Y
- 21/10/2o12 - Added Requirements for Dekita__Actors_Death_Counter
- 19/10/2o12 - Added Compatability for Dekita__CORE && Dekita__Equip
- 19/09/2o12 - Added notetag customisation,
- Added atl/dfl requirements,
- Improved methods,
- 22/08/2o12 - Started and finished.
- ===============================================================================
- ☆ Credit and Thanks to :
- ==========================
- Fomar0153 - for writing an equip requirements script and showing me how its done.
- ===============================================================================
- ☆ INSTRUCTIONS:
- =================
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- ===============================================================================
- ☆ NoteTagz:
- =============
- e.g <reqlvl: 5>
- This would make the item unequippable until the actor is level 5.
- full list of notetags below.
- =end #==========================================================================
- module DPB ; module EQUIPREQZ
- #######################
- # CUSTOMISATION BEGIN #
- #######################
- # Here is some customisation for what you type into the notetags
- # /<INSERT YOUR NOTETAG VOCAB LIKE THIS: (.*)>/i
- # <reqlvl: x>
- REQ_LVL_NOTE = /<reqlvl: (.*)>/i
- # These notetags require Dekita's - Perfect Stat Point Distribution System
- # <reqvit: x>
- REQ_VIT_NOTE = /<reqvit: (.*)>/i
- # <reqstr: x>
- REQ_STR_NOTE = /<reqstr: (.*)>/i
- # <reqdex: x>
- REQ_DEX_NOTE = /<reqdex: (.*)>/i
- # <reqmag: x>
- REQ_MAG_NOTE = /<reqmag: (.*)>/i
- # These notetags require Dekita's - Perfect Attack and Defence Levels
- # <reqatl: x>
- REQ_ATL_NOTE = /<reqatl: (.*)>/i
- # <reqdfl: x>
- REQ_DFL_NOTE = /<reqdfl: (.*)>/i
- # This notetag requires Dekita's - Actor Death Counters
- # <req dc: x>
- REQ_DEATHS_NOTE = /<req dc: (.*)>/i
- # Dekita__CORE Settings.
- Use_Equip_Reqz_Icons = true
- Req_Lvl_Vocab = "Req Lv"
- Lvl_Req_Icon = 159
- Req_Vit_Vocab = "Req Vit"
- Vit_Req_Icon = 160
- Req_Str_Vocab = "Req Str"
- Str_Req_Icon = 161
- Req_Dex_Vocab = "Req Dex"
- Dex_Req_Icon = 162
- Req_Mag_Vocab = "Req Mag"
- Mag_Req_Icon = 163
- Req_Atl_Vocab = "Req Atk Lv"
- Atl_Req_Icon = 164
- Req_Dfl_Vocab = "Req Def Lv"
- Dfl_Req_Icon = 165
- Req_Death_Vocab = "Req Deaths"
- Death_Req_Icon = 166
- #####################
- # CUSTOMISATION END #
- #####################
- def self.Requirements_For_Equip_Icons(stat)
- return Lvl_Req_Icon if stat == :req_lvl
- return Vit_Req_Icon if stat == :req_vit
- return Str_Req_Icon if stat == :req_str
- return Dex_Req_Icon if stat == :req_dex
- return Mag_Req_Icon if stat == :req_mag
- return Atl_Req_Icon if stat == :req_atl
- return Dfl_Req_Icon if stat == :req_dfl
- return Death_Req_Icon if stat == :req_adc
- return 0#nil
- end
- def self.Requirements_For_Equip_Vocab(stat)
- return Req_Lvl_Vocab if stat == :req_lvl
- return Req_Vit_Vocab if stat == :req_vit
- return Req_Str_Vocab if stat == :req_str
- return Req_Dex_Vocab if stat == :req_dex
- return Req_Mag_Vocab if stat == :req_mag
- return Req_Atl_Vocab if stat == :req_atl
- return Req_Dfl_Vocab if stat == :req_dfl
- return Req_Death_Vocab if stat == :req_adc
- return "NuLL"#nil
- end
- def self.Requirements_For_Equip_Value(target, stat)
- return Dekita__CORE::N_A_Vocab if target == false
- return "#{target.lvlreq}" if stat == :req_lvl
- return "#{target.vitreq}" if stat == :req_vit
- return "#{target.strreq}" if stat == :req_str
- return "#{target.dexreq}" if stat == :req_dex
- return "#{target.magreq}" if stat == :req_mag
- return "#{target.atlreq}" if stat == :req_atl
- return "#{target.dflreq}" if stat == :req_dfl
- return "#{target.death_req}" if stat == :req_adc
- return Dekita__CORE::N_A_Vocab
- end
- end ; end #module
- #===============================================================================
- # ☆ Import:
- #===========
- $imported = {} if $imported.nil?
- $imported[:Dekita__Equip_Requirements] = true
- #===============================================================================
- module DPB ; module REGEXP ; module EQUIPITEM
- REQ_LVL = DPB::EQUIPREQZ::REQ_LVL_NOTE
- REQ_VIT = DPB::EQUIPREQZ::REQ_VIT_NOTE
- REQ_STR = DPB::EQUIPREQZ::REQ_STR_NOTE
- REQ_DEX = DPB::EQUIPREQZ::REQ_DEX_NOTE
- REQ_MAG = DPB::EQUIPREQZ::REQ_MAG_NOTE
- REQ_ATL = DPB::EQUIPREQZ::REQ_ATL_NOTE
- REQ_DFL = DPB::EQUIPREQZ::REQ_DFL_NOTE
- REQ_ADC = DPB::EQUIPREQZ::REQ_DEATHS_NOTE
- end ; end ; end # USEABLEITEMDAMAGE ; REGEXP ; DPB
- #==============================================================================
- module DataManager
- #==============================================================================
- class <<self; alias load_database_req_dpbz load_database; end
- def self.load_database
- load_database_req_dpbz
- load_notetags_req_dpbz
- end
- def self.load_notetags_req_dpbz
- groups = [$data_weapons, $data_armors]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags_req_dpbz
- end
- end
- end
- end # DataManager
- #==============================================================================
- class RPG::EquipItem < RPG::BaseItem
- #==============================================================================
- attr_accessor :lvlreq
- attr_accessor :vitreq
- attr_accessor :strreq
- attr_accessor :dexreq
- attr_accessor :magreq
- attr_accessor :atlreq
- attr_accessor :dflreq
- attr_accessor :death_req
- def load_notetags_req_dpbz
- @lvlreq = 0
- @vitreq = 0
- @strreq = 0
- @dexreq = 0
- @magreq = 0
- @atlreq = 0
- @dflreq = 0
- @death_req = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when DPB::REGEXP::EQUIPITEM::REQ_LVL
- @lvlreq = $1.to_i
- when DPB::REGEXP::EQUIPITEM::REQ_VIT
- @vitreq = $1.to_i if $imported[:Dekita__PSPDS]
- when DPB::REGEXP::EQUIPITEM::REQ_STR
- @strreq = $1.to_i if $imported[:Dekita__PSPDS]
- when DPB::REGEXP::EQUIPITEM::REQ_DEX
- @dexreq = $1.to_i if $imported[:Dekita__PSPDS]
- when DPB::REGEXP::EQUIPITEM::REQ_MAG
- @magreq = $1.to_i if $imported[:Dekita__PSPDS]
- when DPB::REGEXP::EQUIPITEM::REQ_ATL
- @atlreq = $1.to_i if $imported[:Dekita__ATL_AND_DFL]
- when DPB::REGEXP::EQUIPITEM::REQ_DFL
- @dflreq = $1.to_i if $imported[:Dekita__ATL_AND_DFL]
- when DPB::REGEXP::EQUIPITEM::REQ_ADC
- @death_req = $1.to_i if $imported[:Dekita__Actors_Death_Counter]
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class Game_BattlerBase
- #==============================================================================
- alias dpbzequippable? equippable?
- def equippable?(item)
- return false unless item.is_a?(RPG::EquipItem)
- return false if @level < item.lvlreq
- return false if @death_counter < item.death_req if $imported[:Dekita__Actors_Death_Counter]
- return false if reqdpbzstat(0) < item.vitreq if $imported[:Dekita__PSPDS]
- return false if reqdpbzstat(1) < item.strreq if $imported[:Dekita__PSPDS]
- return false if reqdpbzstat(2) < item.dexreq if $imported[:Dekita__PSPDS]
- return false if reqdpbzstat(3) < item.magreq if $imported[:Dekita__PSPDS]
- return false if reqdpbzformz(0) < item.atlreq if $imported[:Dekita__ATL_AND_DFL]
- return false if reqdpbzformz(1) < item.dflreq if $imported[:Dekita__ATL_AND_DFL]
- return dpbzequippable?(item)
- end
- def reqdpbzstat(id)
- return unless $imported[:Dekita__PSPDS]
- return dpbzparam(id)
- end
- def reqdpbzformz(id)
- return unless $imported[:Dekita__ATL_AND_DFL]
- return dpbzformulaz(id)
- end
- end # class Game_BattlerBase
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement