OcRam - Time System plugin (for MV)

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Hey, how would one have time move in reverse with your time system? I've tried using plugin command "Time interval" to set the interval to a negative number, but the minimum value allowed is 250.
This is great idea and I will implement it to the next version (MV & MZ)!
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Latest version of OcRam Time System is now available with "Reverse time" feature (Credits @JosephG)

OcRam_Time_System (MV v2.10 & MZ v1.01)

Download @ https://ocram-codes.net
 

JosephG

Villager
Member
Joined
Jun 25, 2015
Messages
24
Reaction score
4
First Language
English
Primarily Uses
Latest version of OcRam Time System is now available with "Reverse time" feature (Credits @JosephG)

OcRam_Time_System (MV v2.10 & MZ v1.01)

Download @ https://ocram-codes.net
Incredible! Thank you! I might suggest next release you assign a variable/switch automatically for whether or not time is currently reversed, although not a big deal as this can be done easily anyway :)

Now to figure out how to get characters to move backwards when time is reversed (all except the player character)!

UPDATE:
Noticed you included this, which is helpful: OcRam.Time_System.isTimeReversed();
 
Last edited:

JosephG

Villager
Member
Joined
Jun 25, 2015
Messages
24
Reaction score
4
First Language
English
Primarily Uses
So, any ideas on how one might compare one date/time against another date/time? For example, check that date/time A is less than date/time B? Normally, you'd compare timestamps but the only stored/provided values in this time system are individual values (day, month, minute etc)?

I've tried doing a few nested conditions like "If OcRamYear >= MyYear" then "If OcRamMonth >= MyMonth" and so on until "If OcRamMinute >= MyMinute", but that doesn't logically work correctly. For example, it would prove false when comparing "1st of May 2020, 1:50pm" >= "1st of May 2020, 2:01pm" because we are comparing Minute vs Minute, which means "50" must be less than or equal to "01" in the above example, and that's false.

I think what the plugin is missing is some comparison methods, otherwise users will need to dive into coding with JS ~ something I'm trying to avoid currently :)

UPDATE:
Was able to get a comparison together with a custom script I wrote:

//Get OcRam Date and Character Date for comparison
var d1 = new Date($gameVariables.value(44),$gameVariables.value(45),$gameVariables.value(46),$gameVariables.value(47),$gameVariables.value(48),0,0);
var d2 = new Date($gameVariables.value(23),$gameVariables.value(24),$gameVariables.value(25),$gameVariables.value(26),$gameVariables.value(27),0,0);

//Compare
if (d1>=d2){
//do nothing
}else{
$gameVariables.setValue(22,2);
}
 
Last edited:

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
So, any ideas on how one might compare one date/time against another date/time? For example, check that date/time A is less than date/time B? Normally, you'd compare timestamps but the only stored/provided values in this time system are individual values (day, month, minute etc)?

I've tried doing a few nested conditions like "If OcRamYear >= MyYear" then "If OcRamMonth >= MyMonth" and so on until "If OcRamMinute >= MyMinute", but that doesn't logically work correctly. For example, it would prove false when comparing "1st of May 2020, 1:50pm" >= "1st of May 2020, 2:01pm" because we are comparing Minute vs Minute, which means "50" must be less than or equal to "01" in the above example, and that's false.

I think what the plugin is missing is some comparison methods, otherwise users will need to dive into coding with JS ~ something I'm trying to avoid currently :)

UPDATE:
Was able to get a comparison together with a custom script I wrote:

//Get OcRam Date and Character Date for comparison
var d1 = new Date($gameVariables.value(44),$gameVariables.value(45),$gameVariables.value(46),$gameVariables.value(47),$gameVariables.value(48),0,0);
var d2 = new Date($gameVariables.value(23),$gameVariables.value(24),$gameVariables.value(25),$gameVariables.value(26),$gameVariables.value(27),0,0);

//Compare
if (d1>=d2){
//do nothing
}else{
$gameVariables.setValue(22,2);
}
Thank you for the message,

And sorry for the late answer (have been away from my dev machine again). I was thinking exactly same date comparison routine my self :D

