• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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)

I don't know if you're the one to ask, or if this is a thing I could do without your script, but since I am using your script I'm going to try to ask here first.

Would it be possible to make switches based on a certain time of day? Like how there's "s:PBDayNight.isDay?" but specifically for a certain hour of the day? Like if I wanted to have an event happen specifically at 2 PM, for example?
And if so, do you happen to have the numbers for every hour at 12 AM for 24 hours handy? (Like 12 AM, 1 AM, etc.) It's not a big deal if not. I can figure that out on my own.
Yes! Just change the switch name. Example (for 2 PM):
Code:
s:pbGetTimeNow.hour==14
Number range is 0-23. This works even without my script.
 
Yes! Just change the switch name. Example (for 2 PM):
Code:
s:pbGetTimeNow.hour==14
Number range is 0-23. This works even without my script.

I uh... I just saw where the default Essentials time script is. Wow. Thanks for answering anyway!
 
I ran into a bug, but it was easy to fix:

I was using "UnrealTime.advance_to(H,M,S)" to create an event that would let you sleet to morning, noon, evening, midnight (similar to how Legends Arceus time works). However, if I set the arguments to (12,0,0) for noon, it wasn't getting jumped to the right time. (seemed to always be less added seconds that it should be.)

I did some digging, and I found the issue. Within "self.advance_to", you had the line "$PokemonGlobal.newFrameCount+=seconds_added". I compared this to your "self.add_seconds" method and saw a stark difference: "$PokemonGlobal.newFrameCount+=(seconds*Graphics.frame_rate)/PROPORTION.to_f"

So, instead, I replaced your line "$PokemonGlobal.newFrameCount+=seconds_added" with "self.add_seconds(seconds_added)" since it would be doing the same thing, and bingo! Everything works now!

Something to consider for your next update.
 
I ran into a bug, but it was easy to fix:

I was using "UnrealTime.advance_to(H,M,S)" to create an event that would let you sleet to morning, noon, evening, midnight (similar to how Legends Arceus time works). However, if I set the arguments to (12,0,0) for noon, it wasn't getting jumped to the right time. (seemed to always be less added seconds that it should be.)

I did some digging, and I found the issue. Within "self.advance_to", you had the line "$PokemonGlobal.newFrameCount+=seconds_added". I compared this to your "self.add_seconds" method and saw a stark difference: "$PokemonGlobal.newFrameCount+=(seconds*Graphics.frame_rate)/PROPORTION.to_f"

So, instead, I replaced your line "$PokemonGlobal.newFrameCount+=seconds_added" with "self.add_seconds(seconds_added)" since it would be doing the same thing, and bingo! Everything works now!

Something to consider for your next update.
Updated. Good catch!
 
Hello, I wanted to make a mechanic that when Dialga uses Roar of Time you can time travel. I want to keep the rate at which time passes the same as real time(hours/minutes), but I wanted something that would allow the player to change the date and time once the player obtains Dialga and uses Roar of Time. This way the player can change the date to go to a certain season or go from day to night to find certain Pokemon/events. Feels like this is sort of a new UI/feature, but I was wondering if anyone can help with this? I've asked before and I've been referred to this thread though unreal time engine isn't exactly what I'm trying to do, but it's close. This would rather be something that when the player uses the move a menu appears to go to a certain day and time.
 
Last edited:
Hello, I wanted to make a mechanic that when Dialga uses Roar of Time you can time travel. I want to keep the rate at which time passes the same as real time(hours/minutes), but I wanted something that would allow the player to change the date and time once the player obtains Dialga and uses Roar of Time. This way the player can change the date to go to a certain season or go from day to night to find certain Pokemon/events. Feels like this is sort of a new UI/feature, but I was wondering if anyone can help with this? I've asked before and I've been referred to this thread though unreal time engine isn't exactly what I'm trying to do, but it's close. This would rather be something that when the player uses the move a menu appears to go to a certain day and time.
Done in Set the Time script.
 
Hey there, first of all this works pretty great. Having a better Timewindow for day and night, made a sleeping option that lets you skip to 00:00/06:00/12:00/18:00 o'clock like in Arceus Legends, wonderful.
Since i can't completly understand the whole script i need a little help. How do i easily paste the current hour into a game variable?
I tried it with $gamevariables[99] = pbGetTimeNow.hour or putting it into a temp variable first but it gives me an error. I prob can put it in the script directly but i dont know where.
I wanna make an overworld clock that changes hours reading the game variable
Would be great if someone could help ^^
 
Hey there, first of all this works pretty great. Having a better Timewindow for day and night, made a sleeping option that lets you skip to 00:00/06:00/12:00/18:00 o'clock like in Arceus Legends, wonderful.
I only noticed that Legends: Arceus works like this scripts recently XD

Since i can't completly understand the whole script i need a little help. How do i easily paste the current hour into a game variable?
I tried it with $gamevariables[99] = pbGetTimeNow.hour or putting it into a temp variable first but it gives me an error. I prob can put it in the script directly but i dont know where.
I wanna make an overworld clock that changes hours reading the game variable
Would be great if someone could help ^^
You put '$gamevariables[99]'. The correct is "$game_variables[99]"
 
Do i put it in an Autorun/Parralel Process Event? oder where could put it directly in the scripts ^^"
 
I made a very simple (probably programming wise inefficent) event but hey it works.... Just a little detail but its important for me xD
[PokeCommunity.com] [v13+] Unreal Time System (like Minecraft)

