Little help with troop condition.

Ive set up a repeatable small quest where a player goes off to hun creatures.
Random creature is choosen.
Random amount is chosen.

How ever when creatures die, the count varabke doesnt change.
Troop conditions: enemy hp (1) <= 0%
Span: moment.
If: bounty =1
Control variable : #0023 count += 1

No matter how many battles i do. The count never goes up.
Because troop events don't run when the last enemy is killed.

Is this all done via a map event, or are you using random encounters?

You can just put the variable change when the battle starts, rather than when it ends, as long as you're not allowing the player to escape or continue the game if the player loses the battle. If they win the battle, it means the enemy was defeated. If they lose, it's gameover and they have to load a saved game and the variable will be back at a previous value.

There is also a way to give the enemy the immortal state, which will let your troop event run when its HP reaches 0. At the end of the event commands, remove the immortal state.

You can also do it via plugins - I believe there are a couple, but here is one I made. There are also plugins that will force troop events to be run after the last enemy is defeated.
Span: moment.
The span give the times how often the event is triggered: once per battle, once per turn, once per action/moment.

since the enemy can only die once you should make the span "battle"
Ive set up a repeatable small quest where a player goes off to hun creatures.
Random creature is choosen.
Random amount is chosen.

How ever when creatures die, the count varabke doesnt change.
Troop conditions: enemy hp (1) <= 0%
Span: moment.
If: bounty =1
Control variable : #0023 count += 1

No matter how many battles i do. The count never goes up.

I went the Immortal State route that Shaz suggested. In its simplest form it might look something like this:

Forum_Help1a.png

Forum_Help1b.png


You'll have to abort the Battle manually, but it works. It also gives you a lot more control over what you can do when an enemy dies. You can make them scream in agony for example. 🙂
You'll have to abort the Battle manually
no need and actually a bad idea.
what you do instead is remove the immortal state by event command in that troop event, that will kill the enemy normally as soon as that command is processed at the end of the event.

additionally you don't need a switch battlebegin, that event should be conditioned to turn 0 only.
no need and actually a bad idea.
what you do instead is remove the immortal state by event command in that troop event, that will kill the enemy normally as soon as that command is processed at the end of the event.

additionally you don't need a switch battlebegin, that event should be conditioned to turn 0 only.

Just out of curiosity, but why is it a bad idea to abort the battle manually?

That's the way I do it and it hasn't seemed to cause me any problems yet. But if it's going to down the line I'd like to know about it.

I can't remember why I used the switch instead of turn 0. I only recently come back so I've forgotten why I did some things. Either way, thanks for listing ways on how to improve on the way I've been doing it.
but why is it a bad idea to abort the battle manually?
depending on the code in the battlesystem used, the abort battle can skip the battle results/victory/loot systems.
You can't know which battle plugins anyone else has when giving that advice.


but most importantly if you have multiple enemies with that sequence, the battle will be aborted after the first enemy has been killed - abort battle does not care if any other enemies are still alive when the command is given.
Removing the immortal state will kill only that specific enemy, letting the battle against the other enemies continue as normal.
depending on the code in the battlesystem used, the abort battle can skip the battle results/victory/loot systems.
You can't know which battle plugins anyone else has when giving that advice.


but most importantly if you have multiple enemies with that sequence, the battle will be aborted after the first enemy has been killed - abort battle does not care if any other enemies are still alive when the command is given.
Removing the immortal state will kill only that specific enemy, letting the battle against the other enemies continue as normal.

Oh for multiple enemies...

I was planning to turn on a switch each time an enemy died in a troop with multiple enemies then abort the battle when all the switches were turned on. But my game hasn't progressed to the point I have troops with multiple enemies yet so I'm not sure how well that will work.

Original thread: https://forums.rpgmakerweb.com/threads/little-help-with-troop-condition.147082/