I was thinking to add OcRam.Time_System.getJSDate() -function in this plugin.
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
Hi! OcRam.
After saving and loading, the problem of automatic stop of the time system still exists, but I solved it by using YEP_UtilityCommonEvents to automatically run the public event to open the time switch when loading the archive and exiting the menu.
I would like to ask, for time and the time in the weather system, the default time flow rate is 250, and the weather lasts 60-480 by default. What unit of measurement is this converted time? I don't seem to find instructions in the plugin.
I want to set the duration of the weather to be the same as the time of day to control the frequency of the weather. Or set the interval time for automatic weather conversion? I don't really like the automatic change of weather many times a day, which is very unreasonable.
Can plug-in commands in custom weather directly call other plug-in commands? For example, I want to call the plug-in command of MOG_Weather_EX directly, and call the plug-in command to turn off the weather after the duration ends.
Is your Audio_EX compatible with pre-loaded plug-ins? I have tried any plug-in I can find, Chau_SceneStabilizer, BetterAudio, AudioStreaming, Audio Lag Fix, which will destroy the automatic SE of parallel processing. I like SceneStabilizer the most because it solves the problem of image and audio delay at the same time.
Finally, with your lighting plug-in, can you set the lighting Layers in Battle light data? Put it between the background image and the battle elves, because now the battle elves can’t see clearly
Sorry, there are many requests, I really like your plugins, and I plan to build games with them!
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Thank you for the message,

Glad you found solution to to after load time stop (this is strange problem because for example in my demo -project this works?).

Default flow rate is actually 0, but minimum interval is forced to 250ms (I should change default to 1000ms which would mean 1 second equals 1 minute in-game time).

Weather default duration is indeed 1 to 8 hours (in-game time). This can changed manually and then just copy paste for base to the new weathers.

Plugin commands are ment for various integrations like integration to MOG_Weather_EX plugin commands are array of string where you put desired plugin command.

I guess you already tried different plugin order? (It matters a lot)

Battle lights can be altered through plugin parameters and plugin commands.

I'm focusing all my development time (1h per day) to OcRam MZ -plugins at the moment. But I will continue to support my MV -plugins and will fix any bugs found in my demo project or in blank project.
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
Yes, using YEP_UtilityCommonEvents to automatically turn on the time switch is effective not only in your demo, but also in projects where I use more plug-ins.

Know the time and weather unit you use. I learned to control them, thanks!
As for the custom weather pool, I tried again. Yes, I can directly use the MOG plug-in command. Maybe I entered it wrong last time. LOL, all my weather questions have been resolved by understanding the plug-in parameters in detail! :LZSproud:

As for Audio_EX, I couldn't solve it, whether in your demo or in a blank project with only two plug-ins. No matter which pre-loaded plug-in is used, how to arrange the order.
Switch scenes and come back. SEs that need to be processed in parallel will play by themselves regardless of distance. BGS is normal.
Your demo (cat's cry, parallel processing) <aex:d:10+0:0:pan:default>
I tried to change to the same comment as BGS (ghost sound, key press trigger) <aex:d:8:0:pan:forced>
But it will not play SE.
Chau_SceneStabilize seems to conflict with your Layers plug-in. Whether in your demo or a blank project with only these two plug-ins, you will get an error when you switch scenes after adding layers图层与场景错误.png
But in my own project, I also use these two plugins. But there is no error. I am very strange. . .

Battle lights, I mean, if the battle background is layer 1, and the battle sprite is 3, can the lights be placed on the second layer? It now changes the original color of the sprite.
QQ截图20200916040030.png
Thank you again for reading, I understand that developing MZ plug-ins is now a priority, but your continued support for MV is already great!
 

JosephG

Villager
Member
Joined
Jun 25, 2015
Messages
24
Reaction score
4
First Language
English
Primarily Uses
Question - is there a way to add a variable amount of time to the clock? E.g. "fast forward to X time on the next day?". This would be very useful! For example, after a cutscene "ends" I'd like the player to be forced to go to sleep, then wake up at say 9am, but I want to ensure the date is correct after doing so. Since the cutscene could "end" at any time, I'd have to apply some maths to calculate how many hours/mins to add so that it becomes 9am the next day. E.g. if the cutscene ended and the in-game clock said 3am, I'd need to add 6 hours, but if the cutscene ended at 2am then I'd need to add 7 hours to bring it to 9am. Does that make sense (I could try to explain better)?

If this would be too complicated to add as part of the plugin I suppose I'd need to figure out the math/coding myself (hopefully I won't need to though!)
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Yes, using YEP_UtilityCommonEvents to automatically turn on the time switch is effective not only in your demo, but also in projects where I use more plug-ins.

