Activating Event at certain steps or time passed.

Hi. I'm struggling these days with the idea of how to make an event activate after certain steps of the player. I tried to google it, but nothing. I searched plugins, but still nothing. If you know some plugin or something else pls tell me.
The whole idea is starting a quest after some amount of time or after [x] steps of the player. It's not farming or mining or something like this. I want to apologize if this isn't the right section for this question.
You could very easily event a time system with variables for days/hours/mins etc. Then use that time system and a trigger to start the quest at x amount of days.

Or use a time system plugin and accomplish the same thing, if you don't want to event your own. Many simple tutorials here for it and on YT!
Control Variable - Game Data - Other - Steps
[Edit: ninja'd.] For step count you can do something similar: check player step count (or X/Y coordinates) in a Parallel common event every few frames, e.g.
Like Andar says, your Parallel event will process once per frame while switch 1 is turned on. Times taken for various move speeds are noted in this thread: link. The default player move speed is 4 (16 frames per step); if moving at speed 3, 1 tile of movement will take 32 frames and make $gamePlayer.isMoving() be true for 31 frames (final frame is at destination).

If you'd like to run something once per step instead, you can do a step count check each frame, e.g.
Spoiler: Step-tracking parallel event example
Code:
◆Comment:Get difference between stored step count and current step count
◆Control Variables:#0015 Step Count -= Steps
◆Comment:Has it changed since last check?
◆If:Step Count ≠ 0
  ◆Comment:It has changed!
  ◆Comment:Do things here that happen once per step
  ◆Show Balloon Icon:Player, Light Bulb
  ◆
:End
◆Comment:Store current step count in variable for next check~
◆Control Variables:#0015 Step Count = Steps
◆Comment:Check again in 6 frames
◆Wait:6 frames
[Edit: Steps can be found under Game Data > Other > Steps.]

...or you could use a plugin like this to toggle a parallel event's switch on step:
In your case the "on step" thing could be something like:
  • Is variable [x] equal to 0 or less?
    • If yes: (do your thing).
    • If no: -1 to that variable.
Then just set variable [x] to, like, 100 when you want the step counter to start~

For a timer it's best to avoid stuff like Wait 999 frames, because Parallel events restart when you change maps. Best to do it like "Wait 10 frames, +1 to variable" instead.
You can do that without any scripts and plugins, just create common event that checks the step amounts the played did and if steps >= X then do this and this.
Hi again. Thank you for the advice @caethyril but it doesn't work. Did I do it wrong and where is my mistake? I really can't understand those things with the step counting. I've also tried the other ways with the common event which @fizzly said, but nothing. How to check the player step btw? I'm really confused and can't understand what I'm doing wrong. Thanks.
step counter3.png

step counter2.png
So, I could be looking at this wrong, but from what I see, it looks like your Event is taking a Variable (169), which will be zero at the start of the game unless you assign it a value somewhere else, and subtracting the Player Steps from it. That will be less than zero result.

Then, you are checking to see if your Variable (169) is not equal to zero. Which it won't be. It will be less than zero. So you are turning on the Self Switch to trigger the 2nd page of the Event.

If I understand what you want to do, which is to just trigger something once a certain amount of steps is reached, say 100, you could try the following in your Parallel Event:

Variable 169 = to Steps as @caethyril indicated previously. Not subtracted.

Conditional Branch: If Variable 169 is >= 100, then do whatever it is you want. Trigger your result. Turn Self Switch A on or whatever.

Else is empty or not even used.

Wait 10 frames

End

This will check every 10 frames if the Step count has reached or exceeded 100. If so, your next part will trigger. If not, it will wait 10 frames, 10/60ths of a second, and check again.

If this Parallel Event is on the map, it will only work on that specific map.

If you make the Parallel Event a Common Event, it will run until the Conditions are met and then you can turn off that Common Event. It won't matter what map you are on.

Alternatively, you could use the same Map Event on every map until the final Condition is triggered. But I don't think I would do that.

Here are my screenshots. I just tested this and it seems to work perfectly. If this is actually what you want to do.

I hope this helps.

Step Test Page 1.pngStep Test Page 2.png
Variable 169 = to Steps as @caethyril indicated previously. Not subtracted.
No. With my approach you want the difference from the previous count, to detect when a step has been taken. So it is subtracted from the value previously stored in that variable. That's why it is set equal to the step count afterwards.

Thank you for the advice @caethyril but it doesn't work.
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.)
No. With my approach you want the difference from the previous count, to detect when a step has been taken. So it is subtracted from the value previously stored in that variable. That's why it is set equal to the step count afterwards.
Oooppss! Sorry about that! I thought I understood what the OP was trying to do.

@Kingslayer I hope I didn't make this more confusing for you!

EDIT: I also see how my test event only works if you are triggering something by using the player steps since the start of the game, rather than say talk to NPC1 and then you need to take X number of steps after that to trigger something.

Sorry if I confused the issue!
@ZombieKidzRule - no worries! I just wanted to correct your misquote of my post. As you've noticed, your approach counts steps since the start of the playthrough: if that's what they want, though, then it is definitely the simpler option~ 👋
I did it this time @caethyril. Just as you said it's two different events.
newcounter step1.png

This is the Setup
newcounter step2-2.png

This is the Check. It works this way. It's not exactly like what you said but the most important is that it's working properly just as I need.
Thank you all for the tips and help. Next time maybe I should try the custom time system.
In case you need further explanation variants:

Your Player makes an unknown Amount of Steps before talking to a NPC.
When Accepting the Quest, the NPC tell you to come back after 20+ Steps.
And unknown to the Player the NPC creates a Timestamp.
Var1 = "GameData -Other -Steps" (The current Step Amount)
Var1 += 20

Everytime i come back to the NPC he will do:

Var2 = "GameData -Other -Steps"
If Var2 is equal or greater than Var1
if yes: You came back after taking 20+ Steps. Well Done
if no: You did not take enough Steps, come back later.
Hey, @caethyril I have one more question. How I can prevent the parallel process when change the player changes the map? It starts over when I get to the original map where's event step counter is. Is there a way to change this or do I have to use time system?
@Kingslayer - Erase Event only deactivates an event until you leave its map. If you want to disable an event for a different duration, you can use event pages. E.g.
  • Page 1, no conditions, commands:

    ◆Control Variables:#0172 Steps Start Count = Steps ◆Control Self Switch:A = ON
  • Page 2, condition "Self Switch A", no commands.
With this setup, page 1 will run the first time the event triggers, then the event will stay on page 2 for the rest of the playthrough (because it never turns that switch off again).

Event pages are an important mechanic! For another example of their use, you can right-click the map when in event-editing mode and choose Quick Event Creation -> Treasure. It turns on self switch A so that you can only loot it once.
That's so helpful @caethyril. Thank you again very much!
You're welcome~ 👋

Original thread: https://forums.rpgmakerweb.com/threads/activating-event-at-certain-steps-or-time-passed.153932/