(Don't mind the Dialgas, they are just there for timeshifting xD)
 
A clock? Nice idea!
Do i put it in an Autorun/Parralel Process Event? oder where could put it directly in the scripts ^^"
Yes if you use the hour in the events conditions.

You can use something like
Code:
s:(pbGetTimeNow.hour>=9)
At a switch name, but it will only refresh when you refresh map (enter/exit map, change variables and other things).
 
Hi, I know this is an old thread but hopefully someone can help.
I don't know how to covert the script to a plugin so I put it right above main.
I change the 'Proportion' to 3600 so I can test it. It seems it doesn't change the screen tone at all.

Edit: I'm running 20.1
Edit 2: I added an Event with pbGetTimeNow and the script does work, and it is progressing time at the accelerated rate.
However I still have the issue where the screen tone doesn't change with the Time of Day.
Edit 3: Wow, so it turns out the map I was testing, well I never set it to outdoor in the Metadata. Everything is good to go, also make sure to edit the refresh interval!
I hope this helps anyone else stuck, make sure to edit the metadata!
 
Last edited:
Hey, I hope this thread is still alive, I have an issue. I'm using GSC essentials on 18v and since thsis version changes day an night using tilesets the graphics only update when going in an out of the map, is there a way to fix that? because using this:

if UnrealTime::TIME_STOPS
class Scene_Map
alias :updateold :update
def update
$PokemonGlobal.addNewFrameCount
updateold
if !@lastHour || @lastHour != pbGetTimeNow.hour
@lastHour = pbGetTimeNow.hour
$game_map.need_refresh = true
end
end

didn't work :(
 
Hey, I hope this thread is still alive, I have an issue. I'm using GSC essentials on 18v and since thsis version changes day an night using tilesets the graphics only update when going in an out of the map, is there a way to fix that? because using this:

if UnrealTime::TIME_STOPS
class Scene_Map
alias :updateold :update
def update
$PokemonGlobal.addNewFrameCount
updateold
if !@lastHour || @lastHour != pbGetTimeNow.hour
@lastHour = pbGetTimeNow.hour
$game_map.need_refresh = true
end
end

didn't work :(
I didn't test in GSC kit but I guess that this will work: Before the last line 'updateSpritesets' in Scene_Map, add code

Code:
    if Graphics.frame_count % (40*UnrealTime::TONE_CHECK_INTERVAL).floor == 0
      shouldUpdate = false
      for map in $MapFactory.maps
        next if !map
        tileset_name = map.tileset_name
        map.updateTileset
        shouldUpdate = true if map.tileset_name != tileset_name
      end
      if shouldUpdate
        disposeSpritesets
        createSpritesets
      end
    end
Raise TONE_CHECK_INTERVAL for check/update more often.
 
I didn't test in GSC kit but I guess that this will work: Before the last line 'updateSpritesets' in Scene_Map, add code

Code:
    if Graphics.frame_count % (40*UnrealTime::TONE_CHECK_INTERVAL).floor == 0
      shouldUpdate = false
      for map in $MapFactory.maps
        next if !map
        tileset_name = map.tileset_name
        map.updateTileset
        shouldUpdate = true if map.tileset_name != tileset_name
      end
      if shouldUpdate
        disposeSpritesets
        createSpritesets
      end
    end
Raise TONE_CHECK_INTERVAL for check/update more often.

What a hero. Thank you so much.
 
After the script end add:
Code:
module UnrealTime
  MONTH_DAYS = 31
  MONTHS = 4
  INITIAL_YEAR = 1

  def self.day
    return total_days % MONTH_DAYS + 1
  end

  # Starts on 1
  def self.mon
    return (total_days/MONTH_DAYS) % MONTHS + 1
  end

  def self.year
    return total_days/(MONTH_DAYS*MONTHS) + INITIAL_YEAR
  end

  def self.total_days
    c_date = pbGetTimeNow 
    i_date = initial_date
    return (c_date.yday - i_date.yday) + ((c_date.year - i_date.year)*365.250001).floor
  end
end

Call 'UnrealTime.day', 'UnrealTime.mon' and 'UnrealTime.year' to get these values.

Hi, I realize this is from a while back, and maybe its not even spesifically relating to this, I am fairly new to this stuff so I feel like I am just missing something extremely obvious, but I'm tearing my hair out trying to figure out how to make a readable calendar using the unreal time script + this bit that makes the seasons harvest moon style. I just want to be able to check something on the wall that tells me what day, month and year it is but I can't seem to figure out how to do it
 
Hi, I realize this is from a while back, and maybe its not even spesifically relating to this, I am fairly new to this stuff so I feel like I am just missing something extremely obvious, but I'm tearing my hair out trying to figure out how to make a readable calendar using the unreal time script + this bit that makes the seasons harvest moon style. I just want to be able to check something on the wall that tells me what day, month and year it is but I can't seem to figure out how to do it
For standard script
Code:
pbMessage(pbGetTimeNow.strftime("%d %b %Y"))
or
Code:
pbMessage(pbGetTimeNow.strftime("%d/%m/%Y"))
Source.

For this season part:
Code:
pbMessage('%02d/%02d/%02d' % [UnrealTime.day, UnrealTime.mon, UnrealTime.year])
Change the last "%02d" to "%04d" for displaying a 4-digit year.
 
Back
Top