Formula for self-destruct skill

I want an enemy to attack 3 people and then self destruct.
The following damage formula works when the scope is 'one enemy'
Code:
a.hp-=999; a.atk * 3

However, when I change the scope to '3 enemies' it appears to make no difference, only one of the party is damaged.

Can anyone advise what I should do?
Thanks
I don't know if this is even possible because I never tried it, but try to use skill effect --> HP recovery --> -9999 (flat number, not percentage). See if it actually works.

The way how the damage flows work is to execute item/skill effect after it deals damage to the target(s).


Edit:
After I looked at the code, it doesn't seem to work because the effect would also target the same target, not to the attacker. Your best bet would be to use YEA Lunatic series (it enables you to put custom effect before/after skill executed), which it's probably not friendly to setup.

Or maybe, I could try to make an alternative to lunatic series.
I think Kes means 3 random enemies for scope, 3 enemies not an option in ACE. Unless you did 3 repeats, which would use the same enemy.

I wonder though if the issue is the enemy dies, which stops the attack sequence? I know Yanfly has an ACE script where you can tag a skill with suicide which KO's the user, it's what I used with my Armageddon spell in my game.
@bgillisp you're right, I do mean 3 random enemies.
Which script are you referring to?
Lunatic Objects Destruction. I think it does require the Lunatic Objects Script too as well.
@bgillisp That looks like it will do the job nicely.
Thanks.

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/formula-for-self-destruct-skill.122024/