Know the time and weather unit you use. I learned to control them, thanks!
As for the custom weather pool, I tried again. Yes, I can directly use the MOG plug-in command. Maybe I entered it wrong last time. LOL, all my weather questions have been resolved by understanding the plug-in parameters in detail! :LZSproud:

As for Audio_EX, I couldn't solve it, whether in your demo or in a blank project with only two plug-ins. No matter which pre-loaded plug-in is used, how to arrange the order.
Switch scenes and come back. SEs that need to be processed in parallel will play by themselves regardless of distance. BGS is normal.
Your demo (cat's cry, parallel processing) <aex:d:10+0:0:pan:default>
I tried to change to the same comment as BGS (ghost sound, key press trigger) <aex:d:8:0:pan:forced>
But it will not play SE.
Chau_SceneStabilize seems to conflict with your Layers plug-in. Whether in your demo or a blank project with only these two plug-ins, you will get an error when you switch scenes after adding layersView attachment 160833
But in my own project, I also use these two plugins. But there is no error. I am very strange. . .

Battle lights, I mean, if the battle background is layer 1, and the battle sprite is 3, can the lights be placed on the second layer? It now changes the original color of the sprite.
View attachment 160835
Thank you again for reading, I understand that developing MZ plug-ins is now a priority, but your continued support for MV is already great!
Thank you for the message,

I'll add Chau_SceneStabilizer compatibility to my neverending todo list ;)

Light layer is always most-top layer. Edits are allowed to all of my plugins if ToU is not touched in anyways.

Question - is there a way to add a variable amount of time to the clock? E.g. "fast forward to X time on the next day?". This would be very useful! For example, after a cutscene "ends" I'd like the player to be forced to go to sleep, then wake up at say 9am, but I want to ensure the date is correct after doing so. Since the cutscene could "end" at any time, I'd have to apply some maths to calculate how many hours/mins to add so that it becomes 9am the next day. E.g. if the cutscene ended and the in-game clock said 3am, I'd need to add 6 hours, but if the cutscene ended at 2am then I'd need to add 7 hours to bring it to 9am. Does that make sense (I could try to explain better)?

If this would be too complicated to add as part of the plugin I suppose I'd need to figure out the math/coding myself (hopefully I won't need to though!)
Thank you for the message,

Code:
* ----------------------------------------------------------------------------
 * Plugin commands
 * ============================================================================
 * You may control time via variables or following plugin commands.
 * To hide map clock        time hide
 * To show map clock        time show
 * To disable time:         time stop
 * To enable time:          time start
 * To reverse time          time reverse true
 * To unreverse time        time reverse false
 * To adjust time interval: time interval 1000
 * To add 15 minutes:       time add minutes 15
 * To add 1 hour to time:   time add hours 1
 * To add 7 days to time:   time add days 7
 * To add 4 month to time:  time add months 4
 * To change year:          {simply change year variable}
 * To set time to 10:41 pm: time set 22 41
 * To set date 2019/3/30:   time set 2019 3 30
 * or 2019/3/30 10:41 pm:   time set 2019 3 30 22 41
 

JosephG

Villager
Member
Joined
Jun 25, 2015
Messages
24
Reaction score
4
First Language
English
Primarily Uses
Thank you for the message,

