How to enable or disable run during battle

I'm creating a game with peaceful options and I would like to know if it's possible to activate and deactivate running during battle.

Example:
When an enemy receives the "calm" state. Escape option will be enabled

Does anyone know a plugin or another way to do this?
If you use something like VisuStella Skills and States Core, you can add the code below as a Notetag in your state. Whenever the state activates, escaping is possible. When it deactivates, escaping is impossible.

Did a small test myself and it works as expected (You're accessing a private variable, which is dirty - but it works).

Code:
<JS On Add State>
BattleManager._canEscape = true
</JS On Add State>
<JS On Erase State>
BattleManager._canEscape = false
</JS On Erase State>

Please note that this only works with a single enemy - if you're looking to check if ALL enemies are calm, you'll have play around with a common event that checks for this.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-enable-or-disable-run-during-battle.150036/