PDA

View Full Version : [Essentials Script] Unreal time system (like Haverst Moon)


FL
August 3rd, 2012, 4:30 AM
#===============================================================================
# * Unreal time system - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. It makes the time in game have its
# own clock that only pass when you are in game instead of using real time
# (like Harvest Moon and Zelda: Ocarina of Time).
#
#===============================================================================
#
# To this script works, put it above main. If you wish to some parts still use
# real time like the Trainer Card start time and Pokémon Trainer Memo,
# just change 'pbGetTimeNow' to 'Time.now' in their scripts (in this example,
# PokemonMap and PokeBattle_Pokemon scripts sections).
#
# This script use the Ruby Time class that can only hold years around
# 1970-2038 range. If you wish to have other years values, sum/subtract when
# displaying the year. Examples:
# If you wants year 1000, start in 1970 and, when displaying year name use
# 'pbGetTimeNow.year-970'.
# If you wants year 5000, start in 1970 and, when displaying year name use
# 'pbGetTimeNow.year+3030'.
#
# Some time methods:
# 'pbGetTimeNow.year', 'pbGetTimeNow.mon' (the numbers from 1-12),
# 'pbGetTimeNow.day','pbGetTimeNow.hour', 'pbGetTimeNow.min',
# 'pbGetTimeNow.sec', 'pbGetAbbrevMonthName(pbGetTimeNow.mon)',
# 'pbGetTimeNow.strftime("%A")' (displays weekday name),
# 'pbGetTimeNow.strftime("%I:%M %p")' (displays Hours:Minutes pm/am)
#
#===============================================================================

# Set false to disable this system (returns Time.now)
NTN_ENABLED=true

# Make this true to time only pass at field (Scene_Map)
# A note to scripters: To make time pass on other scenes, put line
# '$PokemonGlobal.addNewFrameCount' near to line 'Graphics.update'
NTN_TIMESTOPS=true

# Make this true to time pass in battle, during turns and command selection.
# This won't affect the Pokémon and Bag submenus.
# Only works if NTN_TIMESTOPS=true.
NTN_BATTLEPASS=true

# Make this true to time pass when the Dialog box or the main menu are open.
# This won't affect the submenus like Pokémon and Bag.
# Only works if NTN_TIMESTOPS=true.
NTN_TALKPASS=true

# 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

# Choose switch number that when true the time won't pass (or -1 to cancel).
# Only works if NTN_TIMESTOPS=true.
NTN_SWITCHSTOPS=-1

# Choose variable(s) number(s) that can hold time passage (or -1 to cancel).
# The time in this variable isn't affected by NTS_TIMEPROPORTION.
# Example: When the player sleeps you wish to the time in game advance
# 8 hours, so put in NTN_EXTRASECONDS a game variable number and sum
# 28800 (60*60*8) in this variable every time that the players sleeps.
NTN_EXTRASECONDS=-1
NTN_EXTRADAYS=-1

# Initial values
NTN_INITIALYEAR=2000 # Can ONLY holds around range 1970-2038
NTN_INITIALMONTH=1
NTN_INITIALDAY=1
NTN_INITIALHOUR=12
NTN_INITIALMINUTE=0

def pbGetTimeNow
return Time.now if !NTN_ENABLED

