How to accurately use Variables?

Hey everyone, thank you for taking a minute to read through my issue here and either leaving a helpful tip, or what works for you:

I'm looking to make a game and I need variable conditions. I've played through a tutorial game but it didn't seem to really help me learn much about Variables as I didn't seem to really need them in the first game I was making (unfortunately all data was lost and I'm making a new one). The game I'm currently making however, won't be able to continue without the use of variables to trigger specific conditions and events. I'm going to try and explain my plans here the best I can.

In my game, I'm trying to set up "kill" switches that will trigger an event to respond to a variable that was met. For example: If I have a variable set as "defeat 2 enemies" and set that in a condition branch as
"condition (defeat 2 enemies)"
If met - character can pass to next level/npc moves out of the way

if not met - character can not progress/npc tells you to kill the 2 enemies in the area

Now. My issue is, I have variables set up for this exact story build, but the conditions are never met even if enemies are defeated. What would be the best way to either fix or work around this issue?

I also want to note that I have made events that will be used as enemies that can be seen wandering around the map. Instead of using a chance encounter method, I want to use an aggressive encounter method.

Any advice on this matter may help me out, so I thank you all in advance!!
you would have to find out why the conditions are never met before you can decide to continue.

best bet it is one of several mistakes new users make with this.

1) event page priority - pages cannot be active if a page with a higher number is already active.
2) troop events are not executed on battleend - if the last enemy is killed, a troop event conditioned on that enemies HP=0 will not be executed any longer unless you'll use an immortal state to force the engine to react to it
3) double use variables - another event or plugin uses and changes the variable withoutyour knowledge. Happens all the time if you neglect plugin configuration or variable naming.
I'll take a look through all of my data information and to make sure the event I have set up will work properly. Thanks for the heads up!!
you would have to find out why the conditions are never met before you can decide to continue.

best bet it is one of several mistakes new users make with this.

1) event page priority - pages cannot be active if a page with a higher number is already active.
2) troop events are not executed on battleend - if the last enemy is killed, a troop event conditioned on that enemies HP=0 will not be executed any longer unless you'll use an immortal state to force the engine to react to it
3) double use variables - another event or plugin uses and changes the variable withoutyour knowledge. Happens all the time if you neglect plugin configuration or variable naming.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-accurately-use-variables.142581/