NPC's movment routes based on time.

Hi, In my game I had time system that use 2 variables (hours+munites), I also have switches that define the time based on hours (midnight 0-3/ ealrymorning 3-6/ sunrise 6-9/ morning 9-12/ midday 12-15/ sunset 18-21/ evening 21-0).
I made movment system as parallel event in every map that controle the movment of the characters, but this have problems with it, for every npc I made a switch called "show [npc name]", in the characters controller event I controle the movments of the characters and show and hide them using the show npc switch, this worked well at the start but when I start to add more npc's, because in the character controller event when the movment of the npc start based on time I kep the wait movment active and I hide the npc after movment end, so npc will not be hided before the movment end, but with many npc's some characters movments will not start before someone esle movment start and that caused some problem and bugs in the game.

I have found some solutions but still not sure how good this solutions can be.

1st solution: use self switch in npc that controle movment.
I can make this work I think but the con of this that when npc going from area to another player can't interact with this npc and I want some of the npc to inform the player that they are leaving the area like for example a shop keeper will tell the player "It's late I closed my shop, I am going to hang out in the bar, come back tommorow, I will be open from 8am to 6pm", using this will inform the player about the npc.

2nd solution: do parallel event that controle the movment of each npc.
This also have big chance to work but having many parallel events in 1 map can cause frames problems and I want to avoid that.

3rd solution: using grid ID to confirm that the npc reached the location.
I done this with 1 npc, it worked fine but it hard to do, also could have problems if map is small and have many npc's but it hard to explain these problems without going much deeper on how I done this.

Overall I tried to give the overall idea about this system and I wanted to ask if there is better solutions?
Have you tried using Galv's puzzle functions to make an NPC disappear by flipping its self-switch upon touching another event?
2nd solution: do parallel event that controle the movment of each npc.
This also have big chance to work but having many parallel events in 1 map can cause frames problems and I want to avoid that.
About that, I suggest adding a "wait 1 frame" at the end of each parallel event to avoid these issues (if you are not running a large number of parallel events).
You're needlessly complicating things, and use too many parallel processes that way.

Use a variable to have a time number, like variable hours, can be 0 to 23 before going back to 0

then for example have a door event at the shop entrance with 3 pages.
first page no condition, door sprite, action button for show text "shop closed, open from 8am to 6pm"
second page, condition hour = 8 or above, no sprite and priority above to make the door vanish
third page, condition hour = 18 or above, door sprite, action button for show text "shop closed, open from 8am to 6pm".

finished - as long as the hour variable counts the day, the door will vanish on the open hour and block entry with a show text on closed hours.

and most of the other problems can be handled in similar ways.
Have you tried using Galv's puzzle functions to make an NPC disappear by flipping its self-switch upon touching another event?
I will try to use that, it could work with the npc self switch idea.
About that, I suggest adding a "wait 1 frame" at the end of each parallel event to avoid these issues (if you are not running a large number of parallel events).
I want to stay away from multiple parallel event as much as possible because It will have huge risks.
You're needlessly complicating things, and use too many parallel processes that way.

Use a variable to have a time number, like variable hours, can be 0 to 23 before going back to 0

then for example have a door event at the shop entrance with 3 pages.
first page no condition, door sprite, action button for show text "shop closed, open from 8am to 6pm"
second page, condition hour = 8 or above, no sprite and priority above to make the door vanish
third page, condition hour = 18 or above, door sprite, action button for show text "shop closed, open from 8am to 6pm".

finished - as long as the hour variable counts the day, the door will vanish on the open hour and block entry with a show text on closed hours.

and most of the other problems can be handled in similar ways.
Thank you but if this was what I am aiming for it would have been so easy.
The game have "real time" system, something like gta games for example, so it will not make sense if hour variable reach 8 for the npc to pop out from no where, I must make at least for example between 8 and 9 the npc/shop keeper should walk from his home for example to his shop and after 9 he will be already in his location because it would not make sense that everytime player enter the shop area map the shop keeper need to walk from his home to his shop.
I also made when the shop keeper reach his shop he open the door and keep it open so player knows that the shop is open.

Sadly I didn't find much easier ways.
@Warthief
for a simulation that detailed, you might be better off looking for a different engine that caters to simulations.

There are a lot of problems that will occur with this if you try to event it for more than a handfull of NPCs - detailed eventing scales very bad, and even if you get it to work with one or two NPCs, it will cause problems trying to do the same for one or two dozens of NPCs.

If you have to use the RPG-Maker (any of them), then your best bet would be to handle control off to a plugin (or script for older engines).
Unfortunately no such plugin for detailed event control exists yet, so you might have to pay for a commissioned plugin.

Original thread: https://forums.rpgmakerweb.com/threads/npcs-movment-routes-based-on-time.158452/