if(NTN_TIMESTOPS)
# Sum the extra values to newFrameCount
if(NTN_EXTRASECONDS>0)
$PokemonGlobal.newFrameCount+=(
pbGet(NTN_EXTRASECONDS)*Graphics.frame_rate)/NTS_TIMEPROPORTION
$game_variables[NTN_EXTRASECONDS]=0
end
if(NTN_EXTRADAYS>0)
$PokemonGlobal.newFrameCount+=((60*60*24)*
pbGet(NTN_EXTRADAYS)*Graphics.frame_rate)/NTS_TIMEPROPORTION
$game_variables[NTN_EXTRADAYS]=0
end
elsif(NTN_EXTRASECONDS>0 && NTN_EXTRADAYS>0)
# Checks to regulate the max/min values at NTN_EXTRASECONDS
while (pbGet(NTN_EXTRASECONDS)>=(60*60*24))
$game_variables[NTN_EXTRASECONDS]-=(60*60*24)
$game_variables[NTN_EXTRADAYS]+=1
end
while (pbGet(NTN_EXTRASECONDS)<=-(60*60*24))
$game_variables[NTN_EXTRASECONDS]+=(60*60*24)
$game_variables[NTN_EXTRADAYS]-=1
end
end
start_time=Time.local(NTN_INITIALYEAR,NTN_INITIALMONTH,NTN_INITIALDAY,
NTN_INITIALHOUR,NTN_INITIALMINUTE)
time_played=(NTN_TIMESTOPS && $PokemonGlobal) ?
$PokemonGlobal.newFrameCount : Graphics.frame_count
time_played=(time_played*NTS_TIMEPROPORTION)/Graphics.frame_rate
time_jumped=0
time_jumped+=pbGet(NTN_EXTRASECONDS) if NTN_EXTRASECONDS>-1
time_jumped+=pbGet(NTN_EXTRADAYS)*(60*60*24) if NTN_EXTRADAYS>-1
time_ret = nil
# To prevent crashes due to year limit, every time that you reach in year
# 2036 the system will subtract 6 years (to works with leap year) from
# your date and sum in $PokemonGlobal.extraYears. You can sum your actual
# year with this extraYears when displaying years.
loop do
extraYears=($PokemonGlobal) ? $PokemonGlobal.extraYears : 0
time_fix=extraYears*60*60*24*(365*6+1)/6
time_ret=start_time+(time_played+time_jumped-time_fix)
break if time_ret.year<2036
$PokemonGlobal.extraYears+=6
end
return time_ret
end

if NTN_ENABLED
class PokemonGlobalMetadata
attr_accessor :newFrameCount
attr_accessor :extraYears

def addNewFrameCount
self.newFrameCount+=1 if !(
NTN_SWITCHSTOPS>0 && $game_switches[NTN_SWITCHSTOPS])
end

def newFrameCount
@newFrameCount=0 if [email protected]
return @newFrameCount
end

def extraYears
@extraYears=0 if [email protected]
return @extraYears
end
end

if NTN_TIMESTOPS
class Scene_Map
alias :updateold :update

def update
$PokemonGlobal.addNewFrameCount
updateold
end

if NTN_TALKPASS
alias :miniupdateold :miniupdate

def miniupdate
$PokemonGlobal.addNewFrameCount
miniupdateold
end
end
end

if NTN_BATTLEPASS
class PokeBattle_Scene
alias :pbGraphicsUpdateold :pbGraphicsUpdate

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

Qwertyis666
December 22nd, 2014, 9:28 AM
Hi, I just found this awesome script and he work fine but I have a little question:
how exaclty can you pass time with a event? I want the time to pass went you go to bed(the player will choose between morning or night) and when you heal your pokemon in a Pokecenter(pass 6h).

Thanks in advance and sorry for my bad english.

FL
December 23rd, 2014, 5:18 AM
Hi, I just found this awesome script and he work fine but I have a little question:
how exaclty can you pass time with a event? I want the time to pass went you go to bed(the player will choose between morning or night) and when you heal your pokemon in a Pokecenter(pass 6h).

Thanks in advance and sorry for my bad english.When the player sleeps you wish to the time in game advance
# 8 hours, so put in NTN_EXTRASECONDS a game variable number and sum
# 28800 (60*60*8) in this variable every time that the players sleeps.
NTN_EXTRASECONDS=-1
NTN_EXTRADAYS=-1So, if you make NTN_EXTRASECONDS=87 and sum 21600 into variable 87, the time will pass six hours.

Qwertyis666
December 23rd, 2014, 10:01 AM
So, if you make NTN_EXTRASECONDS=87 and sum 21600 into variable 87, the time will pass six hours.


Ok, thanks (I guess I did not notice that comment part).
I just don't understand what is ''sum''? example in 28800, 60*60*8 is the sum?

And what if I want the player to choose to skip to the morning or the night?
Do the script will be difficult to call?

Thanks in advance and sorry for my bad english.

FL
December 26th, 2014, 4:01 AM
Just add 21600 (6 hours in seconds) to variable 87, you can even use event scripts.

