Encounter Rates variance

Good morning,
I need help changing the variance of random encounters.
Currently, even by setting the number of steps between two fights to 100, it is possible to have a gap that is far too large.
In my previous game, I had managed to modify this directly in the game files.
But currently I use a lot of plugins, and I know that yanfly rewrites the script in at least one of them.
Would it be possible to create a new script that I will place at the bottom of my list, and which would impose a new variance?
20% seems very good to me for example. This would make a fight every 80-120 steps for a value set to 100.
Is that possible ?
It may not be necessary but I show you the plugins I use:
To override the formula, you can make a new .js file with this in it:
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Override random encounter rate (makeEncounterCount).
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/160227/
 * @help Free to use and/or modify for any project, no credit required.
 */
// Override!
Game_Player.prototype.makeEncounterCount = function() {
    var n = $gameMap.encounterStep();
    this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + 1;
};
As-is, this is the default formula: a binomial distribution (because there are two separate random rolls) from 1 to 2R - 1 inclusive, where R is the encounter rate. (Math.randomInt(n) gives a random integer from 0 to n-1 inclusive.)

For a 20% variance, you could try:
JavaScript:
    var n = $gameMap.encounterStep();
    var n2 = 1 + Math.floor(0.2 * n);  // 1 + (20% of rate, rounded down)
    this._encounterCount = n + Math.randomInt(n2) - Math.randomInt(n2);
Hopefully my maths is correct there. 😴

As a bit of background: _encounterCount counts down by some amount each step, based on various factors including the bush tile flag and party traits. When it hits 0 or less, a random encounter (if available) will happen, and the value resets.

[Edit: corrected value - default range is 1 to 2R - 1, not 2R - 2.]
[Edit 2: attached plug-and-play plugin file.]
Thanks for your help and your time but it doesn't seem to work.
I have the impression that the Yanfly plugins lock the variance, or I don't know...
But I don't remember having so much difficulty in my first game that didn't use a plugin :/
Try Waynee's encounter formula plugin
Thread 'waynee95's Plugin Collection [NEWEST: WAY_MenuBackgrounds]' https://forums.rpgmakerweb.com/inde...-collection-newest-way_menubackgrounds.78979/
Might need to check plugin settings, a lot of MV (and later MZ) added an encounter minimum to their code and adding that overrides the default code.

If you do have that though you might be able to tweak that.
I did some testing and what I suggested seems to work A-OK without any other plugins active. I attached the "20% variance" plugin to my previous post in case it was a problem assembling the file.

I had a quick look at waynee's plugin and it seems to use the same approach as mine (albeit with the ability to customise the formula from a plugin parameter). Still worth a try, though~

If neither of those work, consider sharing screenshot(s) of your Plugin Manager so we can see what plugins you're using and their load order. 👋
Try Waynee's encounter formula plugin
Thread 'waynee95's Plugin Collection [NEWEST: WAY_MenuBackgrounds]' https://forums.rpgmakerweb.com/inde...-collection-newest-way_menubackgrounds.78979/


This solution seems to work as I want.
However, I also had to use WAY's "CORE" plugin. Can we be sure that nothing else will be modified?
I had a lot of trouble making all my plugins compatible with each other, suddenly I'm a little afraid to use a plugin with the mention "CORE" now ^^" but if you tell me that I fear nothing , so that's fine with me.

Anyway, thanks to everyone for your posts.
This solution seems to work as I want.
However, I also had to use WAY's "CORE" plugin. Can we be sure that nothing else will be modified?
I had a lot of trouble making all my plugins compatible with each other, suddenly I'm a little afraid to use a plugin with the mention "CORE" now ^^" but if you tell me that I fear nothing , so that's fine with me.

Anyway, thanks to everyone for your posts.
Generally when you see a CORE plugin it's repeated code (variables, methods, etc) the dev uses across all their plugins. That isn't what causes conflict between plugin authors; it's usually when they both overwrite the same core RPG Maker functions.
OK thanks.
Anyway, I put the CORE at the very top of my list. It will be overwritten by yanfly plugins if similar things are changed.
And I put the plugin for the random encounter formula at the very bottom of my list.
It seems to work very well.
Thank you very much ^^

Original thread: https://forums.rpgmakerweb.com/threads/encounter-rates-variance.160227/