Advanced Game Time

Hello everyone, I want to make a "IA" npc to make them go to their houses when the clock gets to 19 pm, I'm using pathfinder script in order to make it possible, the problem is... if the NPC are an action buttom event, how do I manage to control them? I already try using a parallel process to make them move, but it collide with autonomous movement... what can I do 🙁?
Hi, Vlue; I want to ask you something: When I try to make a door unable to open at night (conditional branch - script - GameTime.hour? >= 22 && GameTime.hour? < 6), I put a message saying something like "It's locked" and in else the transport character, but when I test it only what appears on the first part will happen... I'll put a screenshot so you can see (I'm kind of bad at explanations).


So, in the screenshot there's the conditional branch and what happens if the conditions are met of not. When I test it, the event only does what it would do if the conditions are met even thought they're not met. Is there a way to fix this?


Untitled.png


EDIT: 'Just fixed it. Thanks anyway! This script is awesome.
How do I make it so that the clock starts shown instead of hidden?


Also, where do I get a list of the keyboard key identifiers so that I can change the toggle key?


It's been so long since I have done something like that... xd
Hey Vlue, I love the script!  Thanks for your hard work!


I've had a problem with the script, though.  It's certainly not a deal breaker, but it is something that I can't seem to figure out how to fix.  I guess my question is for anyone who has an idea of how to fix the problem.


It's a compatibility issue with Yanfly's core engine.  There is an option that allows for resizing the screen.  The resolution goes up to 640 x 480, which is where the issue comes in.  As the time of day changes, the screen only tints the size of the original resolution.  So, while I can just go back to the original screen size, I'd much rather use the better size.  If anyone can provide help I would greatly appreciate it.  Thanks!


View attachment Scripts.rvdata2
Script line 597: NoMethodError occured 


Unidentified method 'min' for nil:NilClass


Please Help!!
I am sorry to disturb but your script in my Demo Game Crashes..
Due to this line
 

Script Line "Game Time" Line 536: RGSSError occurred.
disposed sprite

When I restart my game by pressing F12..
1st time the Playtest works correctly..
Then the 2nd time it crashes..
 

Untitled.png
how would I use the gametime.hour? thing to make music play at certain hours?
I just did this by creating a parallel process that checks for the hour then plays a song based on what hour it is currently.

So at the top of the event, you'd set a variable to the current hour, then create a conditional branch for that variable checking what hour it is.

So like,
variable 1 == gamtime.hour?
Conditional Branch - If variable 1 is 0


-Comment - This is Midnight
-Play Bgm - Midnight Song


End Branch


Conditional Branch - If variable 1 is 1


-Comment - This is 1AM
-Play Bgm - 1 AM song


End Branch


And so on and so forth. I also did stuff like move NPCs based on the time, play BGS, tint the screen, etc. I recommend making this a unique event on each map it's used on, as opposed to a common event, so that if you want different music to be played on different maps it helps.

help.png
Hello everyone, I want to make a "IA" npc to make them go to their houses when the clock gets to 19 pm, I'm using pathfinder script in order to make it possible, the problem is... if the NPC are an action buttom event, how do I manage to control them? I already try using a parallel process to make them move, but it collide with autonomous movement... what can I do 🙁?

If you look at might reply to Micah above, in the pic I do something similar. You have to have a parallel process checking the time constantly, then throw on/off switches. Then, have your NPCs have pages activated by those some switches. In the picture above I turn on the switch 'Go Inside' after hours and 'Come Out' during the day. Every NPC has a page that reacts to those switches. But it's the event in the picture that monitors the time and controls those switches accordingly
Okay, so Today I was using advance game  time script and I was using a script call that was GameTime.Hour? to check for the hour then play certain bgm, but for some reason, after 3 secs it goes back to the start!
@BlazeBlueGaming, please do not post the same question multiple times but wait for approval of your post


That said, is it possible that you made the call inside a parallel process? because parallel processes loop automatically.


Please post a screenshot of your event with the script call.
it is in parallel processes

yy.JPG
Also, the problem is not that it is lopping, it's that it goes back to the start after 3 secs of the song, when it should play for 15 mins then loop
BlazBlueGaming, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you have something to add and your own post is the last one, simply edit it.

Also, the problem is not that it is lopping, it's that it goes back to the start after 3 secs of the song, when it should play for 15 mins then loop

Yes, exactly - the parallel process is looping, which means that it continually gives the engine the command to play the BGM again from the start.


You need to stop the parallel process from looping, so that it doesn't command the BGM to restart with every loop.
what should I do then? all my other BGM was parallel process and it never did this.
you need to check if the hour changed and not what hour it is - that way the BGM is only started once per game hour and not continually.


Which needs a bit more complex logic checking two variables (old hour number and current hour number)
What goes back to the start? The song? The only thing that would case that would be either something stopping and starting the music (like a fade bgm or a play bgm-none) then an event replays the song, or the song is being played at different speeds. I also think the bgm of the vehicle will restart if you change maps. In my game I'm quite sure the parallel process continuously calls for the bgm to be played, but so long as it is the same bgm that is already playing, the bgm just continues. for it to actually restart a song with the exact same tempo and volume means something else is wrong. Just tested on a new map with nothing but a parallel process playing a bgm, it doesn't restart the bgm, it just plays it on 'repeat' forever. How exactly have you evented it to last for 15 minutes specifically? Did you edit the script so that one hour lasts 15 real minutes? Is there any reason why your conditional branches have else handlers? At any point is any other event (or script) using that same hour variable? Are there any wait commands in the event? Does the Map automatically change bgm?


Also Andar is right, checking to see if the hour has changed is important for things you want to happen once per hour, but not continuously for the entire hour (like moving NPCs, special sound effects, etc.). But the BGM and maybe the BGS should be played continuously throughout a given hour, especially if you intend to allow the player to do things like change maps where the music/bgs may be different on each map depending on the time.
Yes the song goes back 
The song is 15 minutes that I downloaded


also if i hit the widows sign, and the game goes down, the music plays perfect
Okay, I started a new save and  the music seems to be working

Original thread: https://forums.rpgmakerweb.com/threads/advanced-game-time.3851/