Variables and Troops Question

So I am having difficulty with troops being counted via variables.

This is the setup:

[IMG]https://i.ibb.co/2kbn3vr/Watersprite-Troop.png[/IMG]

What I would like to happen, is every time the troop dies, its added as 1 to the variable, for each specific enemy on screen killed.

What IS happening is that its doubling the value so every enemy is counted TWICE.

Example: You kill 3 Watersprites, but it gets counted twice so now you have 6 stored in the WaterSprites Variable.

How do I fix this?

Thanks
@Jenova The easiest solution is probably a little sloppy or lazy, but...I'd just add a Control Variables : #0012 WaterSprites = #0012 / 2; so that your count gets cut in half and when the quirky doubling happens you end up right. Does that work for you? 🤔

P.S. I know getting to the root of buggy behavior and squashing it is usually the better policy than workarounds, so if you manage to find the source of the problem and can fix it, well...you know...do that. 🙂
Basing on your screenshot, the variable should actually always be 1 because the event command you used was variable = 1... Maybe you're modfying it somewhere else too?
by default, if the last enemy dies the troop events are no longer executed because the victory sequence aborts them.
that is why that troop event never runs.

There are three possible solutions: you can trick the default engine by using an immortal state that is applied on first turn and removed by this troop event - then the enemy will only die after this event is processed.
Second possibility works only with evented enemies, not with random ones: have the counter in the event outside battleprocessing
Third possibility is using one of the plugins that add new triggers into the troop events, those usually contain a trigger to have the event run at battleend.
Fixed.

Solution: https://himeworks.com/files/rmmv/scripts/HIME_EndPhaseTriggers.js

This can be closed. Thanks!
This can be closed. Thanks!
then report it to be closed, mods don't read every topic
Please report it in the future as Andar says. 🙂
Since I'm here now:

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/variables-and-troops-question.109142/