Adjusting random encounter rate

I know that there is a script which does this for XP, but having searched through the Ace script list I cannot find an equivalent.  I'm sure it must exist, so I'm asking if anyone can point me to where it is.

Problem On the map a number is set as the average number of steps between encounters.  However, as we all know, it is perfectly possible to get another encounter within just a few steps.

Solution (at least in the XP script) : between each encounter you can walk a given amount of steps (stored in a variable) before the default random encounter system takes over.

This ensures that you don't get the battle-5 steps-battle sequence.

Any information would be gratefully received.

Thanks
This is fairly simple. The code that determines how many steps until a battle is this:

Code:
class Game_Player < Game_Character  #--------------------------------------------------------------------------  # * Create Encounter Count  #--------------------------------------------------------------------------  def make_encounter_count    n = $game_map.encounter_step    @encounter_count = rand(n) + rand(n) + 1  endend
There's a couple ways you could change it depending on exactly what you want.

Code:
@encounter_count = rand(n) + rand(n) + 1 + $game_variables[5]
This would simply add the amount in variable 5 to the encounter count. This would increase the average by that amount and ensure that many steps have been taken before a battle.

Code:
@encounter_count = [rand(n) + rand(n) + 1, $game_variables[5]].max
This would ensure if the determined number of steps is less than the variable amount, it is set to the amount in the variable. This would probably result in a fair number of battles at that minimum amount of steps.
Code:
@encounter_count = n + rand($game_variables[5]) + rand($game_variables[5]) - $game_variables[5]
For something different, this makes the variable act as a variance value like in battle formulas. So if you random steps are set to 30 and the variance is 10, you should encounter a battle somewhere between 20 and 40 steps.
So just to be absolutely sure, I simply assign a variable, give that variable a set number in the operand and then just insert the variable in the form you have given.  Is that right?

Also - and this reveals the appalling depths of my ignorance - in which of the default scripts do I find the bit you have referred to?
If you don't want to edit the default scripts, you can just copy/paste the first snippet I posted into materials. The function is located in Game_Player though.


And that's correct. In these examples I used variable 5, but you can use whichever one you want, just change it in the line of code. Simply set it in an event, and the encounter rate will change accordingly next time it's reset. If you needed to reset it manually, you could use $game_player.make_encounter_count in a script call.
You don't know just how grateful I am to you for this!

Thank you, thank you.
Hey, I'm sure the people who eventually play your game are equally grateful that you're making sure there's not an encounter every three steps. :x
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/adjusting-random-encounter-rate.19293/