Troubles making die an enemy

Well, the situation is the next, i'm trying to do a rpg game with tableboard system, so i'm using random values etc, making the most part in a common event, the problem is the next part, I used the next code:

$gameTroop.members()[BattleManager._action._targetIndex].gainHp(-$gameVariables.value(4));

The Variable number 4 is basically the damage i'm doing, the code basically quit the enemy HP BUT in the moment the enemy have 0 HP is not able to attack and be targeted (That is nice) but still the enemy avatar on the screen, maybe because i'm quitting him the hp and i'm not killing it. I want to know what i need to make his avatar dissapear on the screen in the moment when he has 0 HP

I tried giving him the death condition or giving him hp and quitting him it in a battle event but still not working. I literally made this account for this situation XD
It sounds as if you changed the death state (state #1), can you give a Screenshot of that state?
It sounds as if you changed the death state (state #1), can you give a Screenshot of that state?
upload_2018-6-26_0-2-53.png


Sorry if the commands are on spanish but well, the variable DamH is the variable which represents the damage, next of that comes the code when the enemy which i targeted i quit him his hp equal the DamH value and then other script for an animation. but in the moment i quit him all the hp just not dissapear
I didn't ask for how you apply damage, I asked you for a Screenshot of the death state.
That is the state with the ID #1 and it is automatically applied whenever any battler gets to zero HP.
upload_2018-6-26_3-27-59.png


Sorry if is on spanish

Original thread: https://forums.rpgmakerweb.com/threads/troubles-making-die-an-enemy.96859/