For forcing to the player pass the time until it reach into a certain time, there serveral ways, three examples (the first is the worst) that make the player going into 6:00:00 PM (both are doable with events, but I use scripts for better performance).

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
timeNow.min != min &&
timeNow.sec != sec)
$game_variables[87]+=1
timeNow = pbGetTimeNow
end

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
timeDifference = Time.new(
timeNow.year, timeNow.mon, timeNow.day,
hour, min, sec)
timeDifference += secInDay # Add a day
secondsAdded = (timeDifference-timeNow)%secInDay
$game_variables[87]+=secondsAdded

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
timeDifference += secInDay # Add a day
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[87]+=secondsAdded

All untested.

Qwertyis666
December 26th, 2014, 9:18 AM
Just add 21600 (6 hours in seconds) to variable 87, you can even use event scripts.

For forcing to the player pass the time until it reach into a certain time, there serveral ways, three examples (the first is the worst) that make the player going into 6:00:00 PM (both are doable with events, but I use scripts for better performance).

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
timeNow.min != min &&
timeNow.sec != sec)
$game_variables[87]+=1
timeNow = pbGetTimeNow
endhour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
timeDifference = Time.new(
timeNow.year, timeNow.mon, timeNow.day,
hour, min, sec)
timeDifference += secInDay # Add a day
secondsAdded = (timeDifference-timeNow)%secInDay
$game_variables[87]+=secondsAddedhour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
timeDifference += secInDay # Add a day
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[87]+=secondsAddedAll untested.


Thanks! I used to make work the time pass in a Pokecenter meanwhile, basicly when you heal your Pokemon in a Pokecenter, one hour pass per Pokemon in your team (If you have 2 poke, 2 hours pass, etc) Anyways these script will help me alot since I try so many things to skip to a specific time and none of them work.

Thanks again FL and sorry for my bad english

mcscottyg
June 17th, 2015, 10:44 AM
When you say paste this script above main, do you mean make a new script above main, or paste this within the main script?

----
June 17th, 2015, 11:30 AM
When you say paste this script above main, do you mean make a new script above main, or paste this within the main script?

Above. Never ever ever ever paste anything in to Main.

mcscottyg
June 17th, 2015, 12:45 PM
Thanks :) got it working well now

FL
June 24th, 2015, 2:19 PM
When you say paste this script above main, do you mean make a new script above main, or paste this within the main script?Make a new script above main, but both actually work.

AndromedaKerova
November 9th, 2015, 9:24 AM
I went into the printable version, copied the code and added it to my game as instructed but for some reason it seems to DISABLE the day/night system instead of speeding it up. The tones of the game no longer change no matter how long I leave it running for.

FL
November 14th, 2015, 3:05 PM
I went into the printable version, copied the code and added it to my game as instructed but for some reason it seems to DISABLE the day/night system instead of speeding it up. The tones of the game no longer change no matter how long I leave it running for.In NTS_TIMEPROPORTION put 2000 and waits a minute.

TamerX34
December 12th, 2015, 12:25 AM
Is it possible to create a Persona 3/4 time system from this script?

Telemetius
December 12th, 2015, 1:05 AM
Is it possible to create a Persona 3/4 time system from this script?

Not the original poster but the persona 3/4 time system is pretty much not related to actual time (as in hours, minutes and seconds) but rather to a calendar that splits each day into Morning, Evening and Night (also Dark Hour if you consider it). Point is, every "piece" of the day has virtually unlimited actual time until the protagonist does something.

TamerX34
December 12th, 2015, 7:32 AM
Not the original poster but the persona 3/4 time system is pretty much not related to actual time (as in hours, minutes and seconds) but rather to a calendar that splits each day into Morning, Evening and Night (also Dark Hour if you consider it). Point is, every "piece" of the day has virtually unlimited actual time until the protagonist does something.

Would you know of a script that does this?

Telemetius
December 12th, 2015, 8:29 AM
Would you know of a script that does this?

There's this (http://p3pc.tumblr.com/) project going on but the author is using VX ace.

Cilerba
December 14th, 2015, 12:03 AM
Would I be able to get an example on how pbGetTimeNow.strftime("%I:%M %p") would be used?

FL
December 19th, 2015, 9:33 AM
Would I be able to get an example on how pbGetTimeNow.strftime("%I:%M %p") would be used?Call script:

t=pbGetTimeNow.strftime("%I:%M %p")
Kernel.pbMessage(_INTL("{1} is the time.",t))

OR, you can store in a variable, like 87 and call using '\v[87]' (without quotes) at message system after the script call:

t=pbGetTimeNow.strftime("%I:%M %p")
$game_variables[87]=t

Phigo
February 6th, 2016, 8:26 AM
Is it possible to show the time on the loading screen?
I tried it with "pbGetTimeNow.strftime" but got an error in line 81 in the "Unreal Time Script". I guess this only works in-game, since the same line is used in the Pokégearscript to show the time on the Pokégear.
Is there another way to show the time on the loading screen?

FL
February 6th, 2016, 2:52 PM
Is it possible to show the time on the loading screen?
I tried it with "pbGetTimeNow.strftime" but got an error in line 81 in the "Unreal Time Script". I guess this only works in-game, since the same line is used in the Pokégearscript to show the time on the Pokégear.
Is there another way to show the time on the loading screen?pbGetTimeNow uses both $PokemonGlobal and $game_variables that aren't loaded yet. You need to change the 'def pbGetTimeNow' into

def pbGetTimeNow(pokemonGlobal=nil,game_variables=nil)
pokemonGlobal||=$PokemonGlobal
game_variables||=$game_variablesAnd change every other $PokemonGlobal on this method to pokemonGlobal and game_variables to $game_variables.

After that, you need to call, in the title screen (or PokemonLoadPanel) call this method with the two previous loaded arguments. For this, in 'def pbTryLoadFile' load these two variables (keep note on Marshal data order that can be seen in def pbStartLoadScreen) and by two more methods, PokemonLoadScene.pbStartScene and PokemonLoadPanel constructor. Assign into a global variable in this last one and call it into the draw method.

Lucidious89
April 21st, 2016, 11:17 AM
Is there way to utilize this script to jump ahead by entire months at a time? I'm thinking about utilizing this for my birthsigns script. I tried a few things working off what you've already posted, but I kept on getting errors.

FL
April 23rd, 2016, 7:08 AM
Is there way to utilize this script to jump ahead by entire months at a time? I'm thinking about utilizing this for my birthsigns script. I tried a few things working off what you've already posted, but I kept on getting errors.If you put some variable in NTN_EXTRADAYS, like 97, just sum the day amount into this variable. Example: If you wish more two months, just sum 120 into variable 97.

Lucidious89
April 29th, 2016, 3:35 PM
If you put some variable in NTN_EXTRADAYS, like 97, just sum the day amount into this variable. Example: If you wish more two months, just sum 120 into variable 97.
Thanks, ive got it working exactly how I want now. But I was wondering if there was a way to reset the current time through a script. Like lets say I go forward a few months, but then decide I want to change the time again to match the real-world time.

Phigo
April 30th, 2016, 1:45 AM
You can just set "NTN_ENABLED=true" to false.

Lucidious89
April 30th, 2016, 3:46 AM
You can just set "NTN_ENABLED=true" to false.
Will that work in a script? Im basically just trying to make a "reset time" button.

FL
May 1st, 2016, 1:26 PM
Will that work in a script? Im basically just trying to make a "reset time" button.If you want to do this, use as a runtime variable instead of a constant value, put a "$" before it and use as lowercase (change every NTN_ENABLED into $ntnEnabled).

To reset the timer. use line '$PokemonGlobal.newFrameCount=0'. Remember, also, to clear variables than hold NTN_EXTRASECONDS and NTN_EXTRADAYS.

HarmonyConcept
June 28th, 2016, 8:46 AM
Thank you for this script. It is working fine, however I have two questions regarding what can be done with it.

1) Is it possible to reach directly a defined hour? I believed you answered a similar question some time ago:



For forcing to the player pass the time until it reach into a certain time, there serveral ways, three examples (the first is the worst) that make the player going into 6:00:00 PM (both are doable with events, but I use scripts for better performance).

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
timeNow.min != min &&
timeNow.sec != sec)
$game_variables[87]+=1
timeNow = pbGetTimeNow
end

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
timeDifference = Time.new(
timeNow.year, timeNow.mon, timeNow.day,
hour, min, sec)
timeDifference += secInDay # Add a day
secondsAdded = (timeDifference-timeNow)%secInDay
$game_variables[87]+=secondsAdded

hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
timeDifference += secInDay # Add a day
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[87]+=secondsAdded

All untested.



However when I try to use one of those methods I get an error:

Interpreter:276:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'
Scene_Map:114:in `update'
QuickSave:26:in `main'
Exception: RuntimeError
Message: Script error within event 22, map 77:
Exception: SyntaxError
Message: (eval): 10:in `pbExecuteScript'compile error
(eval): 8: syntax error
pbGet(77)+=1
^
***Full script:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
timeNow.min != min &&
timeNow.sec != sec)
pbGet(77)+=1
timeNow = pbGetTimeNow
end


2) Is it possible to pause - and unpause - the system in an event so that time doesn't pass - and freezes?

Thanks!

Letrax
June 28th, 2016, 10:51 AM
Hey is it somehow possible to use the time system with the clock displayed on KleinsBwKit?
I dont want the real time to be displayed but the time of the game

FL
June 29th, 2016, 3:39 AM
Thank you for this script. It is working fine, however I have two questions regarding what can be done with it.

1) Is it possible to reach directly a defined hour? I believed you answered a similar question some time ago:





However when I try to use one of those methods I get an error:

Interpreter:276:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'
Scene_Map:114:in `update'
QuickSave:26:in `main'
Exception: RuntimeError
Message: Script error within event 22, map 77:
Exception: SyntaxError
Message: (eval): 10:in `pbExecuteScript'compile error
(eval): 8: syntax error
pbGet(77)+=1
^
***Full script:
hour = 18 # 0..23
min = 0
sec = 0
timeNow = pbGetTimeNow
while (timeNow.hour != hour &&
timeNow.min != min &&
timeNow.sec != sec)
pbGet(77)+=1
timeNow = pbGetTimeNow
end


2) Is it possible to pause - and unpause - the system in an event so that time doesn't pass - and freezes?

Thanks!
In the last example, remove the line 'timeDifference += secInDay'. Maybe you have trouble calling it as event command, so copy into a script section the code:

def setNewTime(hour,min=0,sec=0) # Hour is 0..23
timeNow = pbGetTimeNow
secInDay = 60*60*24
secNow = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
secWished = hour*60*60+min*60+sec
secondsAdded = secWished-secNow
secondsAdded +=secInDay if secondsAdded<0
$game_variables[NTN_EXTRASECONDS]+=secondsAdded
end

And call this line at a script command: 'setNewTime(18,0,0)'.

Put a switch number in NTN_SWITCHSTOPS field and turn on this switch while the event is happening.


Hey is it somehow possible to use the time system with the clock displayed on KleinsBwKit?
I dont want the real time to be displayed but the time of the gameYes, just make sure that this clock uses the time received from pbGetTimeNow method instead of something line Time.now.

rizakh
September 26th, 2016, 9:41 AM
Its awesome and i want to use that, but, i figured when this script is on, essentials not load load scripts that work only in nighttime(or other times). In grass by example, if you set landday and landnight only landday pokemons r show.

FL
October 5th, 2016, 5:59 PM
Its awesome and i want to use that, but, i figured when this script is on, essentials not load load scripts that work only in nighttime(or other times). In grass by example, if you set landday and landnight only landday pokemons r show.This doesn't happen. What version are you using?

rizakh
October 6th, 2016, 7:10 AM
This doesn't happen. What version are you using?

16.2

Horosaki
October 8th, 2016, 4:42 PM
How can i make an event to use the days of the week with this script?

The event should read the day of the week to do what it is intended to...

FL
October 11th, 2016, 5:02 AM
16.2I tested this version and is working.

How can i make an event to use the days of the week with this script?

The event should read the day of the week to do what it is intended to...All checks and time-based events works like default Essentials.

