Switch / Event on battle victory

To make things simple, I've got "gate" events in my project, all which contain a battle encounter.
I'm trying to make it so if the player wins the battle, a switch will trigger (which would get rid of the gate, that part I'm aware of how to do), but if they flee, nothing happens and they are able to retry the battle by interacting with the event again.
I need these events to work independently from eachother, meaning winning the battle at "Gate X" will only trigger the switch I've assigned to it, meaning that is the only Gate that would open.
I'm currently using Visustella's Core Engine and BattleCore plugins, along with a plethora of other ones unrelated to what I'm trying to achieve. But I'm willing to use a plugin for this if needed.
Update : This is LITERALLY a thing available on RPGMZ by itself. I feel kinda stupid but there we go. Solved!

Original thread: https://forums.rpgmakerweb.com/threads/switch-event-on-battle-victory.175327/