Help resetting step counter variable for fallout style overworld map random encounters

My game has an overworld map with travel akin to Fallout 1. Upon stepping 45 time a variable kicks in transporting the player to a random encounter map.

My problem appears when the player returns to the overworld map. The variable is already set to 45 steps so the encounter either starts immediately preventing the player from navigating the map, or it doesn't start at all depending on how I have set up the event IE adding another parallel event to try to control the first etc, and so on...

What I am asking is how you the community would go about setting this up. I am sure I am missing something simple in order to reset the step counter.

Attached is a screenshot of the event set up now omitting the secondary event made to control the first. I have gone through several iterations of this today, any help would be much appreciated. I can provide any more information if need be.
Try running this script call perhaps: $gameParty._steps = 0;
Try running this script call perhaps: $gameParty._steps = 0;
Copy That, I'll give that a try and report back tomorrow. Thank you.
Alternately, you just use a second variable - whenever an event triggers, you set Steps Old = Random Map Encounter.

Then when you start counting again, you set Random Map Encounter = Steps, then subtract Steps Old from it.
I don't think you can reset the official step counter because that is defined as "steps since beginning of the game", so you'll have to use a variant of @ATT_Turan s advice.

Basically upon entering said world map you set a variable "last encounter at" to the current steps, then calculate "steps since" as current steps minus the last encounter marker.

you'll have to do this in a parallel process that also checks if the steps since is >=45, and that parallel should contain a wait(5) or wait(10) depending on what other parallels you have running in order to reduce lag.
if you want full control how stepcount works, take a look at Tea_EasyStepCount.
you can reset it while the original stays intact.
In case it helps, I posted this fairly thorough event description a while ago:
You would need another variable. The outer step count thing is to detect when a step is taken, so you would need to count down your quest's variable inside the "Step difference not equal to 0" branch, e.g.
  • Setup (i.e. start the quest step counter):

    ◆Control Variables:#0019 Quest Steps = 20
  • Check (in a separate, Parallel event):

    ◆Comment:Check for step. ◆Control Variables:#0020 Step Count -= Steps ◆If:Step Count < 0 ◆Comment:Process on-step effects! ◆If:Quest Steps > 0 ◆Comment:-1 to quest timer per step ◆Control Variables:#0019 Quest Steps -= 1 ◆If:Quest Steps = 0 ◆Text:None, None, Window, Bottom : :Quest is now active! ◆ :End ◆ :End ◆ :End ◆Comment:Update for next check. ◆Control Variables:#0020 Step Count = Steps ◆Comment:Check again in a bit. ◆Wait:7 frames
Note that the setup and check are different events. The advantage of this is that you can update things every time the player takes a step. You might not need that, though, e.g. maybe you can just do the check when talking to some NPC?

Another option, perhaps simpler to understand, could be to set a variable equal to "current steps + threshold", then check when current steps >= that variable's value. E.g. for 20 steps:
  • Setup:

    ◆Control Variables:#0019 Quest Steps = Steps ◆Control Variables:#0019 Quest Steps += 20
  • Check:

    ◆Control Variables:#0020 Step Count = Steps ◆If:Step Count ≥ Quest Steps ◆Text:None, None, Window, Bottom : :You've walked around a lot, : :so I will give you a quest now! ◆ :Else ◆Text:None, None, Window, Bottom : :Not yet. ◆ :End
(To be super clear, just in case: Control Variables -> Steps is not a Script field thing. It is accessed via Game Data -> Other -> Steps.)
I don't think you can reset the official step counter because that is defined as "steps since beginning of the game"
Technically, I don't see any reason why you can't, by using the script call that SGHarlekin provided.

It's just generally bad practice to directly modify low level things like that when it's quite easy to account for it instead.
Thank you everyone for the insight and replies! I really appreciate you all!

@caethyril Thank you for providing that thorough snippet.

Original thread: https://forums.rpgmakerweb.com/threads/help-resetting-step-counter-variable-for-fallout-style-overworld-map-random-encounters.173229/