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

Atlat

Atlat
60
Posts
4
Years
    • Seen yesterday
    Is there a way to check if a second has passed? I'm trying to make it so that a variable decreases every second, and all of my attempts have just led to errors.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Is there a way to check if a second has passed? I'm trying to make it so that a variable decreases every second, and all of my attempts have just led to errors.
    Code:
    # Variable 90 should have pbGetTimeNow.to_i when the time start counting.
    # Variable 91 is the variable that the time is decreased.
    secondsPassed = pbGetTimeNow.to_i - $game_variables[90]
    $game_variables[90] = $game_variables[90] + secondsPassed
    $game_variables[91] = $game_variables[91] - secondsPassed

    I put this script on a script event command (remember to run extendtext.exe or put this script on a def at script editor and call it).
     

    Atlat

    Atlat
    60
    Posts
    4
    Years
    • Seen yesterday
    Does that work all of time time, no matter where you are? Or does that only work on, say, the map that it was called on? Because what I need is the former of the two that is always checking for whenever a second passes.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Does that work all of time time, no matter where you are? Or does that only work on, say, the map that it was called on? Because what I need is the former of the two that is always checking for whenever a second passes.
    Works all of time if you make a Common Event with parallel trigger.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Updated to version 1.1:
    1. Can pass year 2036 (only for Essentials v19 or higher)
    2. Constant TONE_CHECK_INTERVAL
    3. advance_to/reset/add_seconds new methods
    4. Refresh tone when time change
    5. Fix float imprecision on extra time
    6. Major refactor
     
    1
    Posts
    2
    Years
    • Seen Oct 8, 2021
    Hello FL. I have a question related to your Unreal Time System script. Would it be possible to set your script up for a specific map in a way so that it's always nighttime there? There's not a way to do something like that with the default map metadata, so I was curious if something like permanent nighttime would be possible with your script. Thanks in advance if you can help me out.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Hello FL. I have a question related to your Unreal Time System script. Would it be possible to set your script up for a specific map in a way so that it's always nighttime there? There's not a way to do something like that with the default map metadata, so I was curious if something like permanent nighttime would be possible with your script. Thanks in advance if you can help me out.
    Permanent night time did you mean only shading or the other night effects like encounters?

    If is only shading, just make the map as indoor and use the event "Change Screen Tone" when teleported into map. You don't need my script.

    If isn't only shading, on entering at map, call script command `UnrealTime.advance_to(22)`, and the switch SWITCH_STOPS as on. On exiting map, set this switch as off.
     
    107
    Posts
    3
    Years
    • Seen Apr 27, 2023
    I don't know if this is the right place to ask, but is there any way to make the game connect to the internet and set the game time ALWAYS in a specific time zone?
    My question is asked because, I realized that if I plant a berry, and advance the computer's time, it is simply ready.
     
    31
    Posts
    5
    Years
  • I'm loving your script so far!

    However, I'm wondering if there's a way I can make it so that there are only 4 months per year with 31 days per month? The fangame I'm working on is a Pokemon/Harvest Moon type of crossover. Any advice would be appreciated.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    I'm loving your script so far!

    However, I'm wondering if there's a way I can make it so that there are only 4 months per year with 31 days per month? The fangame I'm working on is a Pokemon/Harvest Moon type of crossover. Any advice would be appreciated.
    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.
     
    53
    Posts
    3
    Years
    • Seen Mar 16, 2023
    Quick Question: I want to ask this real quick but is it possible to apply this to a gba game that I want to play on my GBA console? And maybe mod it so that the time works similar to PLA time cycle? Like an hour = a day and speed it up by taking a rest at a Pokecenter or healing spot?
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    I don't know if this is the right place to ask, but is there any way to make the game connect to the internet and set the game time ALWAYS in a specific time zone?
    My question is asked because, I realized that if I plant a berry, and advance the computer's time, it is simply ready.
    Yes! But this is unrelated with this script, except if you use this script as plan B, so the time won't pass if player has no internet. You can also sync the time on startup and use the script to pass the time, so you don't need to sync frequently.

    You need to call a time API and return it with Time object on pbGetTimeNow.

    Quick Question: I want to ask this real quick but is it possible to apply this to a gba game that I want to play on my GBA console? And maybe mod it so that the time works similar to PLA time cycle? Like an hour = a day and speed it up by taking a rest at a Pokecenter or healing spot?
    This script? No. And Unreal time? Yes! I don't know how. I don't know much about rom hacking.
     
    107
    Posts
    3
    Years
    • Seen Apr 27, 2023
    Yes! But this is unrelated with this script, except if you use this script as plan B, so the time won't pass if player has no internet. You can also sync the time on startup and use the script to pass the time, so you don't need to sync frequently.

    You need to call a time API and return it with Time object on pbGetTimeNow.

    Can you give me an example script for me to put to check the internet time when starting the game? This part I don't understand, but about booting with your script, I learned easily.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Can you give me an example script for me to put to check the internet time when starting the game? This part I don't understand, but about booting with your script, I learned easily.
    I have no example about this one because it is a bit tricky. You need to combine a webcall, to receive something from time API and parse the input (time value) from a JSON.
     
    1
    Posts
    1
    Years
    • Seen May 27, 2022
    Hi there!! Looks like this script is no longer working on the new version of essentials (v20) D:
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Hi there!! Looks like this script is no longer working on the new version of essentials (v20) D:
    Thanks for the report!

    I will wait a little to update my scripts to v20 (maybe a v20.1). I probably will update on June or July.
     
    1
    Posts
    1
    Years
    • Seen May 27, 2022
    Just change line 271 from
    class PokeBattle_Scene
    to
    class Battle::Scene
    and it should work on v20!!

    Edit: Oh no... emojis.. I don't know how to make that go away. It's replacing a colon and an `S`.

    class Battle : : Scene (without spaces, except after the word `class`)
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Just change line 271 from

    to

    and it should work on v20!!

    Edit: Oh no... emojis.. I don't know how to make that go away. It's replacing a colon and an `S`.

    class Battle : : Scene (without spaces, except after the word `class`)
    Thanks! Since it's just this, script was updated!
     
    139
    Posts
    11
    Years
  • 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.
     
    Back
    Top