MV Make an enemy immune to a state after being afflicted by it once

While the title is pretty self-explanatory, there is one important detail: this isn't meant to affect every enemy in the game, just specific enemies that are given a "resistance" to the state in question.
Thanks in advance.
you could use a troop event in the battles they show up in to check if they have the state at the end of every turn, and if they do, give them an invisible state with a 0% state rate for that first state
You could also make two versions of this enemy with everything including the name identical, except the second one has the immunity.

Make the first one to be initial enemy, then make them transform into the second form with zero visual effects if they get the specific state (via a conditional branch command in the troop setting).
Probably should use "state resist" instead of "0% state rate", because then it works against certain hit attacks, right?
Probably should use "state resist" instead of "0% state rate", because then it works against certain hit attacks, right?
id have to double check, but iirc a battler gaining a resist for a state from another state removes that resisted state on application
you could use a troop event in the battles they show up in to check if they have the state at the end of every turn, and if they do, give them an invisible state with a 0% state rate for that first state
This solution doesn't work if the state is removed before the turn ends. Is there a way to check for the state as soon as it is applied?
This solution doesn't work if the state is removed before the turn ends. Is there a way to check for the state as soon as it is applied?
you would need a plugin to be able to do more. If you were using Yanfly's Buffs and States Core plugin, you'd be able to use a notetag to make state application effects.
Then you could have that effect for that state being that it automatically applies a second hidden state that drops the target's state rate for the main one to 0%, but only if theyre an enemy with some specific notetag you give them
So, something like this?

<Custom Apply Effect>
if (user.isStateAffected(18)) {
user.addState(53);
}
</Custom Apply Effect>

And I would also need to check the specific enemy ID, but I don't know how to do that.
im assuming 18 is the base state? theres no need to check if the target is affected by it in an apply effect. itll always be true. the effect only runs because they have the state

And I would also need to check the specific enemy ID, but I don't know how to do that.
as i said, you could use a notetag as your filter. a state or enemy id also works, but i figured putting something in the notebox would be an easier way to distinguish the targets.

Code:
<Custom Apply Effect>
if (user.isEnemy() && user.enemy().meta.Resist) {
  user.addState(53);
}
</Custom Apply Effect>
and you give the enemy a <Resist> notetag (or change it to whatever makes sense)
There's no need to check if the target is affected by it in an apply effect. It'll always be true.
Of course. Can't believe I did that.
Code:
<Custom Apply Effect>
if (user.isEnemy() && user.enemy().meta.Resist) {
  user.addState(53);
}
</Custom Apply Effect>
So that's how notetags work. I thought it was just something for comments and plugins.
Thanks so much for all the help.

Original thread: https://forums.rpgmakerweb.com/threads/make-an-enemy-immune-to-a-state-after-being-afflicted-by-it-once.180088/