Exclude targets affected by a state

Sorry for the inconvenience ... I would ask for a script that allows you to exclude targets (actors or enemies) affected by a state. I know the script Tsukihime "untargetable State"
but that does not let you use a spell or object to remove it,it is very molesting to see actors taking damage or getting healed when they are petrified... Excuse me for my bad English and greetings.
Here is a simple solution I came up with

First install the Tag Manager

http://himeworks.com/tag-manager

Then insert this script (or I guess snippet) below it

Code:
class Game_Battler < Game_BattlerBase    alias :th_invulnerable_tag_item_apply :item_apply  def item_apply(*args)    return if tags.include?("invulnerable")    th_invulnerable_tag_item_apply(*args)  endend
Now if you write

Code:
<tag: invulnerable>
For your state, and you apply the state, then the battler will never be affected by anything from items or skills!
Thanks you very much for your help Tsuki! 🙂

By the way,tried to use a item for remove the state and it does not worked...
well, it's probably because:

For your state, and you apply the state, then the battler will never be affected by anything from items or skills!
maybe you can use another tag for the removal skill/item
Tags can be used for that but it would have to be more than just one line of code to account for different skills/items
can't he just make a general one?

something like:

Code:
class Game_Battler < Game_BattlerBase    alias :th_invulnerable_tag_item_apply :item_apply  def item_apply(*args)    return if tags.include?("invulnerable") and not item.tags.include?("universal")    th_invulnerable_tag_item_apply(*args)  endend
and tag the skills/items that passes thru petrify with <tag: universal>
I might have been thinking about the problem too generally


For example, if different skills could pass through only under certain circumstances, then using two tags for filtering wouldn't be enough.


In that case you would need to start using tag_cond (with the appropriate tag_conditions_met? calls) to control whether a skill/item will do anything or not.
well, in that case, of course it will be more complicated... the more conditions he needs, the more lines to be added if he's gonna do it via this method
You can take advantage of conditional tags using this

class Game_Battler < Game_BattlerBase alias :th_invulnerable_tag_item_apply :item_apply def item_apply(user, item) return unless item_tag_conditions_met?(item) th_invulnerable_tag_item_apply(user, item) endendBut this means that you need to tag EVERY single skill.For example, let's say you tagged your state with

<tag: invulnerable>Then you need to tag every skill that can't go through it as

Code:
<tag_cond: !invulnerable>
Which means that the skill will only do anything if the target didn't have an "invulnerable" tagAnother example, suppose you wanted to have a state that nullified all fire skills (not just zero damage; completely shutting out any effects as well)

<tag: no_fire>Then you just tag all your fire-type skills with

Code:
<tag_cond: !no_fire>
The tag manager supports very advanced functionality with simple tagging.It all depends on whether you can figure out how to set it up or not.
Excuse me for the late reply,i found a old script made by KGC,but it is for VX.

I haven't tested it because i dont own a Rpg Maker VX copy,but it could help a little.

Muchas gracias por todo y disculpen las molestias Tsukihime,Engr. Adiktuzmiko. (Thanks you very much for all)

Pd: I dont know if the script have a feature that lets you use a skill or item for removing the state.

