Force Actioned Skill On Death While Under State X

Hello

I'd like to request a way for a state to trigger an action on death.

example:

Player casts poison on enemy 1.

Player kills enemy 1 (enemy 1 was still poisoned)

Skill X targets a random foe.

I have a character I'd like to have a poison skill and if the foe dies while poisoned the poison spreads to a random foe afterwards. Later I'd like that skill to be upgraded so that in addition to spreading the poison, the dead foe also explodes and does damage to all other foes as well.

I've tried tinkering with yanfly's death event script but I can't seem to figure out for it to see if the foe had a state on them before death thus i'm requesting help.

Thank you in advanced!!
Sounds like Virulent Bomb and Virulent Walking Bomb from Dragon Age. I'm no scripter but I'll mess around in the database and see if such a thing is doable. :u Cuz that would be cool to have.
I believe you can simply event the enemy party, to perform an action if a specific monster registers as being dead.  Unless this isn't in RPG Maker VX Ace, but i'm pretty sure it is.

If this isn't the case, you can overwrite it with a note check and a little effort depending on the enemy you want it to work for.
^ Doable, but he's asking for a skill that can be used in more than one battle. For that you'd need something less time consuming than eventing every encounter type.

I fiddled around in the database and I'm not seeing anything that can do what you want. Further digging didn't turn up a script in existence that does what you want either, but I did find that this data is what needs to be altered: http://gyazo.com/b4f6a568a44bbb8a2471f572492cbaf0

It makes me mad because I understand how scripting works for the most part, but I don't know how to write it. :T Need to go learn.

Edit: I think I figured it out, and it seems to work like... 70% of the time in battle. I'll stop here and let you do further testing and tuning, but here's how I set it up.

Skills:

http://gyazo.com/0b4017771dc33c045341412990e39247
http://gyazo.com/44f017efeb4f94a270b0920634081ddb

http://gyazo.com/18e0b1f1b6bf6c9d9d361e13fc254189 - Gotta make sure to set this to All Allies - the enemy's team is still their allies! XD

http://gyazo.com/aace280bc159c7138e6156451e79b9b9 - A single state. Doesn't do anything but act as a conditional trigger, feel free to modify. Seemed to mess with the formula when I had it debuff hp.

Common Events:

http://gyazo.com/66a7253423e102699592098c6979ae3b

http://gyazo.com/a4f31667804a6f008afc2b228ab8cb9e - This one actually goes up to 8 but I didn't wanna screenshot the last bit.

I think the common event area is where things get murky. BUT, the deadly burst does trigger and infect other enemies... however, it doesn't trigger on death, but usually right after successful affliction. So you'll probably just see a chain reaction of poison bursty death until everything is dead. Good news is, it doesn't touch your party!
@Serpent Rose

Thanks for putting in the time to put that all together. It's pretty close to what I got going yesterday after fiddling with the editor for awhile once I realized that yanfly's death event script was messing up all my other common events in the battle and had to remove it.

I added the immortal state to all foes at start of battles and have battle events that trigger on foe's HP being at 0% that do most of what your common events do then remove the immortal state from the foe which kills them after all the triggers goes off.

it works, but this current method is very clunky and i'm sure a script would really smooth things out so I don't have to event every possible outcome each battle.

I'm sure the community would appreciate such a script as well.
It sounds like we're really close to making this work right. XD I don't really know where to go from here, though. If the vanilla system had a condition like "if Enemy = Dead, initiate Skill = n" it'd be over with. I'm gonna spend some time learning how to script just so I can make what I want because it sounds so simple to make little things like this.

Original thread: https://forums.rpgmakerweb.com/threads/force-actioned-skill-on-death-while-under-state-x.34769/