Need some Tips regarding the "Loop Function"

Black Pagan

Veteran
Veteran
Joined
Feb 21, 2017
Messages
350
Reaction score
271
First Language
English
Primarily Uses
RMMV
Hello there. I'm attempting to create a Simple "Day and Night" Cycle in my Game to simulate a basic "Day & Night Cycle" based on varying "Screen Brightness", Also using "Wait x Frames" commands in between Cycles to simulate Individual Hours. The "x" doesn't matter for now, it can be anything later on, Depending on how long i want the Cycle to last.

I am using the Loop Function to simulate a "Daylight - Sunset - Dim-light - Darkness" Cycle. While I have this run as a Parallel Process on the Screen and it seems to be working fine, I have these 2 Questions :

(1) Is Parallel Process the best way to run an Event like this or is there a more Efficient way of event-ing this ?
(2) Can i Skip this Loop somehow with an External Event Switch ?
(3) Is there a way to Break this Loop somehow and Continue it later when i am Indoors ?

The reason I ask about (1) is because I am looking to simplify things and make them orderly, Since i plan to introduce Weather effects, Based on Variables in specific hours in this Day and Night Cycle.

The reason I ask about (2) is because I am trying to make a "Sleep" event where my Player goes to bed and Skips "x frames" in the Loop and ends up waking up later. Is this possible to event, If so how would i do this ?

The reason I ask about (3) is because I have a few Indoor Maps in my game where I don't like to see Weather or the "Day & Night Cycle" affect the Player.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,511
Reaction score
1,642
First Language
English
Primarily Uses
RMMV
Parallel events already loop themselves, without need for the command. Easiest way to do it is to increase a variable by a set number every second or so, which would indicate time passed, and resets to 0 once it has reached the full day cycle. Going to sleep would simply be an event that increases the timer variable by a significant value.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA

I've moved this thread to MV Support. Please be sure to post your threads in the correct forum next time. Thank you.


If it's a "How to" question, always post your thread in the Support subforum (unless you suspect you will need plugins, in which case post in Plugin Requests). "Game Mechanics Design" is for discussing engine-neutral game design topics like class balance, game economy, or skill tree design.

I agree with @Milennin's answer. Parallel Events will keep looping (for example if you have a 60-frame wait in it somewhere, it will run once per second; if you don't have any Waits nor any significant processing it will run 60 times per second), so all you need to do is to have the Parallel Process Event run only when you want time to run. If there's a command in there to increase the "In-Game Minutes" variable by 1, it will increase by 1 every time the Parallel Event runs.

For example, you could have the Parallel Process Event require a Switch called "Run Time". When you want to freeze time, set that Switch to OFF. When you want time to run again, set that Switch to ON. If your character going to sleep resets the time to 8:00 AM, then have the "In-Game Hours" variable set to 8 and the "In-Game Minutes" set to 0 when the player sleeps. No need to do anything fancier than that.

P.S. when you add tags to a topic, separate them with a comma so the system can read each one as a separate tag. For example: loop, function, day-night cycle, weather
 
Last edited:

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,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top