• 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)

FL

Pokémon Island Creator
2,450
Posts
13
Years
    • Seen today
    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.
     
    3
    Posts
    1
    Years
    • Seen Jan 8, 2023
    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.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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!
     
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    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:

    FL

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

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Night encounters won't work, how do I fix that?
    I tested here and it is working. Maybe the night encounters aren't correctly defined at your project. Can you test at the Route 1 example map? In this test, at least the background changes?
     
    5
    Posts
    1
    Years
    • Seen Dec 5, 2022
    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 ^^
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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]"
     
    5
    Posts
    1
    Years
    • Seen Dec 5, 2022
    Do i put it in an Autorun/Parralel Process Event? oder where could put it directly in the scripts ^^"
     
    5
    Posts
    1
    Years
    • Seen Dec 5, 2022
    I made a very simple (probably programming wise inefficent) event but hey it works.... Just a little detail but its important for me xD
    Bild-2022-11-09-212435774.png

    (Don't mind the Dialgas, they are just there for timeshifting xD)
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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).
     
    2
    Posts
    3
    Years
    • Seen Dec 15, 2022
    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:
    4
    Posts
    3
    Years
    • Seen Mar 12, 2024
    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 :(
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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.
     
    4
    Posts
    3
    Years
    • Seen Mar 12, 2024
    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.
     
    2
    Posts
    3
    Years
    • Seen Nov 19, 2023
    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
     

    FL

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