RMMV [RMMV] Modifying Escape Chance Mid-Battle

NARFNra

Warper
Member
Joined
Jun 20, 2021
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
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!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,801
Reaction score
14,970
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,079
Reaction score
5,741
First Language
English
Primarily Uses
RMVXA
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.
 

NARFNra

Warper
Member
Joined
Jun 20, 2021
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
Oh, thank you, that's exactly what I was looking for!
 

Latest Threads

Latest Posts

Latest Profile Posts

Feel free to check out our "Touch the Stars" gamejam submission, "Starlight, Starbright!"
just finished playing one shot. im kinda disappointed with return the sun ending ngl. i was hoping there would be some after credits scene that would play with my emotions
So apparently the surprise Google Search page browser game saves your progress when you close the browser.

This really makes me miss the golden age of Flash gaming.
ohh man im ending oneshot now (im doing the last stepping puzzle rn) and the music is so...sad...like...ive been thinking recently about how fast moments pass and...my anxious thoughts combined with that music and nostalgia...like...im comfortably sad...and want to cry internally
We're playing one of the Touch the Stars game jam entries, come join us!

Forum statistics

Threads
113,552
Messages
1,075,790
Members
147,551
Latest member
ananansy
Top