A state that affects both the actor and enemy and if the state gets removed from one of them, both of them lose the state.

I'm trying to make an ability that goes like this: Actor retains an enemy with their whip. During this state, nor the enemy nor the actor can act, and if the actor or the enemy receive any damage, the state will be off.

Thing is I don't know how to make the state "syncronize" between the actor and the enemy...

Making the state is easy: Just a inmovilize state... The thing is that I cannot figure how to remove the state for both when either of them are damaged.

Any ideas?
Store both the user and its target health in a variable when the state is applied, then at the end of each turn check whether the current health is lower. If it is, you remove the state from both of them.

It does not cover the whole range of possible scenarios where one enemy might get hit since healing after taking a hit might still result in something as the battler being "not hit" if the healing amount exceeds that of the damage taken, however, it is a good possibility that only relies on events.

The optimal solution would be that of adding a small script to perform that check whenever an attack deals damage (aka a formula gets evaluated). In that case it could set a switch to true and you could use that.
Store both the user and its target health in a variable when the state is applied, then at the end of each turn check whether the current health is lower. If it is, you remove the state from both of them.

It does not cover the whole range of possible scenarios where one enemy might get hit since healing after taking a hit might still result in something as the battler being "not hit" if the healing amount exceeds that of the damage taken, however, it is a good possibility that only relies on events.

The optimal solution would be that of adding a small script to perform that check whenever an attack deals damage (aka a formula gets evaluated). In that case it could set a switch to true and you could use that.
I think it's too complicated that way... For starters, how can I store the HP in a variable when the variable asks me to choose from 1 of the 8 enemy slots? Do I have to make 8 common events based on the enemy that the player chose?

Original thread: https://forums.rpgmakerweb.com/threads/a-state-that-affects-both-the-actor-and-enemy-and-if-the-state-gets-removed-from-one-of-them-both-of-them-lose-the-state.176107/