#============================================================================== # ** Passive Skills VXAce #------------------------------------------------------------------------------ # by Syvkal # Version 1.1 # 20-03-12 #------------------------------------------------------------------------------ # * Original available at: # www.rpgmakervxace.net & forums.rpgmakerweb.com # Please do not redistribute this script #------------------------------------------------------------------------------ # * Terms of Use # Available for use in commercial games provided that I get a free copy :P # Email me: syvkal@hotmail.co.uk # Please do not redistribute this script #============================================================================== # # - INTRODUCTION - # # This script can be used to make 'Passive Skills' or 'Abilities' # These are skills that will always be in effect and don't need activating # # - I M P O R T A N T ------------------------------- # # This script requires my 'Notes Field System' V1.0 or above # # It also requires you to wrap any text currently in the skills notes field # with '<' and '>' # # So for the skill Attack, where it says: # # Skill #1 will be used when you select # the Attack command. # # Change it so it says: # # # #------------------------------------------------------------------------------ # # - USAGE - # # I have tried to make this script as simple as possible, so here goes # (also make sure you have read the Notes Field System instructions) # # --- Setting up a Passive Skill -------------------- # # To define a skill as passive place this in the notes field: # # :passive => x # # Where 'x' is the ID of the weapon you wish to use as a 'dummy' # The skill will then inherit all the Features and Parameter Changes # defined in the dummy weapon # # --- Hiding a Passive Skill ------------------------ # # There are a few ways to prevent Passive skills from showing up: # # Firstly, you can simply set the Skill Type as 'none' # This will prevent it from being shown anywhere # # Alternatively, say you want a section in you Skills Menu where you can # view your passive skills and have added a new skill type and for example # called it 'Passive'. But now you don't want a specific skill to show # up even in that section, simply place this in the notes field: # # :noshow => true # # This can be used for other normal skills as well if you so wish # # Finally, say you have added this new Skill Type to view you passive skills. # But now you don't want that option to appear in battle, simply add the # name to the list in the configuration section. # You can hide more than one Skill Type this way # #------------------------------------------------------------------------------ # # - COMPATIBILITY - # # The script uses no redefinitions, only Aliases. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # This script Aliases the following methods: # * initialize (Game_Actor) # * learn_skill (Game_Actor) # * forget_skill (Game_Actor) # * feature_objects (Game_Actor) # * param_plus (Game_Actor) # * usable? (Game_BattlerBase) # * include? (Window_SkillList) # * add_skill_commands (Window_ActorCommand) # #============================================================================== #===================================================# # ** C O N F I G U R A T I O N S Y S T E M ** # #===================================================# #-------------------------------------------------------------------------- # * Actor Command Ignore List # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # An array of command names that will be removed for any actors menu # during battle #-------------------------------------------------------------------------- BATTLE_IGNORE = [ 'Passive' ] #===================================================# # ** E N D C O N F I G U R A T I O N ** # #===================================================# #============================================================================== # ** Script Import #============================================================================== $imported = {} if $imported == nil $imported["Passive Skills"] = true #============================================================================== # ** RPG::Skill #------------------------------------------------------------------------------ # Added Passive Check. #============================================================================== class RPG::Skill < RPG::UsableItem #-------------------------------------------------------------------------- # * Includes The NOTES Module #-------------------------------------------------------------------------- include NOTES #-------------------------------------------------------------------------- # * Get Passive? #-------------------------------------------------------------------------- def passive? return note_field.include?(:passive) end end #============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # Adds Passive Skill Dummies to features list. # Refreshes list on learning and forgetting skills. #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias initialize_passive_dummies_original initialize alias learn_skill_passive_dummies_original learn_skill alias forget_skill_passive_dummies_original forget_skill alias feature_objects_passive_dummies_original feature_objects alias param_plus_passive_dummies_original param_plus #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :available_skills #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_id) @available_skills = [] initialize_passive_dummies_original(actor_id) end #-------------------------------------------------------------------------- # * Get Array of Currently Usable Passive Skills #-------------------------------------------------------------------------- def available_skills skills.select {|skill| skill_wtype_ok?(skill) && skill_cost_payable?(skill) && !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id) } end #-------------------------------------------------------------------------- # * Learn Skill #-------------------------------------------------------------------------- def learn_skill(skill_id) learn_skill_passive_dummies_original(skill_id) @available_skills = available_skills end #-------------------------------------------------------------------------- # * Forget Skill #-------------------------------------------------------------------------- def forget_skill(skill_id) forget_skill_passive_dummies_original(skill_id) @available_skills = available_skills refresh end #-------------------------------------------------------------------------- # * Get Array of Passive Skills # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Not actually used #-------------------------------------------------------------------------- def passive_skills @skills.select {|skill| passive?(skill) }.collect {|id| $data_skills[id] } end #-------------------------------------------------------------------------- # * Get Array of Passive Skills Dummies #-------------------------------------------------------------------------- def passive_skills_dummies @available_skills.select {|skill| skill.passive? }.collect {|id| $data_weapons[id.note_field[:passive]] } end #-------------------------------------------------------------------------- # * Determine Skill Passive? #-------------------------------------------------------------------------- def passive?(skill) $data_skills[skill].passive? end #-------------------------------------------------------------------------- # * Get Array of All Objects Retaining Features #-------------------------------------------------------------------------- def feature_objects feature_objects_passive_dummies_original + passive_skills_dummies end #-------------------------------------------------------------------------- # * Get Added Value of Parameter #-------------------------------------------------------------------------- def param_plus(param_id) passive_skills_dummies.compact.inject(param_plus_passive_dummies_original(param_id)) {|r, item| r += item.params[param_id] } end end #============================================================================== # ** Game_BattlerBase #------------------------------------------------------------------------------ # Flags Passive Skills as unusable. #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias usable_passive_skills_original usable? #-------------------------------------------------------------------------- # * Determine Skill/Item Usability #-------------------------------------------------------------------------- def usable?(item) return false if item.is_a?(RPG::Skill) && item.passive? usable_passive_skills_original(item) end end #============================================================================== # ** Window_SkillList #------------------------------------------------------------------------------ # Excludes any skills with the :noshow tag. #============================================================================== class Window_SkillList < Window_Selectable #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias include_noshow_original include? #-------------------------------------------------------------------------- # * Include in Skill List? #-------------------------------------------------------------------------- def include?(item) return false if item.note_field.include?(:noshow) include_noshow_original(item) end end #============================================================================== # ** Window_ActorCommand #------------------------------------------------------------------------------ # Excludes any commands listed in the BATTLE_IGNORE array. #============================================================================== class Window_ActorCommand < Window_Command #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias add_skill_commands_passive_battle_original add_skill_commands #-------------------------------------------------------------------------- # * Add Skill Command to List #-------------------------------------------------------------------------- def add_skill_commands add_skill_commands_passive_battle_original BATTLE_IGNORE.each {|command| @list.delete_if {|x| x[:name] == command } } end end