Need help with NPC Time based schedules and dialogue

I have the fundamentals of how to do this sort of thing, i know each map needs its own event for that NPC because the events don't transfer, or stack, i know how variables and switches work, and self switches, yada yada, all that good stuff, the problem i'm having, is i want an NPC to be stationary until a certain time of day ( example- in their bedroom from 6-8, 6 being when the day begins- leave their bedroom at 8 to go outside, go over a couple maps and wait around with minimal walking, then back to the shop around 12 to open it up, hang around until late, close shop and go back home until end of day ) but i also want to be able to talk to them at the same time. problem is, in order to have the autonomous movements work properly, the page needs to be set to parallel, because the movements are on page 2, but then i can't talk to them. if i have it set to action button, and have their movements on page 2 ( page 1 is them standing there waiting. ) then page 2 won't trigger UNLESS i talk to them first in page 1. I have it set so page 2 is activated through a self switch, triggered by an " hours " variable with my time system, but if i want to be able to talk to the NPC on page 1, then page 2 still doesn't trigger until i speak to them.

I've watched a TON of tutorials, read a lot of stuff, but i'm still new, and clearly i'm either doing something wrong, or i'm attempting to do something that's not possible without a plugin.

The goal is a sort of " harvest moon " style npc schedule system, where you can talk to them at any time, but they have schedules that they follow depending on the day of the week or weather. ( like if rain, they will stay indoors or go somewhere else or something )
Because the events START when you're on the map, and not actually at the time they're meant to trigger ( unless you're on that map already, obviously ) i'm having difficulties making them move at the correct times and still being able to talk to them simultaneously, so I can't set the " wait " by frames in movements either, because the amount of frames needed would change depending on when you entered the map, since it doesn't ACTUALLY activate until you enter the map.
I've tried messing around with variables and branches and switches for a while in a bunch of different ways but i just can't get it to work flawlessly. Do i need to set up common events for each character or something? MOST of them won't join your party, but a couple will for a short period for quests, idk if that matters lol, but i'm not there yet anyway. ( i know i will need to setup a switch that turns the NPC off when they're in your party and turn it back on when they leave )

Would it be possible for the event to trigger WITHOUT you being on the map? like legitimately triggering by the hour so if you were to enter the map, they're already half way through their movement? because that would be ideal.

I haven't gotten very far with the NPCs but i foresee an error where whenever i enter a map, the NPC loads up and starts their journey if i hadn't seen it yet haha

tldr

Need NPC's event to start on the map -NOT- moving
Need NPC to start walking to leave the map and disappear at a specific time of day ( controlled by variables/time system )
Need to be able to talk to NPCs while both moving AND not moving on the same map.
Need NPC's to be in their CORRECT locations when entering the map during their travel.

Is there a good plugin that helps with this sort of NPC schedule eventing?

I have the visustella free base plugin pack installed.
The movement itself should be done under the "move route" button for every event page, while calling this event as an "action button" (not parallel) and in the event commands you have a dialogue with this character. Then you can set different pages for different route and assign them to conditions where variable hour is >= X. Other way you could make an empty/blank event for every map which moves all the NPCs events depending on hour = X and make it parallel, but NPC events should be "action button", so you can always talk to them.

Also, for more advanced schedules, etc. it would be easier if you'll implement some time system pugin, like for example Visustella's or OcRam's.

Would it be possible for the event to trigger WITHOUT you being on the map?
No, because RM only keep one map in memory, so there is no thing like "other maps where there is no player". If the player leaves the map, it's like "deleted" until you enter it again. That's why we have switches and variables to help 🙂
The movement itself should be done under the "movement" button for every event page, while calling this event as an "action button" (not parallel) and in the event commands you have a dialogue with this character. Then you can set different pages for different route and assign them to conditions where variable hour is >= X.
Also, for more advanced schedules, etc. it would be easier if you'll implement some time system pugin, like for example Visustella's or OcRam's.
if i'm understanding you correctly ( sorry i'm dyslexic lol ) that's what i did, but i'm wanting the movement routs ( which are all already done with the autonomous movement button instead of being set to fixed or done in the event options ) to happen after the npc has been stationary until a certain hour, both pages being able to talk to the npc. I want the first page where the npc isn't moving to still be able to have dialogue when spoken to, but if i do that, the page has to be set to action button in order to speak to them, in which it won't change to the next page, allowing the route movements, /until/ i've spoken to them, regardless of the conditional branch variable for hours.

It seems all events that allow for talking NEED to be set to action button, but pages can't change on their own ( even with the hour variable ) unless they're set to parallel correct?
It seems all events that allow for talking NEED to be set to action button, but pages can't change on their own ( even with the hour variable ) unless they're set to parallel correct?
Um, no. If the page is set to action button, then to summon all the commands (right side of event window) need a key press (this is where you'll create "talk to" commands), but movement route are still being executed, so if you set the condition (left side of event window) to variable hour let's say >= 8, then after 8AM the event will move where you want to, no matter there's action button.
In short, movement route for event/pages works always like "parallel process".
So if first page will be like hour >= 6 with fixed movement, then second tab where hour >= 8 with movement route go here and there to the lake, then the NPC will go to the lake after 8AM.
Hmm, i must have had something misaligned then, because i tried that exact thing and it wouldn't work. i tweaked several aspects multiple times trying to figure out what went wrong but no matter what i did it wouldn't work 100% unless i pressed the action button on the event. it just kept " standing " there and wouldn't move until i spoke to it despite that being the page condition and having custom movement set, the page just wouldn't turn by the seems of it.
I will toy around with it again tomorrow, thanks for your input and clarification!


As for having the NPCs show up on different parts of their movement rout depending on the time of day and ignoring when you've entered the map, is there something i could do for that? a plugin maybe?
Like if i were to enter the map, it would be really nice if the event was already in rout, instead of staying at the starting point until i've entered the map, that can mess up things like opening hours for shops and having duplicate npcs if i'm not super careful xD
I know plugins do exist for pathfinding but i haven't come across any that are specifically for MZ, and not sure if they would work properly with my current plugins.
Try it once again, it should work like this fine 🙂
About that second thing, the only thing that comes to my mind is the event save position plugins, like this or looks like Visustella Events and movement also has this feature. It would help to keep the events in the same spot where it was when you left the map.
Oh ok, yeah i do have the visustella movements core plugin, but i'm not too verst in all of their features yet, been slowly hammering away at them- and there are basically no video tutorials that i could follow along with for easy consumption.
Do you happen to have a link to where that info for the visustella plugin might be found or have screen shots to show me so i can take a look? although i imagine its probably somewhere on the plugin page info at the bottom but i've looked over it a few times and clearly missed it since i didn't know what i was looking for and there's a good chunk of info on there to try and absorb xP
its fine if you don't, no worries. i just struggle a lot with following verbal/written directions sometimes when it comes to more complicated/technical stuff, i learn best with visuals.
really wish there were more actual step by step video tutorials for stuff like that, but they seem to be pretty rare for visustella's stuff especially :0
remember that NPC effects are only ever valid when the player is around.
if an NPC is supposed to be "at location X", after "moving TO location X from location Y", and the player is at location Y, the corresponding NPC should appear at location Y on their way to X, until the NPC reaches the nearest transfer point.

basically, the Oblivion meme: NPCs constantly spawning at nearby gates and moving to their intended destinations, every time the player enters a new area.
structure your move routes by hours, and tune the movement so that every NPC is "in transit" for only 1 hour.
the moment the player leaves the area containing *[the avatar of the NPC in question]*, the avatar won't appear at whatever area the player advances to until it's time for them to do so.
make the distinction between NPC and corresponding avatar: NPCs are logical, they're written in your plot and routing logic. The sprite you see on screen is just an avatar.
remember that NPC effects are only ever valid when the player is around.
if an NPC is supposed to be "at location X", after "moving TO location X from location Y", and the player is at location Y, the corresponding NPC should appear at location Y on their way to X, until the NPC reaches the nearest transfer point.

basically, the Oblivion meme: NPCs constantly spawning at nearby gates and moving to their intended destinations, every time the player enters a new area.
structure your move routes by hours, and tune the movement so that every NPC is "in transit" for only 1 hour.
the moment the player leaves the area containing *[the avatar of the NPC in question]*, the avatar won't appear at whatever area the player advances to until it's time for them to do so.
make the distinction between NPC and corresponding avatar: NPCs are logical, they're written in your plot and routing logic. The sprite you see on screen is just an avatar.
i'm probably just too tired atm to fully process what you just said lol but the problem i was thinking more or less, is if NPC/Avatar is at location Y, and they start walking at 8am to go to location X, if you keep entering location Y and leaving to X then back to Y, every time you enter Y during the hour of 8, wouldn't they just restart their rout from Y to X from the beginning of the event over and over until the time the event is meant to be over, then randomly disappear no matter where they are on the rout?
Gonna take a closer look at the visustella events and movement core plugin commands and see what i can do 😛
wouldn't they just restart their rout from Y to X from the beginning of the event over and over until the time the event is meant to be over
depends....
is their position saved between map changes?

if they start at editor-defined locations, they'll always start there... with or without time system.
if you give them a time system, they'll spawn at their designated entry points, on cue.
*whether they get to the exit on cue* is another thing, because between the here and there, that's where the player may interrupt.

what I'm saying is that the smallest unit of time to manage has to be the time of your global clock, be it either hours or minutes.
and, every NPC must have 3 states: "entering area", "existing in area", and "leaving area".
if an NPC is meant to cross an entire section on their way somewhere else, the moment they enter the section they're already "leaving area"... so the distance to cross has to be in tune with the speed and the time to get there, so *IF* the player was to leave to the next section, the NPC would spawn there on cue, as if it had come from the previous section, accounting for displacement.
if the NPC couldn't possibly cross that span in the minimum unit of time, you have to shrink the area, or define the movement as "existing in area", within which at some point the NPC should completely ignore player input only to put itself in position to "leave", so as to not allow the player to stall them.

it's up to you, but you can't cramp more actions per unit of time than the clock allows.
that's why I say to keep the NPCs logical, and maybe teleport them to their expected locations if the player goes back and forth, as you can quickly work the math of speed * time = distance and drop them at their expected percentage of completion of route.
you can go as simple or as complicated as you want... either of the solutions is doable.
I got the NPC walking and talking normally as i was originally trying to get working, i had it setup this way before but it wasn't for some reason i must have had something off. and I managed to figure out how to setup a plugin command that saves the position of the character once they start traveling, the main problem is that they stop moving when you've left the map, so when you come back they're exactly where you left them as if they stood there waiting for you.

I bought the time system that i have installed, and there is a " total minutes " variable, which i thought would work for setting exact times for when events trigger, but no matter what number i put it seems to set by the hour, like if i set it to say, 50, it would trigger at the hour despite being 10 minutes sooner. and because events can only be triggered by one variable, i can't set hours AND minutes as the trigger. if i set just minutes as the trigger then any hour with those minutes would trigger it.
What i was going to try and do, is time how long it takes them to get from one map to the other, for example, takes the NPC i'm working with 10 seconds ( 10 game minutes ) to get from point A, to point B with a designated rout. so i was going to set it so total minutes would make her start her rout at 7:50, so she'd get to the door at exactly 8, allowing the event in the next room to trigger at 8. but its not working out and i don't know HOW to do any of the alternatives and there are no video tutorials for complex traveling NPCs that work with a time schedule.
I attempted to setup a switch so that the event in room B wouldn't trigger until the event in room A was done, but i couldn't get it working properly.
I need to set it up so they walk around you if you stand in their way, but then their rout changes. if i have the auto rout setup for them to go from x to y, she takes a crazy direction and tries to go down the stairs from the back instead of the front lol, i would have to setup barriers and taking any extra steps would also change how long it would take for them to get to the exit, so that doesn't work. i could potentially turn " through " on so you can't stop them by walking in front of them but its not an ideal solution.

I would really rather not have a teleporting system for travel, i want them to walk around on the maps for travel so you can speak to them before they get to the next location but i have no idea where to actually start.
I imagine it would be REALLY annoying if you were trying to find someone to give them a gift, and you're 2 steps away then they suddenly teleport across the map lmao

I could really use the guidance of someone who's gotten a " stardew valley/HM " style time/scheduling system for NPCs in RPG maker working correctly. i'm a little surprised there are no complex video tutorials for it online, it seems a lot of people have been wanting to do the same sort of thing i am.

EDIT: pretty sure i can fix the issue with the x and y coordinates when moving the NPC by adding more script commands in the custom move rout box and skip if can not move to prevent them from running back and forth if you were standing on the exact tile they needed to be on or something, but that still doesn't fix the time problem. I just don't know HOW to set it up in a cohesive way
if you're working with a made system, you gonna have to squeeze whatever loophole they might have.

i can't set hours AND minutes as the trigger
have you tried a relay system?
spawn a control event at hour X for the entire hour, and have IT be the condition for the actual event to spawn, at minute Y.
the actual event would only spawn at minute Y of hour X, because and only because the control event spawns at hour X.
once the event's routine is complete, delete both events.
if you're working with a made system, you gonna have to squeeze whatever loophole they might have.


have you tried a relay system?
spawn a control event at hour X for the entire hour, and have IT be the condition for the actual event to spawn, at minute Y.
the actual event would only spawn at minute Y of hour X, because and only because the control event spawns at hour X.
once the event's routine is complete, delete both events.
The thing is, i was wanting the /page/ of an event to be triggered by hours and minutes, not the entire event, but pages can only be turned with ONE variable, the hours and minutes are both variables. the event spawns at hour 6, page turns hour 7 minutes 50 for movement rout ( allowing 10 'minutes' of travel to the door ) then the next event in the room over spawns at 8.

I guess it being a page wouldn't really matter, when it would be triggered with the same kind of command tho, with both a switch and a variable instead of two variables directly.

my brain is absolute goop from thinking so dang hard i'm starting to have a hard time processing anything haha. i can't even begin to mentally map that simple idea out rn, brain fog + aphantasia ain't fun

Still doesn't solve my problem with where the event spawns based on time tho, there must be a way to set the event's location based on time during its rout, while not changing how its rout plays out.
I have it so the game remembers their last location, but that doesn't fix my problem completely i have to have already been on the map during rout for that to matter. I know events can't move when you're off map, but i need to find a way to make it appear as if they have been, with the idea in mind that NPC paths are going to inevitably crossover through routs.

I also realized, i'm not sure what i'm going to do when it comes to multiple NPCs exiting the same building, they would have to spawn on the same location in front of the door in order to enter the outside map and leave and you can't stack events ToT
First, as somebody have already mentioned, by default, whenever you enter a map in MZ, wherever the event originally was setup, that's where the event will be initialized. For example, lets assume in Map001 you have Event001 at coordinates 0,0, that is at the top left corner of the map. When player character is transported to Map001 (doesn't matter how), Event001 will start at the top left corner of the map. You can have some instructions to make it move to a particular place at a particular moment, but it will always start at the top left corner of the map no matter what happens. If the player leaves the map and returns, Event001 will always start in that position. If you want it to save the location after leaving and then returning, you need a plugin with that functionality.

Regarding the hours/minutes....well, I don't know what plugin you are using, but this is where real world mathematics come into use. A day is 24 hours, an hour is always 60 minutes, a minute is always 60 seconds, if you are limited to only one value in particular, instead of thinking in hours:minutes, why don't you think in total minutes of a particlular day? For example, currently as I'm writing this post, where I live is 23:34, that is 23 hours 34 minutes, but if I convert it to total minutes of the day that would be the minute 1414. If you remember that any day has in total 1440 minutes, all you have to do is to think in what particular minute you require your event to happen, and with that, you only now have one variable of time, regardless if the plugin handles it in two variables, you now have a different conversion. The same applies if you also consider it in seconds.
the event spawns at hour 6, page turns hour 7 minutes 50 for movement rout ( allowing 10 'minutes' of travel to the door ) then the next event in the room over spawns at 8.
sounds like it's gonna be easier to just have an event manager outside of it all, and have the map events be remote avatars.
I mean, you can *send* a route to an event... you don't need the event itself to have it.
that simplifies the structure a lot.

if you can't do that, then the smallest unit for you is hours, because minutes would be too complicated, unless you can count a variable up to 1440 (minutes to the hour) and work with that in the pages.
Ok, so i tinkered around with it after getting myself some caffeine and i did what you suggested with a sort of " place holder " event. I setup a common event for time showing hours and minutes, " if hours = 7 if minutes = 50 turn on switchX " then switch X was the condition for the second page. the common event is run parallel to the " time is flowing " switch
got it working, a problem i was having during the process was having the npc appear again on their last movement location when i reentered the map, so i set a third page with nothing, that ran on parallel and turned off the switchX

Thanks for the suggestion that helped a lot with getting them to move at EXACT times. even if i'm still having some problems with other aspects its been really helpful posting to the forums ^^

Also, all the premade systems i have uploaded in my game are by Cazwolf on itch.io this is where i got the day/night system and it works like a charm~
the common event is run parallel
careful with common events, as they generate lag for being always pinging everything.
if you must have a global watch for something, move it to the code where it won't ping actual objects in the map.... which is a problem because you mean to have MANY actual objects in the map moving around!
I guess once you figure out the system, it's a matter of fine-tuning it.
but be aware that you may have to lighten the F out of that common event if it starts lagging, so make sure it only runs what's absolutely necessary.
Ya, i will definitely have to keep that in mind. i have like 20 ish characters that would all have to function off of the same common event that turns switches on, and i'd only have them available for exact moments necessary. they're all running on an existing time system so hopefully that won't put too much strain on it..
if the switches are for specific times i can probably use the same ones for multiple characters at once depending.

Any ideas on the problem with having npcs spawning on the same tile? obviously not at the same time, but like if two people enter a bar, they both gotta leave and that would need them to both end up starting on the tile in front of the door right? but you can't directly stack events. how would i achieve that? it must be possible because lots of people have multiple npcs come and go from the same place, kind of seems like a necessity lol
Would i have the event invisible somewhere else on the map, at a certain hour teleport/move the event to the door tile, make visible, turn through off, and then start their actual rout?
you can't directly stack events
you can, but not in the editor.
>unless< you dynamically create the NPCs, as avatars, by command.
that solution would prevent you from adding any code to it, except for any code that would identify it before a larger system, which would do the processing.
the downside is that the movement is more complicated to manage, because the events don't exist and trying to grab them by code to send them the orders may throw an error.

another solution would be to have the events created, on standby, out of view, and teleport them as needed in or out.
you can stack already-made events at run time, but you can't add a new event to an occupied tile, in the editor.

a hybrid solution would be the oldschool way: have the NPCs move about during their "existing in area" state, but condition their entry/exit to a player interaction.
talk to the NPC, say it's dialogue, then hold the player, run the NPC out of frame, and remove it.

you have options for every problem... it all depends on what you want to set in stone.
Is the second option not what i said? i think that's what i meant lol. have the actual event placed somewhere out of the way and make it travel invisible to the area to make it LOOK like it spawned there at the correct time when really it didn't.

With the first option having " avatars " how would one do that?

I'm wanting the NPC system to be as close to HM or stardew valley as possible, i don't want to teleport anyone visibly if i don't have to. i might do it for smaller transfers like they go inside the house and then they're immediately in their standing spot and not still walking inside the house.

I might need to figure out a way to set multiple event points per NPC based on time when traveling over larger areas so when they start if its a certain time they will start half way or whatever point of travel the main event is supposed to take, so they aren't starting from square one every single time. if you were to say, enter the map at a time that would be the end of their rout time-wise. i'd have to probably do it with switches or something based on time so it will only show one of them at a time, but will skip to further points of travel if you enter the map at a certain time frame. kind of like " jump points "
i could probably make it work with different pages on the same event or make multiple events if i absolutely had to.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-npc-time-based-schedules-and-dialogue.166691/