Orange Time System

Yes, this can easily be done with events using the Time System Events add-on, but I'll soon make a new add-on to do this automatically.
Thank you very much. With this and many other plugins people will be able to make rpg's similar to Skyrim.
Thanks for solving the problem. This is an optional request - please add the ability to change the name of the months instead of numbers. 🙂 Thank you!
First I would like to say that this is a wonderful plugin, but I do have a question.

Is it possible to modify the flow of time dynamically? Through tileset index or Region IDs. Lest say the player is moving on a forest tile and thus should be moving more slowly, time would speed up to simulate that. On roads time would slow down to simulate that the player is moving faster.

Is it possible to do the same with plugin commands? That way events can effect the flow of time. Say the weather is good so the party can move 1.5 times faster. So when the player is moving through the forest and it is good weather the effects can add together and the player can move at normal speed.

Thank you for this great plugin.
Thanks for solving the problem. This is an optional request - please add the ability to change the name of the months instead of numbers. 🙂 Thank you!
How do you want to use the month names?

First I would like to say that this is a wonderful plugin, but I do have a question.

Is it possible to modify the flow of time dynamically? Through tileset index or Region IDs. Lest say the player is moving on a forest tile and thus should be moving more slowly, time would speed up to simulate that. On roads time would slow down to simulate that the player is moving faster.

Is it possible to do the same with plugin commands? That way events can effect the flow of time. Say the weather is good so the party can move 1.5 times faster. So when the player is moving through the forest and it is good weather the effects can add together and the player can move at normal speed.

Thank you for this great plugin.
Would it help if I added an option to load the "secondLength" param from a variable?
Would it help if I added an option to load the "secondLength" param from a variable?
Yes, that would be great.
I've updated this script with a lot of new features, check the main post 🙂
Is there a way to show the timer only on the menu ?
Is there a way to show the timer only on the menu ?
Not yet, I don't have any plugin to add it to the menu
I apologize in advance if this was already answered, but using the mainSwitchId, would it be possible to pause the flow of time when in specific maps? I would like to implement this but have it pause while the player is in a town or dungeon and only have time flow while travelling via the overworld or sleeping at an inn.  This would allow me to create time-of-day specific npc behaviors without having to stress out about completely scheduling their movements to sync up with an always-running clock.
Question, is there any way to set the time? Like if it was currently 17:00, and you wanted to set the time to 3:00, is there any way to do this?
Question, is there any way to set the time? Like if it was currently 17:00, and you wanted to set the time to 3:00, is there any way to do this?
Script call:

OrangeTimeSystem.setTime(seconds, minutes, hour, day, month, year);
To set it to 3:00:

Code:
OrangeTimeSystem.setTime(0, 0, 3);
Script call:

OrangeTimeSystem.setTime(seconds, minutes, hour, day, month, year);To set it to 3:00:

OrangeTimeSystem.setTime(0, 0, 3);
Does this mean you can use a script call to fast forward time like say, staying at an inn, or sleeping in your bed will cause it to be morning thus being able to skip ahead if needed?
Does this mean you can use a script call to fast forward time like say, staying at an inn, or sleeping in your bed will cause it to be morning thus being able to skip ahead if needed?
Yes, you can also call this for example:
OrangeTimeSystem.addHours(8);
I apologize in advance if this was already answered, but using the mainSwitchId, would it be possible to pause the flow of time when in specific maps? I would like to implement this but have it pause while the player is in a town or dungeon and only have time flow while travelling via the overworld or sleeping at an inn.  This would allow me to create time-of-day specific npc behaviors without having to stress out about completely scheduling their movements to sync up with an always-running clock.
I thought I had replied to this. But well, you can currently do it with variables. I can add switches to a plugin to make it easier.
would like to report a glitch.

The Setup:

Using your TimeSystemEvent plugin to activate a common event with the following code:

var a = $gameVariables.value(3); if (a === 13) { $gameVariables.setValue(13, 1); } else if (a === 14) { $gameVariables.setValue(13, 2); } else if (a === 15) { $gameVariables.setValue(13, 3); } else if (a === 16) { $gameVariables.setValue(13, 4); } else if (a === 17) { $gameVariables.setValue(13, 5); } else if (a === 17) { $gameVariables.setValue(13, 5); } else if (a === 18) { $gameVariables.setValue(13, 6); } else if (a === 19) { $gameVariables.setValue(13, 7); } else if (a === 20) { $gameVariables.setValue(13, 8); } else if (a === 21) { $gameVariables.setValue(13, 9); } else if (a === 22) { $gameVariables.setValue(13, 10); } else if (a === 23) { $gameVariables.setValue(13, 11); } else if (a === 0) { $gameVariables.setValue(13, 12); } else { $gameVariables.setValue(13, a); }var b = $gameVariables.value(8);if (b === 1) { $gameVariables.setValue(14, "AM"); } else if (b === 2) { $gameVariables.setValue(14, "AM"); } else if (b === 3) { $gameVariables.setValue(14, "PM"); } else if (b === 4) { $gameVariables.setValue(14, "PM"); }All that to convert 24hr time to 12 hour time as well as determine AM/PM.
The Problem:

