MV [RMMV] Modifying Escape Chance Mid-Battle

In Pokemon, there's this move called "Mean Look". It stops your opponent from being able to run away after it's used on them,

I'm interested in making a "Mean Look" like effect in RPGMaker, to make certain encounters inescapable (or at least nearly) at random. I first thought I could solve this issue by using HIME's enemy reinforcements script to add a very very fast invisible and untargetable enemy on turn 0 with a common event, but experimentation has revealed that this doesn't seem to affect your escape chance at all.

So I'm wondering, does anyone know a way or script that lets you do this? One of Yanfly's scripts lets me modify the basic formula that applies to every fight, which is interesting to me because it implies that I should be able to alter the escape chance in real time since RPGMaker keeps track of how many times you've tried to run away to calculate it each turn. Theoretically, it should be possible to just modify the run chance with a script call, right? But I'm not really sure what I would need to write to do so...

So I'm curious as to how one could alter the escape chance in the middle of a battle, and am either looking for a script that specifically supports it or knowledge of what sort of variable I'd need to edit to get this to work with my own script call. I'm currently using a few of the Yanfly battle scripts and so forth, but I don't think they're really relevant to this question.

Thank you!
Moved to: Plugin Requests
Just as a hint for how you could do it without a full plugin (just a bit of JS code inside a database event or formula): set the value of BattleManager._escapeRatio to a decimal value between 0 and 1 (representing 0% and 100% chance of escape, respectively).

You can see this being used in the "default" escape ratio, which is set only once at the beginning of battle and then normally used for the rest of the fight, even if battlers' AGI changes:
JavaScript:
BattleManager.makeEscapeRatio = function() {
 2331      this._escapeRatio = (0.5 * $gameParty.agility()) / $gameTroop.agility();
 2332  };

For example, you might do something like have the Mean Look skill check whether a "Mean Look" Switch has been set to ON, and if it hasn't yet, make it 5 times harder to escape by using the Script line: BattleManager._escapeRatio /= 5; Just be careful in that you need to reset that switch to OFF at the end of the battle (or, at latest, the beginning of your next battle). Alternatively, if you simply want to make it impossible to escape after Mean Look, your job is much easier: just do BattleManager._escapeRatio = 0; and there's no need to set, reset, or look at Switches.
Oh, thank you, that's exactly what I was looking for!

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-modifying-escape-chance-mid-battle.137623/