Advanced Game Time

Common error! You'd be surprised at how many do this! Or maybe you won't... I'm not you, I can't tell.

You're trouble event is checking if the hour is both greater then 20 and less then 6, which is impossible. 

However, if you change that and to an or, then it's checking if it's greater then 20 or less then 6, which is what ya want~

(Yay for pictures, makes it so much easier to spot!)
Common error! You'd be surprised at how many do this! Or maybe you won't... I'm not you, I can't tell.

You're trouble event is checking if the hour is both greater then 20 and less then 6, which is impossible. 

However, if you change that and to an or, then it's checking if it's greater then 20 or less then 6, which is what ya want~

(Yay for pictures, makes it so much easier to spot!)
Oh you were so right thanks :3 I got it working now :3 only problem is that it won't work as an common event so I will have to Copy Paste and change it for every lamp or nightlight  I want on each map D:

but many thanks for the help 
Im having some trouble with line 555 it says Script 'Game Time' line 555: NoMethodError occured.

undefined method min for nil:NilClass
Are you loading from a save file that was created before you put the script in?
Yeah, I was, I ended up fixing it, thanks for creating an awesome script
COOL script!

Ummm, I was wondering, is there any way to assign say, the days of the week to a variable? I just assumed there was, as a game time script for XP I used before did...I was thinking, it would be cool in Ace to use it in damage formulas easier!

Specifically, I'd like to make certain attacks stronger on certain days of the week. Maybe Thunder attacks do more damage on Thursday. (THORsday). Maybe Fire attacks are stronger on Friday. (FRYday)...I know how to set it up if I had the variables, but I don't know how to link seconds/minutes/hours/days/months/years/whatever to variables.

Also, a way to make a common event trigger each day? That would allow me to do something for the day of the week thing (but not minutes or whatever)

Just my thoughts...
You can have a parallel  process common event running where you set the variable to any portion of the time you want, in your case:

GameTime.day_week?

would go into the control variable script box.

For the common event question, you could have a second variable, and everytime that variable doesnt equal GameTime.day_week?, the day changed so you can call the common event you want then do the same as above and make it equal day of the week. This would be done in the same common event 

