How to remove state (x) from actor if enemy is killed with state (y)

I have currently a skill, let's call it Tether, so Tether will apply state to both the caster and the target enemy, state (x) and (y) respectively. Now, I am currently figuring out how to remove State (x) should enemy with State (y) is killed, so far I have made a workaround thru conditional statement in the troop events that seems to work albeit inefficient.

Is there a way to implement this using Yanfly Buff & State Core plugin?

Clipboard_11-08-2025_01.jpg
Is there a way to implement this using Yanfly Buff & State Core plugin?
Turan has a tweak for the buffs and states core to allow death to trigger <Custom Remove Effect>.
if its only the single actor that can use the tether skill, then you can make the removal effect for state x to be remove y from all party members that have it and the opposite for state y
Turan has a tweak for the buffs and states core to allow death to trigger <Custom Remove Effect>.
if its only the single actor that can use the tether skill, then you can make the removal effect for state x to be remove y from all party members that have it and the opposite for state y
I didn't know there was a fix for the plugins, thanks! I attached this code on the State (y) plugin so if the target with the state dies, the caster loses state (x).

Code:
<Custom Remove Effect>
$gameParty.members().forEach(function(member) {
    member.removeState(x);
});
</Custom Remove Effect>

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-remove-state-x-from-actor-if-enemy-is-killed-with-state-y.180924/