Day/Night System... What's the Easiest way to do it?

Winston

Gaming Point
Veteran
Joined
Dec 18, 2012
Messages
44
Reaction score
2
First Language
English
Primarily Uses
I want it to be like a life simulator type of mechanic i.e. working out can increase strength, but time passes.

At the moment, I'm trying to use variables for a day/night system, but I'm not sure if it's the best way. For instance:

Variable X = 0 Means that it is morning

Variable X = 1 Means afternoon

Variable X = 2 Means night

Everytime you do something i.e. go to the gym, variable X increases by 1. When you go to sleep at night, variable X goes to 0.

However, is this the best and easiest way to approach it? I've run into quite a few problems already, for instance, I want some events to occur only during the afternoon (X = 1).

But the event page only allows X is equal or greater than 1, meaning it occurs at night too. I've found a way around this problem, but I also run into others I can't find a way to resolve.
 

Raider

Veteran
Veteran
Joined
Mar 21, 2014
Messages
138
Reaction score
113
First Language
German
Primarily Uses
The easiest way to implement such a feature would be a script.

For example this here: http://www.rpgmakervxace.net/topic/3225-basic-game-time-nightday/

You can also do such a system with events, but then it gets more time-consuming and complicated for you, though you will better know how everything works and can probably make changes (such as the length of a day or involving certain switches) more quickly.

But the idea you have presented in your post is also relatively simple and depending on what game you are doing it could fit. If you want to make some life simulator which depends on actual actions, than your system could do that, although i would add more steps in between (more variables an such things as "early afternoon" etc.). If you want a real-time system you must do something like a counter.

All in all, I think your basic idea should be enough, if I interpret your game-genre right.

For your problem with the variables, I mean there must be some command X less then or equal to, or even just X equal to.

So you could use just X equal to, or if I'm incorrect you could simply use two commands combined:

X equal or greater to 1 --> conditional branch: X equal or less than 1.

Then the action will only happen if Variable x is equal to 1.

Hope I could help.

Greetings
 
Last edited by a moderator:

Winston

Gaming Point
Veteran
Joined
Dec 18, 2012
Messages
44
Reaction score
2
First Language
English
Primarily Uses
The easiest way to implement such a feature would be a script.

For example this here: http://www.rpgmakervxace.net/topic/3225-basic-game-time-nightday/

You can also do such a system with events, but then it gets more time-consuming and complicated for you, though you will better know how everything works and can probably make changes (such as the length of a day or involving certain switches) more quickly.

But the idea you have presented in your post is also relatively simple and depending on what game you are doing it could fit. If you want to make some life simulator which depends on actual actions, than your system could do that, although i would add more steps in between (more variables an such things as "early afternoon" etc.). If you want a real-time system you must do something like a counter.

All in all, I think your basic idea should be enough, if I interpret your game-genre right.

For your problem with the variables, I mean there must be some command X less then or equal to, or even just X equal to.

So you could use just X equal to, or if I'm incorrect you could simply use two commands combined:

X equal or greater to 1 --> conditional branch: X equal or less than 1.

Then the action will only happen if Variable x is equal to 1.

Hope I could help.

Greetings
Thanks for your reply. 

I will keep in mind to add in more steps in between the variables, just in case I need them.

Also does the script you mentioned allow my sort of game or is it basically an in-game clock that ticks no matter what you are doing? I want it so the time passes only when the player does a specific event. If the script can do that, then that will be a much better option.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
If you got 3Day Phases give every Event 3Eventpages, than you dont run in your Bug

that the seccond eventpage is shown when your variablex = 3.

And yes its the simplest way to archieve  such kind of Cycle.
 

Raider

Veteran
Veteran
Joined
Mar 21, 2014
Messages
138
Reaction score
113
First Language
German
Primarily Uses
@Winston:

The script is for a real-time system, so it's not that good for what you are planning.

In fact, for your kind of game the evented system would be the best choice, as you can modify it more easily.
 

shaynec1981

Veteran
Veteran
Joined
Jun 10, 2014
Messages
88
Reaction score
21
First Language
English
Primarily Uses
I actually am finishing up a script for my own use/practice that sounds like would work for you. It keeps track of time, days, weeks, months, and years as well as keeping track of total days gone by. All you have to do to adjust date/time is change the variables to whatever you want. The script automatically accounts for how many days should have passed and whether it's AM or PM. I could pretty easily add in a couple more variables for it to track phases of night/day (dusk, dawn, night, etc) if that's what you need.

You can also stop and start the time cycle by simply turning a switch on and off. So say you want working out take up 2 hours. At the start of the commands for working out, turn the switch off, add 2 to the hours variable, then turn the switch back on and that's it.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top