[Solved] If caster is killed, then the state is removed

Hello!

I'm using RPG Maker MV and I would like to have some help with a poison skill.
I'm using Yanfly's plugins and here is some examples of what I'm using:
I can post pictures of all the plugins I'm currently using if that is requested.


It works like a normal poison skill, a caster casts the poison skill on an enemy and the target gets a state.
But I want the state to be removed from the target if the caster is killed.

Example:
A casts "poison" on B
B
gets a state called "poisoned"
B takes damage when it's his turn
B attacks A
A
dies from the attack
The state called "poisoned" is removed from B


Please tell which plugins I need for this skill and state. If I'm explaining this weird please tell me.

Thank you in advance
You will definitely need Buffs & States Core (also from Yanfly). I think the approach would be that you'd want to set a variable equal to the battler object that inflicted the poison state, when the state is inflicted. On KO, check other battlers to see if the KO'ed battler was the one that inflicted it. Yanfly has a Tips & Tricks video called Leech Seed which also tracks the battler that inflicted a state, so you may want to check that video out to help you figure out the logic and syntax for the notetags.
Okay, thank you

Edit:
Thank you for the help! It works pretty good!

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/solved-if-caster-is-killed-then-the-state-is-removed.107922/