Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.1
- ★ 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
- 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
- #####################
- # CUSTOMISATION END #
- end ; end #module #####################
- #===============================================================================
- # ☆ Import:
- #===========
- $imported = {} if $imported.nil?
- $imported["DPB-PEQUIP"] = 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
- 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
- def load_notetags_req_dpbz
- @lvlreq = 0
- @vitreq = 0
- @strreq = 0
- @dexreq = 0
- @magreq = 0
- @atlreq = 0
- @dflreq = 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["DPB-PSPDS"]
- when DPB::REGEXP::EQUIPITEM::REQ_STR
- @strreq = $1.to_i if $imported["DPB-PSPDS"]
- when DPB::REGEXP::EQUIPITEM::REQ_DEX
- @dexreq = $1.to_i if $imported["DPB-PSPDS"]
- when DPB::REGEXP::EQUIPITEM::REQ_MAG
- @magreq = $1.to_i if $imported["DPB-PSPDS"]
- when DPB::REGEXP::EQUIPITEM::REQ_ATL
- @atlreq = $1.to_i if $imported["DPB-ATLANDDFL"]
- when DPB::REGEXP::EQUIPITEM::REQ_DFL
- @dflreq = $1.to_i if $imported["DPB-ATLANDDFL"]
- 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 reqdpbzstat(0) < item.vitreq if $imported["DPB-PSPDS"]
- return false if reqdpbzstat(1) < item.strreq if $imported["DPB-PSPDS"]
- return false if reqdpbzstat(2) < item.dexreq if $imported["DPB-PSPDS"]
- return false if reqdpbzstat(3) < item.magreq if $imported["DPB-PSPDS"]
- return false if reqdpbzformz(0) < item.atlreq if $imported["DPB-ATLANDDFL"]
- return false if reqdpbzformz(1) < item.dflreq if $imported["DPB-ATLANDDFL"]
- return dpbzequippable?(item)
- end
- def reqdpbzstat(id)
- return unless $imported["DPB-PSPDS"]
- return dpbzparam(id)
- end
- def reqdpbzformz(id)
- return unless $imported["DPB-ATLANDDFL"]
- return dpbzformulaz(id)
- end
- end # class Game_BattlerBase
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement