Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #
- # ▼ Craze's Script Asylum - Equipment Tags v1.00
- # -- Last Updated: 2020.5.11
- # -- Level: Advanced/Scripter Tool
- # -- Requires: n/a
- # -- Terms: Freely modify and use, just don't claim it as your own.
- # Please notify Craze of use in commercial projects (@silver_bolts),
- # and I'll allow it 99% of the time for free.
- #
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["CRZ-EquipmentTags"] = true
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2016-sometime - Started Script.
- # 2018.11.05 - Polished up Script for public use.
- # 2018.11.17 - Got around to testing bonus Script features; released on RMN.
- # 2020.5.11 - I actually expanded this a while ago. Pulls more data now.
- #
- #==============================================================================
- # ▼ Introduction
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This is a scripter tool to let you easily check weapons, armors, and enemies
- # for unique effects. What this means is you can take any battler, ask if it
- # has a specific tag, and use that for whatever you want.
- #
- # This script does nothing on its own, but I hope it gives you the power to
- # create more inventive and ambitious games. :)
- #
- #==============================================================================
- # ▼ Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Weapon, Armor, and Enemy Notetags -
- # These notetags go in those noteboxes in the database.
- # -----------------------------------------------------------------------------
- # <tag: string>
- #
- # Use with any string you can imagine.
- # Then, simply call for battler.e_tag?("string")
- #
- # For example, if you use <tag: cursed> on enemies, your Silver Bolts ability
- # could deal additional damage to those enemies.
- #
- # Or, you could proc an effect on a weapon where it recharges a bit of MP
- # because of <tag: manacrit> whenever you get a critical hit --
- # then user.e_tag?("manacrit") would let you do that.
- #
- # You'll need some additional coding knowledge. I suggest learning how to
- # use Yanfly's Lunatic Object/Damage/State scripts!
- #
- # Special thanks to Yanfly for teaching me how to code and giving me permission
- # a thousand years ago to use his script header format. <3
- #
- #==============================================================================
- # ▼ Compatibility
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
- # it will run with RPG Maker VX without adjusting.
- #
- # All methods are newly defined or common aliases,
- # so there's no reason it won't work. (Famous last words...!)
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- def e_tag?(str)
- if enemy? # enemies don't have equipment.
- return true if enemy.equip_tag.include?(str)
- return false
- else
- return true if actor.equip_tag.include?(str)
- for equip in weapons
- next if equip.nil?
- return true if equip.equip_tag.include?(str)
- end
- for equip in armors
- next if equip.nil?
- return true if equip.equip_tag.include?(str)
- end
- return false
- end
- end
- end # Game_Battler
- module CRZ
- module REGEXP
- module BASEITEM
- EQUIP_TAG = /<(?:TAG|tag):[ ]*(.*)>/i
- end # BASEITEM
- end # REGEXP
- end # CRZ
- #==============================================================================
- # ■ DataManager
- #==============================================================================
- module DataManager
- #--------------------------------------------------------------------------
- # alias method: load_database
- #--------------------------------------------------------------------------
- class <<self; alias load_database_tagz load_database; end
- def self.load_database
- load_database_tagz
- load_notetags_tagz
- end
- #--------------------------------------------------------------------------
- # new method: load_notetags_aee
- #--------------------------------------------------------------------------
- def self.load_notetags_tagz
- groups = [$data_actors, $data_items, $data_armors, $data_weapons, $data_enemies, $data_skills]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags_tagz
- end
- end
- end
- end # DataManager
- #==============================================================================
- # ■ RPG::BaseItem
- #==============================================================================
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :equip_tag
- #--------------------------------------------------------------------------
- # common cache: load_notetags_tagz
- #--------------------------------------------------------------------------
- def load_notetags_tagz
- @equip_tag = []
- #---
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when CRZ::REGEXP::BASEITEM::EQUIP_TAG
- @equip_tag.push($1.to_s)
- #---
- end
- } # self.note.split
- #---
- end
- def e_tag?(str)
- return true if @equip_tag.include?(str)
- return false
- end
- end # RPG::BaseItem
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement