Jump to content

World Day Tracker


AisenArvalis

Recommended Posts

Hey all, Aisen here. I came up with this Day Tracker while at work and decided to share it with you all. This is a base level system that can be improved on.

 

Pre-requisites:

Global Variable Boolean - Day Added = False

Global Variable Integer - Day = 0

 

Setup may vary slightly depending on server time setup.

 

Make a common event and create 2 pages, both with the trigger auto-run.

On the first page, set the condition to Time Between midnight-midday (Depending on server time setup, as long as it's after midnight and before midday, it's fine)
Then use the following logic:
b24fee63f9cde04df232b73400a1d32c.png

 

This'll make it add 1 day to the counter and then set the value of Day Added to True so it won't do it again since it checks if it's false before adding the 1.

 

On the second page, set the condition to Time Between midday-midnight (Again, depending on server time setup this may differ slightly but as long as it's after midday and before midnight, it'll work)

Then use similar logic to the first page:

a91342e75769bedaef0558eef38c4e90.png

 

This'll reset the Day Added to false IF it's true come midday, preventing it from adding more than 1 day at a time.

 

-LIMITATION-

From testing this works ONLY when at least ONE player is online as the event system is tied to players. There may be a way to do this through the API but that will require more testing from my side.

You could potentially also make a dummy account that is online 24/7 for this to actually tick.

Link to comment
Share on other sites

9 hours ago, Ainz Ooal Gown said:

 

Global variables... so beleive it will run alsong as server is online wont it?

 

The global variables will run fine, but not the common events, which are local. An autorun common event is a local autorun event for every player. So this system will only work if exactly one player is online at all times.

Link to comment
Share on other sites

Player count shouldn't matter for this as it locks behind another variable (Boolean) type which is global as well.

So once it adds a day it'll lock and won't be able to add again until midday unlocks the boolean.

 

I'll run a test with 24x Server Speed, so in theory it should add 1 day every hour.

Link to comment
Share on other sites

Player count always matter since events(including common events) always run tied to a character. Basically, if there are no players, events won't run. A common event is just a normal event which isn't tied to a map so you can call it from anywhere, but if nobody calls it then it just doesnt run.

 

If you want something like this really working you have to consider the possibility of counting more than 1 day (since maybe there wont be players for 2 days or more). You can't trust the intersect time, but you can use SYSTEM time and compare current time with last day count execution time, if time difference is equals or higher than 24h you add 1 day and add 24h to the last day count execution time. This way it will update correctly when any player logs in, even if there were no players from weeks.

Link to comment
Share on other sites

I have confirmed that it only adds days IF at least ONE player is online on the server.

So I'll update the post with that information for now.

 

Since this is tied to a common event there's the limitation.

I will however also go over the API and a webserver that auto run a script and add to the variable through it but it seems wholly too complicated just for a day tracking system.

 

In the meantime we could say time freezes when noone is on? :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...