How to increase variable when battle?

Hello all... I am new in RPG Maker. I have problem when Use variable during battle. The rule is when enemy got state Fatal Sync,
Time crack, etc(State in the list event battle) The variable will increase....

After i give enemy state when enemy health is 0(they are immortal)...the variable wont increase or trigger.....
upload_2019-5-14_8-47-7.png


any solution?
@Alfin I think the problem here is that the page doesn't run until the enemy is defeated. The "is affected"s on this turn apply only if the actor actually is affected "on this turn", which they are not unless the states persist over turns. Have you set the states to last multiple turns? 🤔
So the variable wont increase if the enemy got state in that list?....btw nope... i am not set that state to the enemy last turn..... enemy got that state when i use skill spesific magic.. whatever enemy got that state in that list..variable still wont increase or not triggered
Because, like @mathmaster74 said, when enemy #1 HP is 0, essentially Knocking them out, the state's don't apply to them. If the state's don't apply, than the conditions are not followed and thus the variables will never increase.
@OmnislashXX but according to the OP they are immortal, which means the death state is not applied. And if that is not applied, then the other states are not removed.

@Alfin Your structure should basically work, so it has to be something else that interferes.
One question: is it possible that the condition HP=0 applies several times? Because with span=battle this troop event will only run the first time the HP is zero.
If that is not the case - can you show us both the immortal state and how you apply it? If the enemy is not immortal and the last enemy, this troop event would not happen due to the victory taking priority.
Additionally, I suggest you add a show text with exactly that variable at the end, so that you can check if the troop event really runs or if something else changes the variable value (for example if the same variable is controlled by a plugin that was configured in the wrong way)
@Andar - Fair point. I did not see her statement that the enemy was immortal.

That being said, yes, the action will only occur once in the battle. I believe we need to see the whole thing.
I think it would be better to span this event on EVERY turn, and check for HP <= 0% inside the Event.
You shall nest Conditional Branches inside Conditional Branches, but hey, that feels better in my mind, than what I look here.
Thank's all for solution...now solved already

I make the condition is turn end and then span is Turn...and then i make new conditional switch for variable..now they are calculate..
before i make new switch for enemy health is 0..the switch is turn on

Original thread: https://forums.rpgmakerweb.com/threads/how-to-increase-variable-when-battle.108991/