How do I remove a state when another state ends?

Hello and good afternoon to the people who live in my computer!

I have a character with a unique ability (Dance). If you use that ability in combat it activates the Dancing Common Event and she gains the Dance state which lasts 5 turns, grants the restriction Cannot Move, ends at the end of battle, and breaks on damage (50%). She also adds the Dance state to all allies which increases damage dealt and critical damage dealt.

This part works great! She can't take actions while it's active, and everyone else gets a bunch of extra damage. The problem is I can't figure out how to remove the damage buff early if her Dance ends due to taking damage. I have both states set to last 5 turns, which is all well and good but I'd like the damage state to end if she loses the dancing state.

Is there any way to do this? Thanks in advance.
Can you not use a conditional branch for this?

If > Actor > State > Dancing, then (turn on dancer common event)

Else > (activate switch that turns off dancer common event?)
not by default

however there are several plugins that allow you to execute javascript on the end of a state, and that you can use to end other states.

EDIT:
@RPGLordLight won't work because parallels do not exist in battle. and troop events have different timing variants
Oh right hahaha, silly me for forgetting I'm using common events in battle with a plugin!


That's NRP_BattleParallelCommon.js, it allows you to use parallel events during battles. This should solve your issue by letting you use the appropriate conditional branch.


not by default

however there are several plugins that allow you to execute javascript on the end of a state, and that you can use to end other states.

EDIT:
@RPGLordLight won't work because parallels do not exist in battle. and troop events have different timing variants
Oh right hahaha, silly me for forgetting I'm using common events in battle with a plugin!

コモンイベントの並列処理を戦闘中も有効に【RPGツクールMZ&MVプラグイン】 - New RPG Project
That's NRP_BattleParallelCommon.js, it allows you to use parallel events during battles. This should solve your issue by letting you use the appropriate conditional branch.

YES that plugin worked perfectly. Thanks for your help! A thousand blessings upon your home, if you'll forgive the Garfield quote.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-remove-a-state-when-another-state-ends.162998/