Glass Shield - State that nullifies damage but then breaks?

Hey all,

I want to have a buff that acts like a Glass shield. It should protect an actor in a way that it completly nullifies incoming damage, but then breaks. So I can't use "remove after x turns" because it should not been removed before. And I can't use "remove after damage", because this function is not triggered when a state nullifies it.

The only idea I got right now is to remove the shiels state in every damage formula, but is there are better way?
The better way is to use a plugin, and Yanfly's Buffs & States Core does this work well. You only need to configure the state instead of manually removing it via every single damage formula.
The better way is to use a plugin, and Yanfly's Buffs & States Core does this work well. You only need to configure the state instead of manually removing it via every single damage formula.
Actually this was something I tried. But I haven't looked a notetag which is triggered for every incoming hit. Can you help me?
Have you checked the Kyrie Eleison Tips & Tricks video? Seems like you can accomplish your desired effect with that plugin with some modifications.
I did something kinda like with without getting too cute with programming. What I did was make the state block 99% of all damage, then checked remove on damage. That way it will usually take a very low amount of damage, enough to trigger the remove on damage flag.
Actually this was something I tried. But I haven't looked a notetag which is triggered for every incoming hit. Can you help me?
Sure. I think I can help you with this. In Buffs & States Core, there is a lunatic mode which we can do a lot of interesting things to customize our states. I will edit and update the method on this post when it is done.

EDIT: Here are the codes. Put them into your state's note tag.
Code:
<Custom Apply Effect>
var atkcount = 1; //This is the attack counter. Change it to fit your purpose
target._attackCount = atkcount;
target.setStateCounter(x, target._attackCount); //Set a counter to your state. Change X to your state ID
</Custom Apply Effect>

<Custom React Effect>
//Check if actor takes dmg
if (value > 0 && !this.isHpRecover()){
//Nullify the damage taken
value = 0;
//Decrease the attack counter by 1
target._attackCount -= 1;
//Set a counter to your state. Change X to your state ID
target.setStateCounter(x, target._attackCount);
//Check if attack counter reaches 0
if (target._attackCount <=0){
//Remove the state. Change X to your state ID
target.removeState(x);}}
</Custom React Effect>

<Custom Remove Effect>
user._attackCount = undefined;
</Custom Remove Effect>
Sure. I think I can help you with this. In Buffs & States Core, there is a lunatic mode which we can do a lot of interesting things to customize our states. I will edit and update the method on this post when it is done.

EDIT: Here are the codes. Put them into your state's note tag.
Code:
<Custom Apply Effect>
var atkcount = 1; //This is the attack counter. Change it to fit your purpose
target._attackCount = atkcount;
target.setStateCounter(x, target._attackCount); //Set a counter to your state. Change X to your state ID
</Custom Apply Effect>

<Custom React Effect>
//Check if actor takes dmg
if (value > 0 && !this.isHpRecover()){
//Nullify the damage taken
value = 0;
//Decrease the attack counter by 1
target._attackCount -= 1;
//Set a counter to your state. Change X to your state ID
target.setStateCounter(x, target._attackCount);
//Check if attack counter reaches 0
if (target._attackCount <=0){
//Remove the state. Change X to your state ID
target.removeState(x);}}
</Custom React Effect>

<Custom Remove Effect>
user._attackCount = undefined;
</Custom Remove Effect>
This is pure gold!!
Haven't known of the React Effect before
I have a state similar to this, but all I did was make all enemy attacks remove the state after attacking in the effects, while the state had a passive of invincibility.

Original thread: https://forums.rpgmakerweb.com/threads/glass-shield-state-that-nullifies-damage-but-then-breaks.120308/