Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
New forum theme up and running!
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Day n Night and Timer Operations
« previous
next »
Print
Pages: [
1
]
2
3
Author
Topic: Day n Night and Timer Operations (Read 11182 times)
evmaster
Member
Associate
Posts: 231
Day n Night and Timer Operations
«
on:
August 13, 2012, 09:11:19 PM »
Hello. Can I have some help on a Day and Night System? I am trying to work with the Timer Operations too. But I can't seem to get the timer to start. I would also like some NPC to appear at different areas at different times of the day. Thanks.
Logged
Natako
Queen of Nonsense
Exemplar
Posts: 1,012
Jack of a few unremarkable trades, master of none.
Re: Day n Night and Timer Operations
«
Reply #1 on:
August 13, 2012, 11:03:56 PM »
Out of curiosity, which RPG Maker are you using? I had a fully functional day and night system in a mission-based game I was working on in VX (including proper screen tinting for various times throughout the day) but it's been a while and I know that some things don't work universally in all RPG Makers even when you'd expect them to.
Unfortunately, that game was on my other laptop and I'd have to write the whole thing up again from scratch, but I'd like to make sure it works before I post anything.
Logged
Retiring the deadlines because I think I've proven that I can get stuff done. It might come on my own time, but it will be better quality that way.
Pants.
evmaster
Member
Associate
Posts: 231
Re: Day n Night and Timer Operations
«
Reply #2 on:
August 14, 2012, 12:20:22 AM »
I have Rpg maker 2003.
Logged
Natako
Queen of Nonsense
Exemplar
Posts: 1,012
Jack of a few unremarkable trades, master of none.
Re: Day n Night and Timer Operations
«
Reply #3 on:
August 14, 2012, 02:07:37 AM »
Okay, not going to have too much time to work on it tonight and I have work in the morning, but I'll try to put one together in 2003. Shouldn't be much different than VX, but I'll let you know how I made out.
Logged
Retiring the deadlines because I think I've proven that I can get stuff done. It might come on my own time, but it will be better quality that way.
Pants.
evmaster
Member
Associate
Posts: 231
Re: Day n Night and Timer Operations
«
Reply #4 on:
August 14, 2012, 02:16:31 AM »
Alright. I look forward to it. Thanks!
Logged
Natako
Queen of Nonsense
Exemplar
Posts: 1,012
Jack of a few unremarkable trades, master of none.
Re: Day n Night and Timer Operations
«
Reply #5 on:
August 14, 2012, 02:47:33 AM »
How long do you want the in-game days to last? Also, do you want any sort of clock option? (In other words, you would be able to inspect X object and find out what time of the day it is)
There are two ways that I can think of to go about doing this and depending on what type of system you want specifically, one might work better than the other.
Logged
Retiring the deadlines because I think I've proven that I can get stuff done. It might come on my own time, but it will be better quality that way.
Pants.
evmaster
Member
Associate
Posts: 231
Re: Day n Night and Timer Operations
«
Reply #6 on:
August 14, 2012, 02:54:26 AM »
Hmm... I would like it to tell me what time it is. I just wanted it to turn night and day kinda like Harvest moon.
Logged
Prpl_Mage
Administrator
Sage
Posts: 7,644
The Administrator Mage
Re: Day n Night and Timer Operations
«
Reply #7 on:
August 14, 2012, 06:50:22 AM »
First off. Don't use the timer. It's pretty worthless. Good for countdowns though. When you want it to appear on screen and such.
Too make it easier to explain we're gonna go with actual time with your days. You merely need to change some conditional branches to tweak it.
The idea is simple like this. Every second 1 is added to a variable that represents seconds.
Everytime the variable seconds reaches 60 it adds 1 to the variable minutes and sets seconds to 0.
Everytime the variable minutes reaches 60 it adds 1 to hours and sets minutes to 0.
When hours reaches 25 you set it to 1.
In your events (and a common event) you check if the hour is greater or lower than a specific time. For example:
3-6 Dawn
6-10 Morning
10-14 Day
14-18 Afternoon
18- 21 Evening
21-3 Night
OR much more simple:
Day: 5-19
Night 19-5
So you check if the variable hour is greater than or lower than what hour the clock should be.
Wait why even bother that. Let's make it even more easy.
In the common event that counts the time. Make it so that when hour passes the hours you've decided on it turns on a switch that represents if it's night or day.
So when hour passes let's say 19 it turns on the switch night and off the switch day. Tint the screen a bit dark blue and maybe hide the screen during the transition.
And the switch (Night / day) are the ones you'll use for preconditions or conditions in events. No point in making everything time based like Majoras mask.
Oh right then. Explaination went pretty good. Hope you got an idea what you're gonna do 'cuz here it comes:
--------------------------=================================--------------
First off we want to create a common event.
Create three variables for seconds, minutes and hours. Then two switches for day and night.
Make the common event a paralell event (so it always runs) and name it "clock" or "father time" or whatever catchy name you can come up with.
Let's go to the commands then. It's gonna look a lot like this:
Wait 1.0 seconds
VAR Sec, +1
IF VAR Sec >= 60
¤VAR Min, +1
¤VAR sec, = 0
ELSE
IF VAR Min >= 60
¤VAR Hour, +1
¤VAR Min, = 0
ELSE
IF Hour >= 19
IF Day is ON
¤ Hide screen
¤ Play sound (like the inn sound)
¤ Tint screen (dark blue for that nighty feeling)
¤ Switch day: OFF
¤ Switch night: ON
¤ Show screen
ELSE
IF Hour >= 5
IF Night is ON
¤ Hide screen
¤ Play sound (like the chicken sound)
¤ Tint screen (normal tint)
¤ Switch day: ON
¤ Switch night: OFF
¤ Show screen
ELSE
IF Hour = 25
¤ VAR hour, = 1
The end
-------------------------------------------
So yeah. That's the basic idea that should do the trick. If you want to check the time make the clock (or whatever) show the message: "/v[X] : /v[Y]" Where X is the variable Hour and Y is the variable Minutes. It will show it like a 24 hour clock but that's always been the best way to show time so.
If you want shorter hours (you should) simply change those first parts when Minutes and seconds is added. For example make it add +10 to sec every seconds and each minute will only last 6 seconds instead of 60. Which would cut down the time an hour takes from 3600 seconds to 360.
You could also require less than 60 of a minute to add to the hours. It's all up to you really.
Oh yeah.l If you want to count the days. Throw in a variable for days and make it add 1 each time the hours go from 25 to 1.
Good luck.
Logged
Cool RPGM Project!
Sprite till you die
Oh my god, this was ...10 years ago...
Natako
Queen of Nonsense
Exemplar
Posts: 1,012
Jack of a few unremarkable trades, master of none.
Re: Day n Night and Timer Operations
«
Reply #8 on:
August 14, 2012, 04:25:02 PM »
Well, thanks Prpl. I was actually going to do this once I got home from work but now I guess I'll have to sit on my rear all afternoon and find some other way to waste time.
And I was actually going to be helpful for once!
Prpl probably did a better job explaining than I would, though, so yeah.
«
Last Edit: August 14, 2012, 04:27:21 PM by Natako
»
Logged
Retiring the deadlines because I think I've proven that I can get stuff done. It might come on my own time, but it will be better quality that way.
Pants.
Meiscool
Staff
Exemplar
Posts: 1,138
I died for YOUR sins.
Re: Day n Night and Timer Operations
«
Reply #9 on:
August 14, 2012, 04:57:38 PM »
Typically in games 1 rl second = .5 - 1 ig minute. That means 1 day in a game is 24/48 minutes worth of gameplay. I find that to be a good length of time.
Logged
evmaster
Member
Associate
Posts: 231
Re: Day n Night and Timer Operations
«
Reply #10 on:
August 14, 2012, 06:06:55 PM »
It's not working for me. I am sure I am doing something wrong.
Logged
Meiscool
Staff
Exemplar
Posts: 1,138
I died for YOUR sins.
Re: Day n Night and Timer Operations
«
Reply #11 on:
August 14, 2012, 06:31:19 PM »
That looks fine.
Though, personally, I would do Show screen (Fade)-> Tint with a 0.0 wait rather than hide, sfx, tint, show.
Using the show screen option while the screen is already show adds a nice "slow down" effect to the game due to the natural programming. Try it out.
EDIT: you may have to put the tint before the show screen. I honestly can't remember the correct order.
Logged
drenrin2120
Global Moderator
Sage
Posts: 6,101
Re: Day n Night and Timer Operations
«
Reply #12 on:
August 14, 2012, 06:54:39 PM »
Here, I suggest downloading rpgmaker 2009 ultimate. It'll provide an option to enlarge the eventing space window.
Also, is the problem that the day/night only works on one map? You should probably make this a common event and toggle it on/off with a switch.
Logged
evmaster
Member
Associate
Posts: 231
Re: Day n Night and Timer Operations
«
Reply #13 on:
August 14, 2012, 07:05:29 PM »
It's not working at all. Unless, there is a long wait that I haven't stick around long enough to see any changes.
Logged
Meiscool
Staff
Exemplar
Posts: 1,138
I died for YOUR sins.
Re: Day n Night and Timer Operations
«
Reply #14 on:
August 14, 2012, 07:08:15 PM »
Yes... you have it set to change every 10+ hours, so you have a long wait. That is why I suggested to change it to a lower amount of time, such that one minute = one hour in the game.
Logged
Print
Pages: [
1
]
2
3
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Day n Night and Timer Operations