Spoiler
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/#_/    ◆ 無敵ステート - KGC_Invincible ◆ VX ◆#_/    ◇ Last update : 2009/09/13 ◇#_/----------------------------------------------------------------------------#_/  無敵状態になるステートを作成します。#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/$imported = {} if $imported == nil$imported["Invincible"] = truemodule KGCmodule Invincible  module Regexp    # 無敵タイプ    INV_TYPE = /<(?:INVINCIBLE_TYPE|無敵タイプ)\s*([^>]+)>/i    module State      # 無敵      INVINCIBLE = /<(物理|魔法)?(?:INVINCIBLE|無敵)(_PHYSIC|_MAGIC)?>/i    end  endendend#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#==============================================================================# ■ RPG::UsableItem#==============================================================================class RPG::UsableItem < RPG::BaseItem  #--------------------------------------------------------------------------  # ○ 無敵ステートのキャッシュを生成  #--------------------------------------------------------------------------  def create_invincible_cache    @__inv_type = nil    self.note.each_line { |line|      if line =~ KGC::Invincible::Regexp::INV_TYPE        @__inv_type = $1      end    }    @__inv_cached = true  end  #--------------------------------------------------------------------------  # ○ 無敵タイプ  #--------------------------------------------------------------------------  def invincible_type    create_invincible_cache unless @__inv_cached    return @__inv_type  endend#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#==============================================================================# ■ RPG::State#==============================================================================class RPG::State  #--------------------------------------------------------------------------  # ○ 無敵ステートのキャッシュを生成  #--------------------------------------------------------------------------  def create_invincible_cache    @__inv_all    = false    @__inv_physic = false    @__inv_magic  = false    @__inv_type   = nil    self.note.each_line { |line|      if line =~ KGC::Invincible::Regexp::INV_TYPE        @__inv_type = $1      end      if line =~ KGC::Invincible::Regexp::State::INVINCIBLE        valid = false        if $1 == "物理" || ($2 && $2.upcase == "_PHYSIC")          @__inv_physic = true          valid = true        end        if $1 == "魔法" || ($2 && $2.upcase == "_MAGIC")          @__inv_magic = true          valid = true        end        @__inv_all = true unless valid      end    }    @__inv_cached = true  end  #--------------------------------------------------------------------------  # ○ 無敵ステートか  #--------------------------------------------------------------------------  def is_invincible?    return (all_invincible? ||      physic_invincible? ||      magic_invincible? ||      invincible_type != nil    )  end  #--------------------------------------------------------------------------  # ○ 無敵タイプ  #--------------------------------------------------------------------------  def invincible_type    create_invincible_cache unless @__inv_cached    return @__inv_type  end  #--------------------------------------------------------------------------  # ○ 完全無敵  #--------------------------------------------------------------------------  def all_invincible    create_invincible_cache if @__inv_all == nil    return @__inv_all  end  alias all_invincible? all_invincible  #--------------------------------------------------------------------------  # ○ 物理無敵  #--------------------------------------------------------------------------  def physic_invincible    create_invincible_cache if @__inv_physic == nil    return @__inv_physic  end  alias physic_invincible? physic_invincible  #--------------------------------------------------------------------------  # ○ 魔法無敵  #--------------------------------------------------------------------------  def magic_invincible    create_invincible_cache if @__inv_magic == nil    return @__inv_magic  end  alias magic_invincible? magic_invincibleend#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#==============================================================================# ■ Game_Battler#==============================================================================class Game_Battler  #--------------------------------------------------------------------------  # ● 公開インスタンス変数  #--------------------------------------------------------------------------  attr_accessor :invincible               # 無敵判定フラグ  #--------------------------------------------------------------------------  # ● 行動効果の保持用変数をクリア  #--------------------------------------------------------------------------  alias clear_action_results_KGC_Invincible clear_action_results  def clear_action_results    clear_action_results_KGC_Invincible    @invincible = false  end  #--------------------------------------------------------------------------  # ● 通常攻撃の効果適用  #     attacker : 攻撃者  #--------------------------------------------------------------------------  alias attack_effect_KGC_Invincible attack_effect  def attack_effect(attacker)    invincible_effect(attacker)    return if @skipped    attack_effect_KGC_Invincible(attacker)  end  #--------------------------------------------------------------------------  # ● スキルの効果適用  #     user  : スキルの使用者  #     skill : スキル  #--------------------------------------------------------------------------  alias skill_effect_KGC_Invincible skill_effect  def skill_effect(user, skill)    invincible_effect(user, skill)    return if @skipped    skill_effect_KGC_Invincible(user, skill)  end  #--------------------------------------------------------------------------  # ● アイテムの効果適用  #     user : アイテムの使用者  #     item : アイテム  #--------------------------------------------------------------------------  alias item_effect_KGC_Invincible item_effect  def item_effect(user, item)    invincible_effect(user, item)    return if @skipped    item_effect_KGC_Invincible(user, item)  end  #--------------------------------------------------------------------------  # ○ 無敵効果の適用  #     user : 行動者  #     obj  : スキル/アイテム (nil なら通常攻撃)  #--------------------------------------------------------------------------  def invincible_effect(user, obj = nil)    @invincible = false    clear_action_results    return unless invincible?(user, obj)    @skipped    = true    @invincible = true  end  #--------------------------------------------------------------------------  # ○ 無敵判定  #     user : 行動者  #     obj  : スキル/アイテム (nil なら通常攻撃)  #--------------------------------------------------------------------------  def invincible?(user, obj = nil)    if !(actor? ^ user.actor?) && obj != nil      return false if obj.for_friend?         # 味方なら無効化しない    end    physic = (obj == nil ? true : obj.physical_attack)  # 物理フラグ    type   = (obj == nil ? nil  : obj.invincible_type)  # 無敵タイプ    states.each { |state|      next unless state.is_invincible?      return true if state.all_invincible?      if type != nil        # 無敵タイプ指定あり        return true if state.invincible_type == type      else        # 無敵タイプ指定なし        return true if  physic && state.physic_invincible?        return true if !physic && state.magic_invincible?      end    }    return false  endend#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#==============================================================================# ■ Scene_Battle#==============================================================================class Scene_Battle < Scene_Base  #--------------------------------------------------------------------------  # ● 行動結果の表示  #     target : 対象者  #     obj    : スキルまたはアイテム  #--------------------------------------------------------------------------  alias display_action_effects_KGC_Invincible display_action_effects  def display_action_effects(target, obj = nil)    display_action_effects_KGC_Invincible(target, obj)    display_invincible(target, obj) if target.invincible  end  #--------------------------------------------------------------------------  # ○ 無敵時のメッセージを表示  #     target : 対象者  #     obj    : スキルまたはアイテム  #--------------------------------------------------------------------------  def display_invincible(target, obj)    line_number = @message_window.line_number    display_failure(target, obj)    @message_window.back_to(line_number)  endend
Did you try using conditional tags?

I have zero interest in converting others' scripts.
it is very molesting to see actors taking damage or getting healed when they are petrified...
If you want to make a state that makes the afflicted target unaffected by damage or healing, you can just set some features in the state to set PDR, MDR, and REC to 0, and add state resists as necessary, though if you really don't want them to be targeted, go for Hime's way.
Sorry for the late reply,i have problems with my internet conection since a few weeks.

I created a new skill with the "<tag_cond: !invulnerable>" but doesnt worked,the enemy/actor affected by that state continues evading the skill.

Muchas gracias por la ayuda que ustedes me brindaron (thanks you very much for your help)

Original thread: https://forums.rpgmakerweb.com/threads/exclude-targets-affected-by-a-state.25067/