Make player wait for NPC action?

I’m curious about how to require the player to wait a certain amount (or window) of time for an NPC to complete a task. Basically, I want to have the player talk to an NPC, give them items, and make it so the player has to come back later to receive the result. I have implemented my own time system that tracks in-game days, hours, and minutes, as well as a day/night switch that toggles depending on the hour. Here is what my time system event page looks like:

The “night” switch turns on when the hour hits 20 and turns off at 6. I’ve messed with it a bit with no success at the results I’m after. I’m open for options of waiting until the next day, the next night switch toggle, etc. to have the player wait a short time before the event can be continued. Thanks for any suggestions!

-Chew

You need to add a timer variable that records how much time has passed since your player talked to the NPC.

For example: After the player talks to the NPC, activate Event A. Event A is a parallel process event that increments the timer variable at regular intervals (like the 20 frames shown in your screenshot). Then, check whether the timer variable has reached the value you set. For instance, if the initial value of the timer variable is 0 and it increases by 1 each time, when it reaches 60, turn on the switch that allows the player to claim the reward, and end Event A.

Another option is to add conditional branching to the clock system.
However, this method will not work properly if the design involves continuously toggling the switch ON and OFF as long as the condition is met.

Create a variable to record the waiting state of that event.
We will refer to this as the “waiting variable” from now on.
When the event enters the waiting state, assign a number to the waiting variable:

  • When the night switch is ON… 2
  • When the night switch is OFF… 1

Inside the conditional branch that toggles the clock system’s switch, insert a command that adds +1 to the waiting variable if it is 1 or greater.

If the waiting variable reaches 3, it means the next day has arrived.

I cannot stress this enough:
This method will not function correctly if the setup causes the switch to be toggled ON and OFF continuously while the condition is met.

For example, if you have a command that turns the switch ON whenever the time is 20:00 or later, this approach won’t work. You must ensure the conditional branch only executes when the switch is OFF AND the time is 20:00 or later.

If there are multiple events requiring a waiting variable, you can tidy things up by grouping the commands that add +1 when conditions are met into a common event and calling it.

Since you already have a Days variable, what if you saved the day when the player hands over the items? Make a new variable, maybe called Pickup Day. When they give the items, use Control Variables to set Pickup Day to Days, then add 1 to it, and turn on Self Switch A so the NPC moves to a second page.

On that second page, a Conditional Branch can compare Days to Pickup Day. In the Variable option you can pick Variable instead of Constant, so it checks against another variable. If Days is greater than or equal to Pickup Day, give the reward. In the Else branch the NPC can say something like “Still working on it, come back tomorrow.”

If you want a shorter wait than a full day, I think I would do the same thing with total hours. Set Pickup Hour to Days, multiply it by 24, add Hours, then add however many hours you want them to wait. When the player talks to the NPC again, do the same math without the wait added into a second variable and compare the two.

Thank you all for the suggestions.

Baz, that is almost exactly what I was trying to do. I couldn’t quite figure it out, I just needed to create the second variable. Now it is working according to plan. Thanks!

-Chew