When one state ends, another begins

Hey everyone! Hope this finds you well.

Soooooo i have an item in my game (beer) which applies a state 100% of the time (drunk, which is an attack buff).

What i want to do is when the state 'drunk' is removed, to have a chance to apply a different state (hangover which is a attack de-buff).

Is this possible thru the default system? I saw that Hime had a plugin for this, but their page is down. Any suggestions?

Thank you for your time!!
Can confirm it's possible, but I use Yanfly's Buffs & States Core to do it. When I get home I'll edit this post with my code; give me an hour or so. 😉 Unless someone wants to cut in and share theirs.

EDIT;

Alright, what I did in my game specifically was use both Buffs & States Core, and Yanfly's ActSeqPacks to start with a common event that would trigger on a variable counter. When you used a particular set of moves, this variable would increase; the skill would then check to see if you reached the limit, and then promptly cue the first 'attack' - which would really lead in to the state. I did this because I wanted visual animations upon starting and leaving the states that would give the player a cue of 'hey! this is a thing!'

Spoiler: More Info
Spoiler: Skill 1: Overpower
<Setup Action>
reset camera
reset zoom
display action
MOTION damage: user
shake screen: 2
animation 116: character 1
WAIT FOR ANIMATION
</Setup Action>

<Target Action>
add state 26: user
</Target action>

<Finish Action>
clear battle log
finish action
</Finish Action>
Spoiler: Overpower State
<State Animation: 117>
<Custom Leave Effect>
var skill = 205;
var target = 0;
BattleManager.queueForceAction(user, skill, target);
</Custom Leave Effect>
Spoiler: Skill 2: Exhaust
<Setup Action>
display action
MOTION damage: character 1
shake screen: 2
animation 116: character 1
change switch 5: off
wait for animation
</Setup Action>

<Target Action>
change variable 3 = 0
add state 27: user
</Target action>

<Finish Action>
clear battle log
finish action
wait: 20
</Finish Action>

Exhaust state, as present, has no effects; it simply wears off like normal without a how-de-doo.

This is it in action;



I don't know the JS to go directly from state to state; I'm certain it's possible, however. My workaround isn't 100% what you're asking, but it works for me, and if you want visuals may work for you as well.
Yeah, Ill say the same, its pretty easy to do it if you are willing yo use Yanfly StateBuff Core. If you do, we can help you.
I strongly recommend Yanfly plug ins, they can beef up your mecanics like a 1000%.

Let us know...

Original thread: https://forums.rpgmakerweb.com/threads/when-one-state-ends-another-begins.104328/