Changing the way escape chance is evaluated

jonthefox

Veteran
Veteran
Joined
Jan 3, 2015
Messages
1,436
Reaction score
596
Primarily Uses
Hi, I'd like a small change that I am hoping is only a matter of adding or changing a few lines of code.


Instead of comparing the troop's average agility to the party's average agility, I would like to compare the enemy in the troop with HIGHEST agility, to the active party member with the LOWEST agility.


Basically to represent a more "can your slowest actor outrun the fastest enemy?" kind of thing.  Thanks in advance!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
Hi Jon,


I haven't tested this out (let me know what happens), but I think this will do it for you.


Game_Unit.prototype.highest_agility = function() {
    return Math.max.apply(null, this.aliveMembers().map(function(actor) {
        return actor.agi;
    }));
};
Game_Unit.prototype.lowest_agility = function() {
    return Math.min.apply(null, this.aliveMembers().map(function(actor) {
        return actor.agi;
    }));
};
BattleManager.makeEscapeRatio = function() {
    this._escapeRatio = 1.0 * $gameParty.lowest_agility() / $gameTroop.highest_agility();
};




The first two methods define "highest_agility" and "lowest_agility" for units (party or troop), and the final method uses those new methods to rewrite the escape ratio to your liking.  With the current formula, if your party's lowest-AGI alive member is faster than the troop's highest-AGI alive member, you will have a 100% chance to escape.  If your slowest member has 75% the AGI of the enemy's fastest member, you have a 75% chance to escape, and so on.  You can change the 1.0 (higher = easier to escape) if you'd like.


Just copy this into a .js file and insert it to your project as a plugin (or add it to an existing plugin).  Since I haven't tried this out yet, it's possible it will error.  If that's the case, let me know the message and I'll adjust.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top