Code:
* ----------------------------------------------------------------------------
* Plugin commands
* ============================================================================
* You may control time via variables or following plugin commands.
* To hide map clock        time hide
* To show map clock        time show
* To disable time:         time stop
* To enable time:          time start
* To reverse time          time reverse true
* To unreverse time        time reverse false
* To adjust time interval: time interval 1000
* To add 15 minutes:       time add minutes 15
* To add 1 hour to time:   time add hours 1
* To add 7 days to time:   time add days 7
* To add 4 month to time:  time add months 4
* To change year:          {simply change year variable}
* To set time to 10:41 pm: time set 22 41
* To set date 2019/3/30:   time set 2019 3 30
* or 2019/3/30 10:41 pm:   time set 2019 3 30 22 41
Ok, so if I wanted to advance time by a variable amount, depending on the current time of day, I'd need to apply a custom script that runs those plugin commands. For example, to get to 9am from 3am, I'd need to calculate 9-3=6 into a variable, which then calls the plugin command to add 6 hours (or just set the OcRam "hour" variable to the new value instead of using plugin)?
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Ok, so if I wanted to advance time by a variable amount, depending on the current time of day, I'd need to apply a custom script that runs those plugin commands. For example, to get to 9am from 3am, I'd need to calculate 9-3=6 into a variable, which then calls the plugin command to add 6 hours (or just set the OcRam "hour" variable to the new value instead of using plugin)?
I will add OcRam.Time_System.addMinutes (+hours and months) JS functions - they are super easy to do logic is already written inside the plugin I'll just have to expose 'em :d

Then you'd call: OcRam.Time_System.addHours($gameVariables.value(my_varid));
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
@OcRam
Unfortunately I don't know how to code. I can only wait for your update/
@JosephG
This is how I do it. When I go to bed, I use the plug-in command to directly specify the time as 8 am, and then add one to the number of days. I don't count hours
 

JosephG

Villager
Member
Joined
Jun 25, 2015
Messages
24
Reaction score
4
First Language
English
Primarily Uses
Thanks both of you, I look forward to trying both of these methods. The only issue with @41728280's method I see is that I would need to hide the clock until the next day, but it's not a small issue... might even be desirable to do that anyway. Depends on a use-case I guess!
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
602
Reaction score
720
First Language
Finnish
Primarily Uses
RMMZ
Latest version of OcRam_Time_System (v2.11) is now live!

Fixed "Time Disabled" bug after load and added new JS calls to add/subtract minutes/hours etc...

To add time:
OcRam.Time_System.addMinutes(minutes_to_add);
OcRam.Time_System.addHours(hours_to_add);
OcRam.Time_System.addDays(days_to_add);
OcRam.Time_System.addMonths(months_to_add);

To subtract time:
OcRam.Time_System.subtractMinutes(minutes_to_subtract);
OcRam.Time_System.subtractHours(hours_to_subtract);
 

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

Latest Threads

Latest Posts

Latest Profile Posts

My pumpkin! Anyone like Fallout?

It's not terrible, but could be better. This thing took me over an hour to carve. :kaophew:

Dad's watching a WWII documentary while I work on some cool assets for my games. I just love RPG Maker!
Also Happy Halloween! Dad's friend won't be coming unfortunately, but Dad will still be taking me to Boxi Park to have some fun tonight! I'll be posting a video on my YouTube channel of the show, and I'll be sure to post a link here.
"Nightmares exist outside of logic and there's little fun to be had in explanations. They're antithetical to the poetry of fear. In a horror story the victim keeps asking why, but there can be no explanation and there shouldn't be one..." - Stephen King
I feel people seek explanation and demand it sometimes in games, but in the horror genre, well, maybe you shouldn't have one. Silent Hill 1 comes to mind...
Managed to implement QSprite.

Always double check your plugin order.


Finally! I've been puzzling over why it wasn't working for two days now. Turns out all of my calculations were correct, I just forgot to give some events hitboxes. :kaoswt: Now my randomly generated maps check for collision errors, and move stuff around in real time if they finds any. :LZSexcite:

Forum statistics

Threads
104,682
Messages
1,008,071
Members
136,172
Latest member
Zykon
Top