Ignoring a Player if They Are In a Certain State

I'm developing a custom game over system in RPG Maker, and I'm leaving the default #1 Death state for the enemies only. Actors resist this state and instead go into a custom "Defeated" State. If all party members are in this state, the battle is set to end and go to a screen that allows them to either "seek guidance", where they get hints on how to win the battle, retry the battle/scene, restore, or quit the game. It also includes a little counter letting them know how many times they've been defeated.

So far I've gotten it to work well without much scripting (Combination of custom battle, common events, a special "game over" map, and a switch/variable combo). The only bug I'm seeing with the system is that even with the Target Rate set at 0, AOE attacks and heals can still affect the downed actor, and the actor can be a target for individual healing spells. Moreover, any "revival" spells are currently set to affect anyone not in that state.

Is there a subscript/conditional check script I can set up so that the enemy (and other actors, for that matter) treat the "Defeated" state actor like he/she is dead, and can I set it so that only certain spells can work on the character while in that state, just like revival spells do for dead actors?
Make the Defeated state give them 100%+ resistance to everything?
I don't have the engine on this box (at work), so I can't double-check it, but I think that ought to work.
. . .you can use the formula box in RPG Maker VX Ace to check if the target is afflicted with certain state like this :

if b.state?(1);y=0;y=a.atk*2-b.def;y
if b.state?(1);y=0;y=a.atk*2-b.def;y

Got it! Now, if I use it like this: if b.state?(0);y=0;y=a.atk*2-b.def;y, does that mean the spell will not fire if that person is not inflicted with the state?
if b.state?(1);y=0;y=a.atk*2-b.def;y
This got a syntax error and redundancy (no need to set any local variables, since the last thing executed in the method will always be what the method returns anyway, in this case, the value of the formula).
Should look like this:
Code:
b.state?(1) ? 0 : a.atk*2-b.def
And no, this only prevents damage dealt IF the target got the specified state, but the skill will trigger normally regardless.
To avoid the usage of skills on targets with certain states entirely, you would need an AI script, not custom damage formulas.
Gotcha, Thanks for the info, Sixth. I appreciate it. <3
http://himeworks.com/2013/05/untargetable-state/
I knew Hime Works made something like that, but I couldn't remember what it was! Thank you xdan! I could hug you!

Hmm... it looks like it can target actors, but that makes them fully untargetable. I'd like it to be able to be targeted by certain abilities. I'll play with it and see what happens.
I knew Hime Works made something like that, but I couldn't remember what it was! Thank you xdan! I could hug you!

Hmm... it looks like it can target actors, but that makes them fully untargetable. I'd like it to be able to be targeted by certain abilities. I'll play with it and see what happens.

Hmmm... Perhaps change the state when the turn ends to a state that only prevents moving, then change it back to untargettable when the turn starts.
I'll have to play with it. I may actually revamp the system so that I override the default game over system with scripts instead.

What I'm really looking for is to make the "Defeated" status a clone of the Death status, so that revive spells and such work on the downed player just like they would if they are dead. And instead of game over when they fall, they go to the retry screen.
You could use the damage formula to check wether the target is dead.

Code:
if b.state?(21);
         value += -500;
         value += -b.mhp*3/10;
         b.remove_state(21);
         end

This code for instance would check if the target is in state 21, if he is then heal 500HP + 30% of his max HP and remove the status. You couldn't prevent the spell from targeting non-dead allies, but you could prevent it from having an effect on them. To prevent normal healing from taking effect on dead members, you change "if b.state?(21);" for "unless b.state?(21);".
Thank you, xdan, but I actually solved the problem through a very easy and minor script edit in the scene_BattleManager. I stumbled on it while playing with another script I found. By overriding the original Game Over function, I was able to get my Evaluation System working without the need for custom states. I even managed to throw in a switch so I can choose between the Evaluation System and game over if needed (add some dynamic to my game, and a sense of real danger on the final boss, maybe).

Here's the code I stumbled on:

Code:
  def self.process_defeat
    $game_message.add(sprintf(Vocab::Defeat, $game_party.name))
    wait_for_message
    if @can_lose
      revive_battle_members
      replay_bgm_and_bgs
      SceneManager.return
    else
      SceneManager.goto(Scene_Gameover)
    end
    battle_end(2)
    return true
  end

And What I modified it to:

Code:
=begin
This little snippet overrides the default Gameover Sequence with a
switch to trigger the Evaluation System.
=end

module BattleManager

  def self.process_defeat
    $game_message.add(sprintf(Vocab::Defeat, $game_party.name))
    wait_for_message
    if @can_lose
      revive_battle_members
      replay_bgm_and_bgs
      SceneManager.return
    else
    if $game_switches[40]
      revive_battle_members
      replay_bgm_and_bgs
      SceneManager.return
      $game_switches[36] = true
    else
      SceneManager.goto(Scene_Gameover)
    end
  end
    battle_end(2)
    return true
  end

end

With this, I no longer have need for custom states, or the hassle of trying to get actors and enemies to ignore that state. It instead triggers my Game Over Switch (36) which in turn triggers Common Event 22, which in turn processes the map/events I used for the Evaluation System.

I thank you so much for your help though.
Nice to know you solved it! ☺️

Original thread: https://forums.rpgmakerweb.com/threads/ignoring-a-player-if-they-are-in-a-certain-state.84819/