• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: [v13+] Unreal Time System (like Minecraft)

139
Posts
11
Years
How do I "sleep?" I read every comment on this thread and read the script pretty thoroughly but I still have no idea what event the game's looking for when the player "sleeps."

I basically want to advance time by 24 hours so planted berries grow whenever the player talks to a bed, but all I could find (unless I misunderstood) is that I need to change something in the pbGetTimeNow so the game advances 86400 seconds whenever the player "sleeps..." And no clear script to get the player to sleep.

Edit: By the way, this isn't what I mean. Berries don't seem to care if I can control the rotation of the earth. They only seem to care when the clock is actually moving.
Code:
$PokemonGlobal.newFrameCount=25745
 
Last edited:

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
How do I "sleep?" I read every comment on this thread and read the script pretty thoroughly but I still have no idea what event the game's looking for when the player "sleeps."

I basically want to advance time by 24 hours so planted berries grow whenever the player talks to a bed, but all I could find (unless I misunderstood) is that I need to change something in the pbGetTimeNow so the game advances 86400 seconds whenever the player "sleeps..." And no clear script to get the player to sleep.

Edit: By the way, this isn't what I mean. Berries don't seem to care if I can control the rotation of the earth. They only seem to care when the clock is actually moving.
Code:
$PokemonGlobal.newFrameCount=25745

Hi, I just found this awesome script and he work fine but I have a little question:
how exaclty can you pass time with a event? I want the time to pass went you go to bed(the player will choose between morning or night) and when you heal your pokemon in a Pokecenter(pass 6h).

Thanks in advance and sorry for my bad english.
When the player sleeps you wish to the time in game advance
# 8 hours, so put in NTN_EXTRASECONDS a game variable number and sum
# 28800 (60*60*8) in this variable every time that the players sleeps.
NTN_EXTRASECONDS=-1
NTN_EXTRADAYS=-1
So, if you make NTN_EXTRASECONDS=87 and sum 21600 into variable 87, the time will pass six hours.
86400 at your case. I tested and this is working with berries, but you must refresh the map (manually call the refresh method IF the berries and sleep event are in the same map).
 
139
Posts
11
Years
86400 at your case. I tested and this is working with berries, but you must refresh the map (manually call the refresh method IF the berries and sleep event are in the same map).

So I thought I got it but it turns out that I don't.

I don't know how to "Sleep." I found out that the 23rd switch changed to 's:cooledDown?(86400)' but it doesn't seem to do anything so I'm clearly not using it right. And the map I want to go forward in time on is separate from the map with the berries.
I just need to know how to "sleep,"
 
178
Posts
10
Years
I found out that the 23rd switch changed to 's:cooledDown?(86400)' "

It shouldn't be doing that. It could be something else that you added to the event.

To make hours pass (Sleep in your case) just use
Code:
@>Control Variables: [XX: Add sleep time] += 86400

XX = NTN_EXTRASECONDS variable you set in the script (it is -1 by default)