For this situattion, checking a variable against a script function works like this: (assuming variable #5, you can change that to whatever you want.

$game_variables[5] != GameTime.day_week?
You can have a parallel  process common event running where you set the variable to any portion of the time you want, in your case:

GameTime.day_week?

would go into the control variable script box.

For the common event question, you could have a second variable, and everytime that variable doesnt equal GameTime.day_week?, the day changed so you can call the common event you want then do the same as above and make it equal day of the week. This would be done in the same common event 

For this situattion, checking a variable against a script function works like this: (assuming variable #5, you can change that to whatever you want.

$game_variables[5] != GameTime.day_week?
Alright, thanks for answering. Sounds a little complicated for me, but I think I can figure it out. One thing, is that I plan on time not passing during battle, so wouldn't it work to make all the variables handled and settled at the beginning of the battle?
You could! As long as they can't go days and days without a battle, I don't see why not.
Hey there, Vlue!

I finally got all of your scripts working on my project, but I have 2 little questions tough...

1° - Since I managed to make KHAS's script work, I wanted to make an event, that would show the lights only after a certain day time. Something like this: 

I have a lamp, and there's an event on it, nothing would happen, but when it was, let's say, 5 PM, the event would make the lights work and when it was 7 AM it would turn them off again. This is because I wanted a way to make the lamp turned off the whole day, and it would only show it's "turned on" animation at a certain time.

2°- I thought it would be nice to have a new dawn everytime I slept at an Inn or something like that... I'm thinking on something like, everytime I choose the option to sleep, the time would be reset to the morning again.

So, any Ideas on how to make these work?
A wild signature!? Oh no! Vlue uses READ. It's super effective! Actually that was a short read... off topic though.


#1: Oh that's easy! Use the uh.. the.. uh... ooookay, then. Set a common event to turn on and off a switch depending on the hour? Like.. if:


GameTime.hour? > 7 and GameTime.hour? < 17


then switch be all off, but if not then it be all on, and events are set up.. accordingly... yah.


#2: There's a command to set time to whatevew yoo want! Erm... whatever you want... yah. To set it to say... 6 am it'd be:


GameTime.change(0,0,6)


Can you imagine how much shorter my responses could be if I didn't hum and haw all the time? Langourlious I say.
LOL!!! I laughed sooo hard UHEHUEUHE

Your answers are better this way! haha

And yes, It was SUPER EFFECTIVE!!!

Thanks a lot, as always you have a simple solution to something that seems so hard to do.

I really didn't know how to make the first one, but the second one I was even using that line of code to start up the game, so, yah, I think forgot to check that.. hehe

So, here's what I did: 

I created a conditional branch with GameTime.hour? < 17, that activated a self switch. The switch turned on the second page of the event, making the graphic change (turning the lights on). And at this same page I did another conditional branch with GameTime.hour? > 7, and this one turns off the self switch at that time, making the event go back to the first page.

It's working more than perfect!!!
Greetings good sir. Lovely script, one question or suggestion. Is there a way to set up map encounters at specific times of days? Say night time enemies like vampires if your tromping around at night?
Also is there a way to set up more common enemy encounters at specific times. Say heaps of zombie encounters at night and rare zombie encounters during the day?
No there is not 🙁


Intriguing idea though, I might look into it.
one variable for GameTime.Hour?  (parallel process, dummy switch on)...if you couldn't tell, I am using a common event.

another one for randomness of encounter
 
Conditional branch if hours in range of what you want.
Battle Processing (whatever monsters you want)
Script addtime (optional)
Wait x frames.  (You need this one or the battles never stop).
 
That is the most basic one but you can add more conditionals to this as well.

I also attached a screenshot of a slightly more advanced one.  I could see where the second one could be useful but it still has problems.  You might

included another conditional involving map ids.  I am not sure how it would affect the regular random encounter functions of rmvxace.

Ok. I tested this more.  I did get some regular random encounters when the character moves about.  The common event works even when the character is still or in an area where there are no regular random encounters. 
 

Basic_Timed_Encounter.PNG
Hi i got a problem, i`m using your script (and the weather one as well)

And Khas`s awsome lights script, the problem begins when i use a script Yanfly`s core engine update, wich works percect when used only with your scripts, but as soon as i use Khas lights it will give me a visual bug(attachment picture) where the tint is only covering 80% of the screen, i suppose this is due to the bigger screen resolution, and the porblem is in khas scirpt?

Can you help with this one, or should i try asking Khas for help?

Anyways Absolutely adore your scripts, and from reading a few hundred pages of your forum posts i am supprised how helpefull you are, it really makes me happy that there are still ppl like you.

problem.png
It's a Khas thing. The version of it I have here was hardcoded for 544*416 resolution only (the default resolution).

You can get around this by changing four lines, lines 641, 938, 956, and 957. 

These four lines have the number 544 and 416 in them somewhere, switch out 544 with Graphics.width and 416 with Graphics.height in each line and you're good to go.
It's a Khas thing. The version of it I have here was hardcoded for 544*416 resolution only (the default resolution).

You can get around this by changing four lines, lines 641, 938, 956, and 957. 

These four lines have the number 544 and 416 in them somewhere, switch out 544 with Graphics.width and 416 with Graphics.height in each line and you're good to go.
It worked, i didnt think it whould be that simple, Thank you sooo much. 🙂
Wah, no matter what i try when using your gametime/weather and Khas lights the tint from your gametime dissapears, it will be dark at night but the color tint dose nto appear at all, it works perfect with Voctors light, but his lights are much much more cpu intesivem and i`m using a map thats 200x200 with already 340 events on it 🙂

So i have to stick to Khas engine (just 20 lights from victors script ade the game lag so much, even with his anti lag solution) but i love your game time tinting, i see your patchnotes says you fixed the notint probelm, but it still wont work for me :S

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