Hargatio
November 30th, 2016, 8:06 AM
Awesome script, it works absolutely fine.

To make it more realistic, I changed the graphics in the outdoor-tileset and made the windows/doors brighter.

To make it work I created an event on every window, with a new page where the default switch 15 "s:PBDayNight.isNight?(pbGetTimeNow)" is on. Additionally the event named "RegularTone"

So if it's night the switch turns on and the window shines bright.

But it only works, when the map refreshes (player changes the map, e.g. goes into a house and outside again).
If it gets dark and he's walking around, the windows stay dark.
And of course the other way round, when daylight comes back the windows are still glowing until the player enters a house and leave it again.

Is there any possibility to let the switch activated autimatically as soon as it gets dark, without going into a house and outside again?

http://fs5.directupload.net/images/161130/temp/zp39cysn.png (http://www.directupload.net/file/d/4555/zp39cysn_png.htm)
The two top pictures are correct, the two lower ones incorrect.

FL
December 4th, 2016, 5:19 AM
Awesome script, it works absolutely fine.

To make it more realistic, I changed the graphics in the outdoor-tileset and made the windows/doors brighter.

To make it work I created an event on every window, with a new page where the default switch 15 "s:PBDayNight.isNight?(pbGetTimeNow)" is on. Additionally the event named "RegularTone"

So if it's night the switch turns on and the window shines bright.

But it only works, when the map refreshes (player changes the map, e.g. goes into a house and outside again).
If it gets dark and he's walking around, the windows stay dark.
And of course the other way round, when daylight comes back the windows are still glowing until the player enters a house and leave it again.

Is there any possibility to let the switch activated autimatically as soon as it gets dark, without going into a house and outside again?

http://fs5.directupload.net/images/161130/temp/zp39cysn.png (http://www.directupload.net/file/d/4555/zp39cysn_png.htm)
The two top pictures are correct, the two lower ones incorrect.After line 'updateold' add:

if [email protected] || @lastHour != pbGetTimeNow.hour
@lastHour = pbGetTimeNow.hour
$game_map.need_refresh = true
end

This ensures one refresh per game hour.

Hargatio
December 4th, 2016, 7:47 AM
After line 'updateold' add:

if [email protected] || @lastHour != pbGetTimeNow.hour
@lastHour = pbGetTimeNow.hour
$game_map.need_refresh = true
endThis ensures one refresh per game hour.

Thanks for your reply, where do I find the line 'updateold'?
I was looking in the script section but couldn't find it.

FL
December 6th, 2016, 7:31 AM
Thanks for your reply, where do I find the line 'updateold'?
I was looking in the script section but couldn't find it.At my script.

~YumYum~
January 9th, 2017, 11:40 AM
Is it possible for the time to pass by even when the game isn't running? oO

Rot8er_ConeX
January 9th, 2017, 10:16 PM
Is it possible for the time to pass by even when the game isn't running? oO

. . .

use Default Essentials.

Letrax
January 10th, 2017, 1:16 AM
But I dont want the real time.
I want time to move faster ingame.

PhantomBima
January 10th, 2017, 6:18 AM
# 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.

Rot8er_ConeX
January 10th, 2017, 2:45 PM
# 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
January 12th, 2017, 5:27 AM
Is it possible for the time to pass by even when the game isn't running? oOYou don't need my script for doing this. Put the below code above main (untested):

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

Letrax
January 12th, 2017, 10:31 AM
Ty! But when I add it i get a Type Error.

FL
January 21st, 2017, 4:17 PM
Ty! But when I add it i get a Type Error.Change the code into:

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.

WLD42
January 21st, 2017, 5:34 PM
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:
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
January 23rd, 2017, 2:35 PM
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:
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'.

WLD42
January 24th, 2017, 7:50 AM
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
January 28th, 2017, 5:54 AM
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
February 16th, 2017, 4:49 PM
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?

FL
February 24th, 2017, 4:00 PM
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
February 25th, 2017, 8:11 PM
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.

Soccersam
October 19th, 2017, 1:08 AM
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...

HarmonyConcept
October 19th, 2017, 7:59 AM
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
October 19th, 2017, 10:46 PM
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!