Enemy death after using it's skill

Hey guys, I am having a little bit of difficulty creating a skill. I am essentially trying to make a skill similar to what the bombs in Final Fantasy has, where the enemy blows up, killing itself and damaging the players.

I have tried several ways, including adding a.add_state(1)to the damage formula. While this does  seem to kill the enemy, it leaves it battle on the screen.

Any suggestions?
Just put:

a.hp -= a.hp; damage_formulaas the formula and it should kill the attacker as the skill is used.
How odd, similar to above, that works but the battler remains on the battlefield.
What scripts are you using, that shouldn't be happening. (what about killing them normally?)
The only script I have running is Wortana's Multiple Fog script.

If I kill it normally the battler fades away as normal. However, if I let it use the "burst" skill (enemy bursts leaving a chance to poison the party and killing the enemy) then the enemy dies, is no longer selectable in battle, but the battler remains.

Spoiler
Start of fight:

2upu3uu.jpg


Slime using Burst:

2wddmqw.jpg


Slime unable to be selected, but Swamp Rat is:

34gqamd.jpg


End of battle, Swamp Rat battler is gone, Slime battler remains:

5mx2rc.jpg
The only script I have running is Wortana's Multiple Fog script.

If I kill it normally the battler fades away as normal. However, if I let it use the "burst" skill (enemy bursts leaving a chance to poison the party and killing the enemy) then the enemy dies, is no longer selectable in battle, but the battler remains.
Hmm... comment retracted. Apparently this is actually a base game bug and I just assumed it was something else because a battle script I'm using already fixes it, but in a base unaltered game it does exactly as you've described. (I'm not sure which script I have that fixes this, however. My first thought was yanfly's battle script but it still does it with that one alone.)

Ok, a fix that I actually tested to work is as follows: Create the skill and have only the actual damage processing in your formula box. Have it also call a common event that turns on a switch. Go to the troop event of any troops that include this enemy and have a page set to a span of 'turn' and the conditional that 'switch[switch_id] is on' and have that event kill off the enemy that uses that skill and turn off the switch. (in the event that you have a troop with multiple enemies with said skill, add: a.add_state[state_u_r_not_using] to the formula and perform a conditional check for which enemy has said state to determine who to kill. I just use the troop event because it's easier than doing 8 conditional checks because you know already exactly which enemies will possibly use the skill.) Hope I helped this time.
Alas, no luck:

Spoiler
Event Screen (Burst skill calls the common event Burst, which in turn turns on the switch Burst Switch)

330g4er.jpg


Switch is turned in (I added Yanfly's Extended Debugging Tools script to ensure):

ae8nrb.jpg


It kills off the enemy like it should, because I can no longer select it in the next round, but it leaves the battler still. I guess I am going to have to find a script for it if I want to use it.
Don't use a conditional branch in the battle event for the switch. You see the box that says 'Condition: Turn number 0'? change that condition to show that the switch is on instead, a conditional branch in the event would only be used for checking multiple enemies to see which one has the dummy state in a troop where you have more than one enemy with the 'burst' skill. The way you have it set up it will check for the switch being on only on turn 0 (which is before anyone can have any chance to choose an action) changing that to: switch[0002] is on will make the event activate whenever the switch is turned on, but if you have more than one with the skill again make sure you set span to 'turn' so that it can occur more than once. (also make sure at the end of that event you turn the switch off, otherwise after using the skill once all enemies with the burst skill will instantly die at the beginning of each battle.)

Edit: actually lower the enemies hp by it's max amount (or 999999 is what I tested) I'm not sure what is going on with actually applying the death state but it doesn't seem that it works like it should.
Yay. That worked. Thank you VERY much, Alexander!
I found a workaround for this. (since i am also working on a kamikaze enemy). Without having to use switches.

In your damage formula, you can put a.perform_collapse_effect to force the collapse effect.

So personally i have :
"a.hp -= 5;a.perform_collapse_effect;5"
which deals 5 damages to itself and the party.

(I'm letting future people know if they stumble upon this thread like I did).

Original thread: https://forums.rpgmakerweb.com/threads/enemy-death-after-using-its-skill.23925/