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

28
Posts
7
Years
  • # Time proportion here. # So if it is 100, one second in real time will be 100 seconds in game. # If it is 60, one second in real time will be one minute in game. NTS_TIMEPROPORTION=60
    Change the time proportion there if you want the time to be faster.
     
    824
    Posts
    8
    Years
  • # Time proportion here. # So if it is 100, one second in real time will be 100 seconds in game. # If it is 60, one second in real time will be one minute in game. NTS_TIMEPROPORTION=60
    Change the time proportion there if you want the time to be faster.

    That's not all he wants, though. He wants time to be faster in-game, but still pass when the game is off.
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Is it possible for the time to pass by even when the game isn't running? oO
    You don't need my script for doing this. Put the below code above main (untested):

    Code:
    def pbGetTimeNow
      return Time.now if !$PokemonGlobal || !$PokemonGlobal.startTime
      timeProportion = 2
      return (Time.now - $PokemonGlobal.startTime)*timeProportion + $PokemonGlobal.startTime
    end
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Ty! But when I add it i get a Type Error.
    Change the code into:

    Code:
    def pbGetTimeNow
      return Time.now if !$PokemonGlobal || !$PokemonGlobal.startTime
      timeProportion = 2
      actualInterval = Time.now - $PokemonGlobal.startTime
      return Time.at($PokemonGlobal.startTime + actualInterval*timeProportion)
    end

    Now, tested.
     
    7
    Posts
    7
    Years
    • Seen Mar 1, 2017
    Hi there, Unreal Time users,

    I'm struggling to figure out an issue in which the Time Received (and Time Hatched, if applicable) on a Pok?mon's or Egg's summary screen is 4 hours earlier than the actual time it was received or hatched. I successfully added the "Watch in the Pok?gear" feature using the tutorial that's on the Essentials Wiki (also by FL; your scripts are fantastic), so I'm able to compare the time shown in the summary screen to the time shown in the Pok?gear, and confirm that the summary screen is the only one that's incorrect.

    I first realized the issue because I'd set the game's initial time to be 1:18am, and I noticed that Pok?mon and Eggs were showing their Time Received as the previous day. I then made the following changes to PScreen_Summary, on PageOneEgg and on PageTwo:
    Code:
     if pokemon.timeReceived
          month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
          date=pokemon.timeReceived.day
          year=pokemon.timeReceived.year
          time=pokemon.timeReceived.strftime("%I:%M %p") # CHANGED
          memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3} at {4}\n",month,date,year,time) # CHANGED
    It successfully added the hour and minute received to the summary screen, in addition to the date and year that were already there, and I was able to confirm that the difference was 4 hours; for example, a Pok?mon received at 1:30am would show 9:30pm of the previous day on its summary screen. However, I've got no clue why it's happening, or how to fix it.

    I did also check the summary screen with Unreal Time turned off, and the time and date shown then matched the real time, which was also what displayed in the Pok?gear.

    Any thoughts? Thank you!
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Hi there, Unreal Time users,

    I'm struggling to figure out an issue in which the Time Received (and Time Hatched, if applicable) on a Pokémon's or Egg's summary screen is 4 hours earlier than the actual time it was received or hatched. I successfully added the "Watch in the Pokégear" feature using the tutorial that's on the Essentials Wiki (also by FL; your scripts are fantastic), so I'm able to compare the time shown in the summary screen to the time shown in the Pokégear, and confirm that the summary screen is the only one that's incorrect.

    I first realized the issue because I'd set the game's initial time to be 1:18am, and I noticed that Pokémon and Eggs were showing their Time Received as the previous day. I then made the following changes to PScreen_Summary, on PageOneEgg and on PageTwo:
    Code:
     if pokemon.timeReceived
          month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
          date=pokemon.timeReceived.day
          year=pokemon.timeReceived.year
          time=pokemon.timeReceived.strftime("%I:%M %p") # CHANGED
          memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3} at {4}\n",month,date,year,time) # CHANGED
    It successfully added the hour and minute received to the summary screen, in addition to the date and year that were already there, and I was able to confirm that the difference was 4 hours; for example, a Pokémon received at 1:30am would show 9:30pm of the previous day on its summary screen. However, I've got no clue why it's happening, or how to fix it.

    I did also check the summary screen with Unreal Time turned off, and the time and date shown then matched the real time, which was also what displayed in the Pokégear.

    Any thoughts? Thank you!
    The Time Received used global time by Maruno's decision. To use default time, change line '@timeReceived=time.getgm.to_i # Use GMT' into '@timeReceived=pbGetTimeNow'.
     
    7
    Posts
    7
    Years
    • Seen Mar 1, 2017
    Thanks so much, FL! That solved it.

    For whatever reason, Time Hatched was still showing as 4 hours previous, even when Time Received was correct. I went into PScreen_EggHatching, and it already said 'pokemon.timeEggHatched=pbGetTimeNow', so I just added '+14400' (4hrs in seconds) to the end of it, which was a bit of a "blunt instrument" style approach, but it worked! Don't know why that would have been the case, but I solved it, so I'm happy.
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Thanks so much, FL! That solved it.

    For whatever reason, Time Hatched was still showing as 4 hours previous, even when Time Received was correct. I went into PScreen_EggHatching, and it already said 'pokemon.timeEggHatched=pbGetTimeNow', so I just added '+14400' (4hrs in seconds) to the end of it, which was a bit of a "blunt instrument" style approach, but it worked! Don't know why that would have been the case, but I solved it, so I'm happy.
    Forget my last post. Change '.utc' in my script to '.local'. I updated the script.

    Your solution mess the time if the player was in any other different timezone.
     

    Raizu

    The Horizon
    2
    Posts
    7
    Years
  • This script was really awesome the only problem I have now is that I tried to put it in another project and when I go to the pause menu it won't display in the pause menu. Do I have to do something to make the time display in the pause menu?
     
    Last edited:

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    This script was really awesome the only problem I have now is that I tried to put it in another project and when I go to the pause menu it won't display in the pause menu. Do I have to do something to make the time display in the pause menu?
    Just follow the examples about how to get a date string.

    By the way, what you done?
     

    Raizu

    The Horizon
    2
    Posts
    7
    Years
  • ASo do I take this
    pbGetTimeNow.strftime("%I:%M %p")
    and place it below the #= line?
    I don't quite understand scripting but I'm learning with it.

    For the second question I'm working on a game where the player has psychic powers who is destined to become a watcher (another group similar to rangers but have the capabilities to their powers to help people) along with your mentor Zoroark to guide you to your goal. I haven't been working on it for the past 3 years because my computer was broken so I had to get a new one.
     
    Last edited:

    Soccersam

    Hilbert is Badass
    179
    Posts
    7
    Years
    • Seen Feb 26, 2024
    I'm sorry if this question is already answered, but I just can't seem to find it in the other comments-
    I want to make it like when the player heals his pokemon, time will advance by three hours.
    I saw the first few comments, but since it was mainly for when the player sleeps, I didn't try it out...
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    I want to make it like when the player heals his pokemon, time will advance by three hours.
    I saw the first few comments, but since it was mainly for when the player sleeps, I didn't try it out...

    It works exactly the same way as when the player sleeps.

    In the Unreal Time Script, you have to define the variable "NTN_EXTRASECONDS", that affects the current time.

    You can then do this in an event (for example in each nurse event):
    Set Variable {Your NTN_EXTRASECONDS Variable} to +10.800 (there are 10.800 seconds in 3 hours);

    Note: If you freeze the time using the NTN_SWITCHSTOPS switch, you need to be sure that the switch is OFF before attempting to change the time (otherwise it won't work)
     

    Soccersam

    Hilbert is Badass
    179
    Posts
    7
    Years
    • Seen Feb 26, 2024
    It works exactly the same way as when the player sleeps.

    In the Unreal Time Script, you have to define the variable "NTN_EXTRASECONDS", that affects the current time.

    You can then do this in an event (for example in each nurse event):
    Set Variable {Your NTN_EXTRASECONDS Variable} to +10.800 (there are 10.800 seconds in 3 hours);

    Note: If you freeze the time using the NTN_SWITCHSTOPS switch, you need to be sure that the switch is OFF before attempting to change the time (otherwise it won't work)

    Thanks, I'm trying it right now!

    And also, thanks to FL who made this amazing script!
     
    • Like
    Reactions: FL
    5
    Posts
    6
    Years
    • Seen Mar 31, 2019
    At my script.

    Do you mean here?

    Code:
    def pbGraphicsUpdate
              $PokemonGlobal.addNewFrameCount 
              pbGraphicsUpdateold
            end
          end
        end
      end
    end

    If so. It should be like this?


    Code:
    def pbGraphicsUpdate
              $PokemonGlobal.addNewFrameCount 
              pbGraphicsUpdateold
            end
    
        if !@lastHour || @lastHour != pbGetTimeNow.hour
              @lastHour = pbGetTimeNow.hour
              $game_map.need_refresh = true
            end
          end
        end
      end
    end
     
    Last edited by a moderator:

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Do you mean here?

    Code:
    def pbGraphicsUpdate
              $PokemonGlobal.addNewFrameCount 
              pbGraphicsUpdateold
            end
          end
        end
      end
    end

    If so. It should be like this?


    Code:
    def pbGraphicsUpdate
              $PokemonGlobal.addNewFrameCount 
              pbGraphicsUpdateold
            end
    
        if !@lastHour || @lastHour != pbGetTimeNow.hour
              @lastHour = pbGetTimeNow.hour
              $game_map.need_refresh = true
            end
          end
        end
      end
    end
    No. I meant between 'updateold' and 'end' here:
    Code:
          def update
            $PokemonGlobal.addNewFrameCount
            updateold
          end

    So the code should be:
    Code:
          def update
            $PokemonGlobal.addNewFrameCount
            updateold
        	if !@lastHour || @lastHour != pbGetTimeNow.hour
              @lastHour = pbGetTimeNow.hour
              $game_map.need_refresh = true
            end
          end
     
    5
    Posts
    6
    Years
    • Seen Mar 31, 2019
    No. I meant between 'updateold' and 'end' here:
    Code:
          def update
            $PokemonGlobal.addNewFrameCount
            updateold
          end

    So the code should be:
    Code:
          def update
            $PokemonGlobal.addNewFrameCount
            updateold
        	if !@lastHour || @lastHour != pbGetTimeNow.hour
              @lastHour = pbGetTimeNow.hour
              $game_map.need_refresh = true
            end
          end

    Thanks for the answer brother xD But I already managed to find it I was missing something on your explanation before, btw quick question: are you brazilian?
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Thanks for the answer brother xD But I already managed to find it I was missing something on your explanation before, btw quick question: are you brazilian?
    Yep. The main language of my game is the proof.
     
    Back
    Top