MV Looking for a Stage Stages Plugin

I have been looking for days for a Stage Stages plugin for MV and cannot find one. If someone could find one or make one you would be amazing. Let me explain what i want just in case someone out there does make a plugin for me. I want a plugin that once a certain state has been applied to an actor multiple times, they loose the current state and gain a new one.
For example if Actor has the state 'Stun' and then they get the Stun state again, they loose the Stun state and gain a new state called 'Palarysis'. I hope you all have a great day 🙂
There's a post from @caethyril in a thread from over a year ago that might be the key. Would only require Yanfly's Buffs and States Core.
Alternatively (with the YEP Buffs & States Core plugin):
JavaScript:
<Custom Apply Effect>
// Check if the target is already affected with State 5
if (user.isStateAffected(5)) {
// If so, remove state 4 and state 5 and add the new state 7
user.removeState(4);
user.removeState(5);
user.addState(7);
};
</Custom Apply Effect>
Alternatively (with the YEP Buffs & States Core plugin):
Thank you so much, just one question. Where would I put this code? I'm guessing in the State Notebox but just making sure.

Edit:
I plugged in the code into the StateNotebox and it instantly applied the Stage 2 of the state even tho I hadnt applied Stage 1 first. Bassically when I applied stage 1, it didnt do that and applied stage 2
Show us what code your posted into the notebox so we can check it out?
Thank you so much, just one question. Where would I put this code? I'm guessing in the State Notebox but just making sure.

Edit:
I plugged in the code into the StateNotebox and it instantly applied the Stage 2 of the state even tho I hadnt applied Stage 1 first. Bassically when I applied stage 1, it didnt do that and applied stage 2

Click on the little blue arrow that is pointing upwards in the quote and it will take you to the quoted message. I explained the usage there a little more detailed.
Show us what code your posted into the notebox so we can check it out?
don't worry, I've figured it out with a different plugin haha. Thanks for trying to help, have a great day!

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-stage-stages-plugin.167187/