[RMXP] Help with changing encounter steps?

I've been toying with RMXP for a couple of weeks now, and I'm trying to make an event that changes the frequency of encounters with a script, I already have the code written down ($game_map.map.encounter_step = number of steps), but there's one problem. It doesn't actually register the code and change the encounter rate until you have an encounter. Which means if I change the rate to never, I'll get an encounter, and then it'll change to never. Then if I want to change it back to common, it won't actually change back to common until I get an encounter, which sucks.
How are you calling the code? Are you calling it when the player gets into battle? Then yea you can't change it back. But there are other ways/times you could be calling the code to change the encounter rate.
Game_Map#map isn't even defined in the vanilla scripts, so you're clearly trying to edit the scripts. What is your true purpose anyways? Are you trying to make a "repel" item? If so, you should use the Change Encounter event command instead.
I want an item that lets the player control the spawn rate of the monsters, as well as what monsters will spawn. Right now I have it hooked up to an npc through a script event.
How does it work if the player changes maps? Does the item behave differently for each map, or does it work the same across all of them? And I assume the effect will still be in place when the player saves and reloads the game (this is the biggest concern I have with your system).

To address your original problem, you need to call $game_player.make_encounter_count after setting the new encounter rate.
That worked like a charm! Thank you very much!

Original thread: https://forums.rpgmakerweb.com/threads/rmxp-help-with-changing-encounter-steps.129903/