MV State that stacks effect and duration when sustained (w/ YEP BuffsStatesCore)

Been trying to puzzle this one out for a little while.

I have a character that sings songs, the idea being that they buff the entire party, and each turn that the song is sung again by that character, the buff gains an extra stack.

The buff starts at 2 stacks to give a better initial effect (and to get around that 1 stack is lost at turn end, since I do also want that songs effects to decay if the song is not sustained).

But, for whatever reason, I can't actually seem to get it to stack the effect (but the duration does seem to change). Probably something dumb I'm missing here. Here's the notebox code of the state:
Code:
<Reapply Add Turns>
<Custom Apply Effect>
user.addStateCounter(45, 1);
user.setStateTurns(45, battler.getStateCounter(45));
</Custom Apply Effect>
<Custom Turn End Effect>
user.removeStateCounter(45, 1);
user.setStateTurns(45, battler.getStateCounter(45));
</Custom Turn End Effect>
<Custom Remove Effect>
user.setStateCounter(45, 0);
user.setStateTurns(45, battler.getStateCounter(45));
</Custom Remove Effect>

The skill and state:
1772283829445.png

The Action sequence is very basic at the moment, its just there in case I want to change the look later, it doesn't do anything other than Action Effect and Action Animation and the other basics.

1772283929943.png

For Testing purposes, I've set the DEF bonus here to 50% and have a character with 30 DEF. Monitoring it with the YEP Battle Status, I can see the DEF correctly changes to 45 DEF on turn 2 (two stacks added, one lost), but then on turn 3, using the song again, there are now two stacks (four added, two lost) but the DEF is still 45. I've tried using it with a flat bonus as well (i.e. <def Plus: +50> as a state notetag) and indeed, it is stuck at 80 in that case.

Edit: In retrospect, am I just grossly misinterpreting what state counters do? Do they not actually stack the states effects by default in this manner?
but then on turn 3, using the song again, there are now two stacks (four added, two lost) but the DEF is still 45.
state counters arent stacks. they can be used to represent them and can be used in that capacity in a few ways, but theyre not the same. if you want the DEF increase to be "stackable", then AFAIK you need a stacking state plugin, to make multiple versions of the state for each level and set up apply/remove effects to control how theyre added or lost, or to use something like Quasi's param plus to multiply the DEF gain by the state counter.
state counters arent stacks. they can be used to represent them and can be used in that capacity in a few ways, but theyre not the same. if you want the DEF increase to be "stackable", then AFAIK you need a stacking state plugin, to make multiple versions of the state for each level and set up apply/remove effects to control how theyre added or lost, or to use something like Quasi's param plus to multiply the DEF gain by the state counter.
Yep, I had that sudden thought moments after my post (hence the edit at the bottom), but thanks for the confirmation. Back to the drawing board with this one lol.

Original thread: https://forums.rpgmakerweb.com/threads/state-that-stacks-effect-and-duration-when-sustained-w-yep-buffsstatescore.182666/