Ninjamida 65 Posted July 22, 2012 (edited) Provoke State 1.0 by Ninjamida This lets you create a state that draws all single-target enemy attacks towards the actor who has it. (Currently it does not work for enemies.) You can make the state draw only physical attacks, only magical attacks, only special (certian hit) attacks, or all attacks. You can make individual attacks, or enemies, ignore provoke. Only one character at a time will be able to provoke each type of attack, but you can have different characters provoke different types of attacks. Usage instructions are in the script, but as a brief guide: * To make a state provoke, add one of the following notetags: <provoke physical> <provoke magical> <provoke special> <provoke all> * To make a skill, or an enemy, ignore provoke, add the following notetag: <ignore provoke> The script simply needs to be pasted into a new script, as usual. COMPATIBILITY NOTE This script is only 100% compatible with battle systems where each battler gets individual turns, rather than the turns being part of a "round" as a whole (this thus *excludes* the default battle system from compatible ones, but it should be fine with just about any CTB or ATB). It *will* work to an extent (at least with the default system), but it will only take effect from the round *after* it's inflicted (similarly, it won't stop taking effect until the round after it's removed). That aside it should work fine. I'll try and find a fix if anyone specifically wants one. As with most of my scripts, it's only tested with default and Yanfly but should work with most systems, subject to the notes above. Script: ################# # Provoke State # ################# # by Ninjamida # ################# # This script lets you make a "Provoke" state. This will draw all # single-target enemy attacks towards the selected actor. You can # set it to only draw certain types of attacks, or all. # Notetags: # <provoke all> - Draws all single-target attacks # <provoke physical> - Draws all Physical attacks # <provoke magical> - Draws all Magical attacks # <provoke special> - Draws all Special (Certain Hit) attacks # Add these to the state in question. # <ignore provoke> - Makes a skill or enemy ignore Provoke. # Add this to the skill or enemy in question. # These will only affect enemy attacks. Actor attacks can still # target as normal. class RPG::State < RPG::BaseItem def ninjamida_provoke_all if @ninjamida_provoke_all.nil? if @note =~ /<provoke all>/i @ninjamida_provoke_all = true else @ninjamida_provoke_all = false end end @ninjamida_provoke_all end def ninjamida_provoke_type if @ninjamida_provoke_type.nil? @ninjamida_provoke_type = -1 if @note =~ /<provoke physical>/i @ninjamida_provoke_type = 1 end if @note =~ /<provoke magical>/i @ninjamida_provoke_type = 2 end if @note =~ /<provoke special>/i @ninjamida_provoke_type = 0 end end @ninjamida_provoke_type end def ninjamida_provoke_state return true if ninjamida_provoke_all return true if ninjamida_provoke_type != -1 return false end end class RPG::Skill < RPG::UsableItem def ninjamida_ignore_provoke if @ninjamida_ignore_provoke.nil? if @note =~ /<ignore provoke>/i @ninjamida_ignore_provoke = true else @ninjamida_ignore_provoke = false end end @ninjamida_ignore_provoke end end class RPG::Enemy < RPG::BaseItem def ninjamida_ignore_provoke if @ninjamida_ignore_provoke.nil? if @note =~ /<ignore provoke>/i @ninjamida_ignore_provoke = true else @ninjamida_ignore_provoke = false end end @ninjamida_ignore_provoke end end class Game_Enemy < Game_Battler def ninjamida_ignore_provoke @ninjamida_ignore_provoke = $data_enemies[@enemy_id].ninjamida_ignore_provoke if @ninjamida_ignore_provoke.nil? @ninjamida_ignore_provoke end alias ninjamida_provoke_make_actions make_actions def make_actions ninjamida_provoke_make_actions return if ninjamida_ignore_provoke @actions.each do |action| unless action.nil? ptarg = $game_party.ninjamida_get_provoke_target(action.item) action.target_index = ptarg unless ptarg < 0 end end end end class Game_Battler < Game_BattlerBase alias ninjamida_provoke_add_new_state add_new_state def add_new_state(state_id) state = $data_states[state_id] $game_party.ninjamida_clear_provoke_states if state.ninjamida_provoke_all $game_party.ninjamida_clear_provoke_states(state.ninjamida_provoke_type) if state.ninjamida_provoke_state ninjamida_provoke_add_new_state(state_id) end end class Game_Actor < Game_Battler def ninjamida_provoking?(skill_type) states.each do |state| return true if state.ninjamida_provoke_all or state.ninjamida_provoke_type == skill_type end return false end def ninjamida_clear_provoke_states(provoke_type = -2) states.each do |state| remove_state(state.id) if state.ninjamida_provoke_all remove_state(state.id) if state.ninjamida_provoke_type == provoke_type remove_state(state.id) if state.ninjamida_provoke_state and provoke_type == -2 end end end class Game_Party < Game_Unit def ninjamida_get_provoke_target(skill) return -1 if skill.ninjamida_ignore_provoke or skill.for_all? members.each do |mem| return mem.index if mem.ninjamida_provoking?(skill.hit_type) end return -1 end def ninjamida_clear_provoke_states(provoke_type = -2) all_members.each do |act| act = $game_actors[act.id] act.ninjamida_clear_provoke_states(provoke_type) end end end No real need for a credits section, since it's all my own work. =) Edited July 22, 2012 by Ninjamida 1 Guava reacted to this Share this post Link to post Share on other sites