Spoiler
[IMG]http://i1379.photobucket.com/albums/ah157/koldsack/screeny1_zpswnfqq8zf.png[/IMG][IMG]http://i1379.photobucket.com/albums/ah157/koldsack/screeny2_zps385xmj5h.png[/IMG]
This only happens if i'm using OrangeTimeSystem.addHours(n); to push time forward.
Would also like to squeeze in a request for OrangeTimeSystem.setTime(seconds, minutes, hour, day, month, year); to be respective, as in OrangeTimeSystem.setTime(day); OrangeTimeSystem.setTime(month); and etc. this is so that i can have a common event to change some particular months manually when they don't have 31 days. Feb to switch over to 1 March on the 28th for example. The current plugin uses 31 days for all months. thanks in advance and for this wonderful plugin 🙂

oh btw, if i can like this plugin/post 10 times i would! this system when coupled with your event activator is ingenious, since it would not be constantly listening every tick but would only do something at a certain juncture or when conditions are met. thanks alot!
Hmm.. I'm writing this from my phone, so I don't know if it will work or not, but you can do something like this:

var ampm = "am";var hour = OrangeTimeSystem.hour;if (OrangeTimeSystem.hour >= 12) { ampm = "pm";}hour = hour % 12;if (hour === 0) { hour = 12;}$gameVariables.setValue(1, ampm);$gameVariables.setValue(2, hour);To specify only one value for the time system, you can do it like this:

OrangeTimeSystem.setDateTime({month: 15});But to use months with different lengths, your best option is to change the regular plugin methods to make it progress time accordingly. You will also have to change the method that calculates the week day.
I can make your job much easier by adding a new param to use real time system without syncing it with the computer clock.
actually i was reporting a glitch with OrangeTimeSystem.addHours(n), it apparently does hour addition either 1 step early or 1 step late, see screenies i attached on my last post. hope i'm making sense.
 

Hmm.. I'm writing this from my phone, so .... $gameVariables.setValue(2, hour);
Thank you, i will try it out, looks like a better way to do 12hr with meridian conversion.
 

To specify only one value for the time system, you can do it like this:

OrangeTimeSystem.setDateTime({month: 15});
Excellent! Thanks!
 

But to use months with different lengths, your best option is to change the regular plugin methods to make it progress time accordingly. You will also have to change the method that calculates the week day.
I can make your job much easier by adding a new param to use real time system without syncing it with the computer clock.
Nah, actually i like the way you device the system as it is. when used with your event plugin, it saves resources without incessant calls. besides i run real time at a faster rate, 10 ticks instead of the default 1000/100. thanks alot.

EDIT: Just tried the month call on a common event:

var a = $gameVariables.value(6);var b = $gameVariables.value(5);var c = $gameVariables.value(4);var d = 2016 || 2020;if (a == d && b == 2 && c >= 30) {OrangeTimeSystem.setDateTime({month: 3});} else if (a != d && b == 2 && c >= 29) {OrangeTimeSystem.setDateTime({month: 3});} it works flawlessly, except when i push time forward artificially with OrangeTimeSystem.addHours(23); it only updates the month on feb 30th (for non Leap years) and feb 31th on leap years (specified by var d). this 1 step delay in updating the month causes the day var to fall 1 day short and hence wrong day.
Try using this version of the plugin.


I couldn't properly test it, but if you set the useRealTimeStructure param to true, the time would probably work the way you want it to and you won't need to add any common event.


It will automatically consider leap years and everything.


The problem with the addHours method is kind of weird, because everytime I increase the day, I remove 24 hours from the hour variable. Your screenshot should only be possible if the time was increased in 25 hours.


Are there any setTime or setDateTime calls left anywhere on your code?
Try using this version of the plugin ...

It will automatically consider leap years and everything.
Thanks so much! I will have a go at it.

EDIT: I think this version broke the 24 hour time cycle unfortunately, when realtime structure is activated.

The problem with the addHours method is kind of weird, because everytime I increase the day, I remove 24 hours from the hour variable. Your screenshot should only be possible if the time was increased in 25 hours.

Are there any setTime or setDateTime calls left anywhere on your code?
Not that i know of, i did changed OrangeHudClock.js' line.VariableSecond and  variableData.VariableSecond > 0 conditional to return a string instead of a number. so that i can use the seconds %3 pattern to call a var with stored AM/PM data. Most likely it's due to me shuffling the days around so that 0 would be a Thursday (was monday by default), since the beginning of 2016 starts on a Friday, while starting day is defined as 1.

EDIT: ok i think i found out what was the issue:

if i use the code you provided for 12hr/meridian conversion, the update does so exactly at 12 AM (though the HUD didn't update the time as 12 AM, F9 console showed that it indeed is 12 AM - or 0 hour).

If i do the day change to Mar using:

var day = OrangeTimeSystem.day;var month = OrangeTimeSystem.month;var year = OrangeTimeSystem.year;var leapyears = 2016 || 2020;if (day >= 30 && month === 2 && year === leapyears) { OrangeTimeSystem.setDateTime({month: 3});}if (day >= 29 && month === 2 && year != leapyears) { OrangeTimeSystem.setDateTime({month: 3});}it works! without any 1 day delay!

I believe the common denominator with both, is that they do not compare variables in the js conditionals. the conditionals are purely using script calls from your plugin direct, that seemed to have eradicated the problem.
Oh, sorry, I hadn't seen that you had edited your post. I tested and fixed the useRealTimeStructure here now. I'm currently uploading a demo that uses an am/pm system using that snippet I showed you.


Edit:


Demo download


Play demo online
Yep, realtimestructure works perfect now. Thank you very much!

ps: until this demo, i didn't know i can use \[v] as a string pattern for HUDDate lol.

Original thread: https://forums.rpgmakerweb.com/threads/orange-time-system.46509/