How to add Variable

Greetings,
Rpg Maker community i got a question on how to add a +1 variable when random monster encounter on the map.
Because when i put a +1 var on a NPC it works and when i add +1 var in the random encounter in the database it doesn't.
Thank you
Please show a screenshot of what you did that doesn't work. It is not clear whether you're trying to add 1 to a game variable or add a variable to an enemy, or what...no such thing as an NPC...

So a picture will be more helpful 🙂
^ What Turan said.

For random troop encounters, you can add a troop event on turn 0 to bump up your variable.

1688737524007.png


Instead of doing copy/paste page to EVERY troop event, I recommend you get a base troop plugin.
On the NPC tile itself it workd with the variable and in the troops menu it doesnt work
Ah, I know that <0 event is weird by default and doesn't always happen, especially when it's on the last enemy in the troop.

Would this plugin be a good alternative?
So, i cant do it manual? and have to put in a plugin?
A battle ends when there are no enemies left, instantly. So if that's the last/only enemy in your troop, that event will never happen.

Aside from the plugin that Testosterone suggested, you have two options for this kind of thing.

1 - on turn 0, apply a state to the enemy that makes it immortal. Then you'd have the event you made above that checks for <= 0% health, does stuff, then removes the immortal state to let them die.

2 - you can install Himeworks' End Phase Triggers plugin, which will make the engine check for troop events before the end of battle.
Okay Thank you i will try option 1. ^^
A battle ends when there are no enemies left, instantly. So if that's the last/only enemy in your troop, that event will never happen.

Aside from the plugin that Testosterone suggested, you have two options for this kind of thing.

1 - on turn 0, apply a state to the enemy that makes it immortal. Then you'd have the event you made above that checks for <= 0% health, does stuff, then removes the immortal state to let them die.

2 - you can install Himeworks' End Phase Triggers plugin, which will make the engine check for troop events before the end of battle.

Thank you for this help, i have been on this problem since RPG Maker 2k

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-variable.159059/