The 86400 is the in-game seconds sleep time. (if I'm not mistaken)

To test if this is working make another event right beside the sleep one with

Code:
@Script: $game_variables[99] = pbGetTimeNow
@Text: \v[99]


Change the 99 if you are using it for something else
 
Last edited:
139
Posts
11
Years
It shouldn't be doing that. It could be something else that you added to the event.

To make hours pass (Sleep in your case) just use
Code:
@>Control Variables: [XX: Add sleep time] += 86400

XX = NTN_EXTRASECONDS variable you set in the script (it is -1 by default)

The 86400 is the in-game seconds sleep time. (if I'm not mistaken)

To test if this is working make another event right beside the sleep one with

Code:
@Script: $game_variables[99] = pbGetTimeNow
@Text: \v[99]


Change the 99 if you are using it for something else
...Oh. I was trying so much crap that I thought was supposed to be the solution when the answer was "just use variables."
I was confused and now I feel dumb. Thank you so, so much!

Edit: Sooo this is annoying and shouldn't be a problem. Even if I already have the time go forward, if I also have
Code:
$PokemonGlobal.newFrameCount=25748
be turned on before I enter the map with the berries, no matter how much they've grown, it resets them to their "just planted" state. (This includes Parallel events on the same map as the berries) I know that the variable is working, but as soon as I set the clock to a certain time the variables that were already added just... Stops working?

The same thing happens if I set the clock to a certain time before having the game go forward 24 hours.
And I tried this while having them in both the same and separate events.
 
Last edited:
178
Posts
10
Years
Sooo this is annoying and shouldn't be a problem. Even if I already have the time go forward, if I also have
Code:
$PokemonGlobal.newFrameCount=25748
be turned on before I enter the map with the berries, no matter how much they've grown, it resets them to their "just planted" state. (This includes Parallel events on the same map as the berries) I know that the variable is working, but as soon as I set the clock to a certain time the variables that were already added just... Stops working?

The same thing happens if I set the clock to a certain time before having the game go forward 24 hours.
And I tried this while having them in both the same and separate events.

I have zero experience in editing scripts, but did you tried using the default values? If this didn't work, you are better off making a topic in the pokémon essentials section of the forum. I sadly can't really help you more with it. But I hope everything works fine in your game!
 

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
Edit: Sooo this is annoying and shouldn't be a problem. Even if I already have the time go forward, if I also have
Code:
$PokemonGlobal.newFrameCount=25748
be turned on before I enter the map with the berries, no matter how much they've grown, it resets them to their "just planted" state. (This includes Parallel events on the same map as the berries) I know that the variable is working, but as soon as I set the clock to a certain time the variables that were already added just... Stops working?

The same thing happens if I set the clock to a certain time before having the game go forward 24 hours.
And I tried this while having them in both the same and separate events.
This code resets time into 12:10 (25748 frames means almost 11 minutes) and maybe mess into other things. Don't use newFrameCount. Use the variables.

If you want to test this script with berries, change 'NTS_TIMEPROPORTION=60' into 'NTS_TIMEPROPORTION=3600' (1 second = 1 hour) and enter/exit a berry map (connections won't refresh map) after a day starts.

OR

Change 'NTN_EXTRADAYS=-1' into 'NTN_EXTRADAYS = 98' and add 1 on variable 98 and enter/exit a berry map.


Connections won't refresh map, so enter/exit a house or call the debug for refreshing a berry map.
 
Last edited:
2
Posts
7
Years
  • Age 34
  • Seen May 23, 2019
Is there a way to force a time update, or increase the frequency of the screen color updating? From testing it seems that the time and screen color only updates when the minute changes.

Amazing script, by the way. Thank you!
 
Last edited:

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
Is there a way to force a time update, or increase the frequency of the screen color updating? From testing it seems that the time and screen color only updates when the minute changes.
In PField_Time, change the '30' on line 'Graphics.frame_count-@dayNightToneLastUpdate>=Graphics.frame_rate*30' to a lower number, like '3', for a quicker tone check/updates.
 
162
Posts
7
Years
  • Age 35
  • Seen today
This is a very good script, because it not only allows you to manipulate time, but also allows those players who can only play at night, can live a complete experience ...

My question is ... Is there any possibility that the player decides at the beginning of the game if he wants to live his experience in real time or with unreal time? For example, activating and deactivating the script with a switch at the very beginning...?

Thanks for your work!
 

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
My question is ... Is there any possibility that the player decides at the beginning of the game if he wants to live his experience in real time or with unreal time? For example, activating and deactivating the script with a switch at the very beginning...?

Thanks for your work!

Code:
# Set false to disable this system (returns Time.now)
NTN_ENABLED=true

Try to create a Game Switch to turn false or true 'NTN_ENABLED'.
 
162
Posts
7
Years
  • Age 35
  • Seen today
Code:
# Set false to disable this system (returns Time.now)
NTN_ENABLED=true

Try to create a Game Switch to turn false or true 'NTN_ENABLED'.

I tried calling it that as it is, including pb, $ ... Hahaha ... But I didn't get it ...

By the way...

The script, in my case, allows the switches "It's day" or "It's night" to work ... But not "It's morning, it's evening ... etc"
 
Last edited:

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
My question is ... Is there any possibility that the player decides at the beginning of the game if he wants to live his experience in real time or with unreal time? For example, activating and deactivating the script with a switch at the very beginning...?
Try changing the line 'return Time.now if !NTN_ENABLED' into 'return Time.now if !NTN_ENABLED || !$game_switches[99]'. With this code, the script only works if switch 99 was ON.
 
162
Posts
7
Years
  • Age 35
  • Seen today
Try changing the line 'return Time.now if !NTN_ENABLED' into 'return Time.now if !NTN_ENABLED || !$game_switches[99]'. With this code, the script only works if switch 99 was ON.

Really now if I feel it is complete and works perfect! Thank you very much for your work!
 
350
Posts
5
Years
Been 7 years,this script was still useful to me!
It's compatible with all Essentials Versions too!
Thanks FL for this amazing script
 
350
Posts
5
Years
I have a question..
I want the player to wake up at a forced specific time
Example- After the intro,the Player must get transported to The town in the morning.(About 7AM not any other time)
 
Last edited:

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
I have a question..
I want the player to wake up at a forced specific time
Example- After the intro,the Player must get transported to The town in the morning.(About 7AM not any other time)
Code:
yourChosenHour = 7
currentTotalSeconds = pbGetTimeNow.sec + pbGetTimeNow.min*60 + pbGetTimeNow.hour*60*60
# If is more than yourTime, sleeps for the next day, so won't travel back in time
targetSeconds = (pbGetTimeNow.hour>=yourChosenHour ? (7+24) : yourChosenHour)*60*60 
$game_variables[142] += targetSeconds - currentTotalSeconds
142 is the NTN_EXTRASECONDS variable
 
Last edited:
20
Posts
5
Years
  • Age 31
  • Seen Jun 30, 2023
  1. In the last example, remove the line 'timeDifference += secInDay'. Maybe you have trouble calling it as event command, so copy into a script section the code:

    Code:
    def setNewTime(hour,min=0,sec=0) # Hour is 0..23
      timeNow = pbGetTimeNow
      secInDay = 60*60*24
      secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
      secWished = hour*60*60+min*60+sec
      secondsAdded = secWished-secNow
      secondsAdded +=secInDay if secondsAdded<0
      $game_variables[NTN_EXTRASECONDS]+=secondsAdded
    end

    And call this line at a script command: 'setNewTime(18,0,0)'.
  2. Put a switch number in NTN_SWITCHSTOPS field and turn on this switch while the event is happening.

I've used this script in more then one of my projects and it always works, but recently I've gotten an error I can't figure out?

I added this script to the very end of the rest of the script, changed NTN_SWITCHSTOPS from -1 to 60, the variable i'm using, and at first it worked perfectly. I haven't touched this script since I got it working, but now it's causing an error.

Spoiler:


Can someone help me figure out what happened?
 

FL

Pokémon Island Creator
2,448
Posts
13
Years
  • Seen yesterday
I've used this script in more then one of my projects and it always works, but recently I've gotten an error I can't figure out?

I added this script to the very end of the rest of the script, changed NTN_SWITCHSTOPS from -1 to 60, the variable i'm using, and at first it worked perfectly. I haven't touched this script since I got it working, but now it's causing an error.

Spoiler:


Can someone help me figure out what happened?
Did you put a variable number in NTN_EXTRASECONDS?
 
20
Posts
5
Years
  • Age 31
  • Seen Jun 30, 2023
I have now, thank you so much! I don't know what happened but that was set to -1 again, I must have changed it by accident.
 
Back
Top