MV Help on state stacking (YEP/Yanfly plugin help)

This is a rather simple question but I am currently trying to recreate a state from another game called "Protection". It originates from Limbus Company and how it works is.

1 Stack of Protection = 10% more damage reduction.
Now what I am trying to recreate is the actual stacking property.
Example:
Enemy already has 1 stack of protection, it gains another stack by being given to it by an ally.
Now it has 2 Protection meaning it'll take 20% less damage.

I'm currently asking for help since I have no idea on how to properly recreate it.

I already both plugins required for this which is
Buffs & States Core & Lunatic Pack - State Protection.
There's not really any such thing as "stacking states" (outside of some very specialized plugins). The way you achieve such effects is demonstrated in things like Yanfly's Tip & Trick for Toxic. I'd suggest using the provided functionality of state counters rather than a variable on the battler, though.

I don't think you need the State Protection at all if you're doing straight reduction percentages like this.

Give your state these notetags from the Buffs & States Core:
Code:
<Custom Apply Effect>
target.addStateCounter(stateId, 1);
</Custom Apply Effect>

<Custom React Effect>
value-=Math.round(value * .1 * target.getStateCounter(stateId));
</Custom React Effect>
There's not really any such thing as "stacking states" (outside of some very specialized plugins). The way you achieve such effects is demonstrated in things like Yanfly's Tip & Trick for Toxic. I'd suggest using the provided functionality of state counters rather than a variable on the battler, though.

I don't think you need the State Protection at all if you're doing straight reduction percentages like this.

Give your state these notetags from the Buffs & States Core:
Code:
<Custom Apply Effect>
target.addStateCounter(stateId, 1);
</Custom Apply Effect>

<Custom React Effect>
value-=Math.round(value * .1 * target.getStateCounter(stateId));
</Custom React Effect>
Thank you and the State Protection simply made it easier for me to handle it, but I get what you're seeing. I have no idea on how to properly close a thread for it being solved but this helps a lot in future endeavors.
Thank you and the State Protection simply made it easier for me to handle it
It's easier if you're just doing one flat value all the time. But if you're doing anything that requires a formula...I looked at the monstrous bit in the "Lunatic" section, and I don't see why anyone would touch that instead of a simple calculation in a normal state tag like I demonstrated above.

I have no idea on how to properly close a thread for it being solved
Click Report on your original post and say it's solved.
This thread is being closed due to being solved. If you need it reopened, report it to let us know why. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/help-on-state-stacking-yep-yanfly-plugin-help.161033/