Problem with Reapplying a State - Yanfly Plugins

Heya guys! Quick question for y'all, regarding a state and script I'm tryna work on. I'm essentially making a State (#93) that stacks up to 4 and every time it decays, it goes down by 1 stack. The stacking works fine, everything is awesome except for the reapplying part. No matter how I've tried to make it work, I cannot get it to reapply itself whether on Leave Effect or Remove Effect, even tried using user.stateTurns(93) = 3; and such. I've also tried making another State that was being applied on Action End and would user.addState(93) on Turn End. Any chance y'all have knowledge I do not possess? Thanks! x)

I've got the following script here:

Code:
<Custom Apply Effect>
user._rotstack = user._rotstack || 0;
user._rotstack += 1;
user._rotstack = Math.min(user._rotstack, 4);
user.setStateCounter(stateId, user._rotstack);
</Custom Apply Effect>

<Custom Leave Effect>
user.addState(93);
user._rotstack -= 1;
</Custom Leave Effect>
It's super early here, so I might be wrong about this, but MV has something in its base code that doesn't let you reapply a state in the same turn or something.

Had a problem with it in my Action Sequences. So, to get around it, I had to essentially "cut" them out of the "Don't reapply this turn" list or whatever. It's been ages and I also had some help with it.

Hopefully this information helps you too.

I used:

eval: [28, 29, 34].forEach(stateId => target.result().removedStates.splice(target.result().removedStates.indexOf(stateId)))
It's super early here, so I might be wrong about this, but MV has something in its base code that doesn't let you reapply a state in the same turn or something.

Had a problem with it in my Action Sequences. So, to get around it, I had to essentially "cut" them out of the "Don't reapply this turn" list or whatever. It's been ages and I also had some help with it.

Hopefully this information helps you too.

I used:

eval: [28, 29, 34].forEach(stateId => target.result().removedStates.splice(target.result().removedStates.indexOf(stateId)))
Hey there, thanks for your answer! Upon testing it a bit, it works! So thank you x)

A bit of clarification for anyone finding this thread, do not replace (stateId) with your stateId, replace the numbers [28, 29, 34] with your stateIds! This thread can be locked.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-reapplying-a-state-yanfly-plugins.174939/