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

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).
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
Thanks so much! And sorry for the late thanks, I got really busy.
 
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?
 
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.
 
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.
 
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 (broken link removed), to receive something from time API and parse the input (time value) from a JSON.
 
Hi there!! Looks like this script is no longer working on the new version of essentials (v20) D:
 
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`)
 
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!
 
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