• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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)

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
gif.gif

This script makes the time in game uses its own clock that only pass when you are in game instead of using real time (like Minecraft and Zelda: Ocarina of Time).

Link


Tested on Essentials v13, v17.2, v18.1, v19.1, v20, v20.1 and v21.1. If this script isn't working on latest Essentials version, please inform on this thread.
 
Last edited:

Qwertyis666

Dragon Trainer Since 1996
60
Posts
10
Years
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.
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
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.
 

Qwertyis666

Dragon Trainer Since 1996
60
Posts
10
Years
So, if you make NTN_EXTRASECONDS=87 and sum 21600 into variable 87, the time will pass six hours.


Ok, thanks (I guess I did not notice that comment part).
I just don't understand what is ''sum''? example in 28800, 60*60*8 is the sum?

And what if I want the player to choose to skip to the morning or the night?
Do the script will be difficult to call?

Thanks in advance and sorry for my bad english.
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
Just add 21600 (6 hours in seconds) to variable 87, you can even use event scripts.

For forcing to the player pass the time until it reach into a certain time, there serveral ways, three examples (the first is the worst) that make the player going into 6:00:00 PM (both are doable with events, but I use scripts for better performance).

Code:
hour = 18 # 0..23
min = 0
sec = 0 
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
    timeNow.min != min && 
    timeNow.sec != sec)
  $game_variables[87]+=1
  timeNow = pbGetTimeNow
end

Code:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
timeDifference = Time.new(
  timeNow.year, timeNow.mon, timeNow.day,
  hour, min, sec)
timeDifference += secInDay # Add a day
secondsAdded = (timeDifference-timeNow)%secInDay
$game_variables[87]+=secondsAdded

Code:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
timeDifference += secInDay # Add a day
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[87]+=secondsAdded

All untested.
 

Qwertyis666

Dragon Trainer Since 1996
60
Posts
10
Years
Just add 21600 (6 hours in seconds) to variable 87, you can even use event scripts.

For forcing to the player pass the time until it reach into a certain time, there serveral ways, three examples (the first is the worst) that make the player going into 6:00:00 PM (both are doable with events, but I use scripts for better performance).

Code:
hour = 18 # 0..23
min = 0
sec = 0 
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
    timeNow.min != min && 
    timeNow.sec != sec)
  $game_variables[87]+=1
  timeNow = pbGetTimeNow
end
Code:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
timeDifference = Time.new(
  timeNow.year, timeNow.mon, timeNow.day,
  hour, min, sec)
timeDifference += secInDay # Add a day
secondsAdded = (timeDifference-timeNow)%secInDay
$game_variables[87]+=secondsAdded
Code:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
timeDifference += secInDay # Add a day
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[87]+=secondsAdded
All untested.


Thanks! I used to make work the time pass in a Pokecenter meanwhile, basicly when you heal your Pokemon in a Pokecenter, one hour pass per Pokemon in your team (If you have 2 poke, 2 hours pass, etc) Anyways these script will help me alot since I try so many things to skip to a specific time and none of them work.

Thanks again FL and sorry for my bad english
 
3
Posts
8
Years
  • Age 31
  • Seen Sep 8, 2015
When you say paste this script above main, do you mean make a new script above main, or paste this within the main script?
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
When you say paste this script above main, do you mean make a new script above main, or paste this within the main script?
Make a new script above main, but both actually work.
 
40
Posts
8
Years
  • Age 33
  • Seen Mar 22, 2024
I went into the printable version, copied the code and added it to my game as instructed but for some reason it seems to DISABLE the day/night system instead of speeding it up. The tones of the game no longer change no matter how long I leave it running for.
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
I went into the printable version, copied the code and added it to my game as instructed but for some reason it seems to DISABLE the day/night system instead of speeding it up. The tones of the game no longer change no matter how long I leave it running for.
In NTS_TIMEPROPORTION put 2000 and waits a minute.
 

Telemetius

Tele*
267
Posts
9
Years
Is it possible to create a Persona 3/4 time system from this script?

Not the original poster but the persona 3/4 time system is pretty much not related to actual time (as in hours, minutes and seconds) but rather to a calendar that splits each day into Morning, Evening and Night (also Dark Hour if you consider it). Point is, every "piece" of the day has virtually unlimited actual time until the protagonist does something.
 
3
Posts
15
Years
  • Seen May 19, 2021
Not the original poster but the persona 3/4 time system is pretty much not related to actual time (as in hours, minutes and seconds) but rather to a calendar that splits each day into Morning, Evening and Night (also Dark Hour if you consider it). Point is, every "piece" of the day has virtually unlimited actual time until the protagonist does something.

Would you know of a script that does this?
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
Would I be able to get an example on how pbGetTimeNow.strftime("%I:%M %p") would be used?
Call script:

Code:
t=pbGetTimeNow.strftime("%I:%M %p")
Kernel.pbMessage(_INTL("{1} is the time.",t))

OR, you can store in a variable, like 87 and call using '\v[87]' (without quotes) at message system after the script call:

Code:
t=pbGetTimeNow.strftime("%I:%M %p")
$game_variables[87]=t
 
53
Posts
8
Years
Is it possible to show the time on the loading screen?
I tried it with "pbGetTimeNow.strftime" but got an error in line 81 in the "Unreal Time Script". I guess this only works in-game, since the same line is used in the Pokégearscript to show the time on the Pokégear.
Is there another way to show the time on the loading screen?
 

FL

Pokémon Island Creator
2,434
Posts
13
Years
  • Seen yesterday
Is it possible to show the time on the loading screen?
I tried it with "pbGetTimeNow.strftime" but got an error in line 81 in the "Unreal Time Script". I guess this only works in-game, since the same line is used in the Pokégearscript to show the time on the Pokégear.
Is there another way to show the time on the loading screen?
pbGetTimeNow uses both $PokemonGlobal and $game_variables that aren't loaded yet. You need to change the 'def pbGetTimeNow' into

Code:
def pbGetTimeNow(pokemonGlobal=nil,game_variables=nil)
  pokemonGlobal||=$PokemonGlobal
  game_variables||=$game_variables
And change every other $PokemonGlobal on this method to pokemonGlobal and game_variables to $game_variables.

After that, you need to call, in the title screen (or PokemonLoadPanel) call this method with the two previous loaded arguments. For this, in 'def pbTryLoadFile' load these two variables (keep note on Marshal data order that can be seen in def pbStartLoadScreen) and by two more methods, PokemonLoadScene.pbStartScene and PokemonLoadPanel constructor. Assign into a global variable in this last one and call it into the draw method.
 
Back
Top