• 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?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

Time-Based Events

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Hello Pokecommunity today I will show you how to do time-based events into your hacks. :D
Here is an example of what I mean: http://www.youtube.com/watch?v=h98OV4W1ZsU
Please ignore the noobishness, still was starting out when this tutorial was made.

First, apply the DNS to your ROM (any ROM type).
34867ab.png

0x0300553C TIME IS WRITTEN HERE
Pay close attention to WHERE the time is REALLY stored.
99f4ew.png

In VBA go to the memory viewer and jump to 0x0300553C and you will
If you are like me, you will most likely want to check only for the hours, which is stored at 0x3005542, NOT 0x0300553C.
My script is based on the mysterious TV that Rotom lived in Platinum Version. Tested and works 100%.

We will be using the comparefarbytetobyte command which is like the compare command, but instead of checking variables, it checks the bytes in the specified RAM location.

Here it goes:
Code:
'---------------
#org 0x75E186
lock
checkflag 0x1001 /Checks if the script occurred before/
if 0x1 goto 0x875E1AA
comparefarbytetobyte 0x3005542 0x4 /Checks the hour if it is 4:00 AM/
if 0x0 goto 0x875E166 /If it is less than 4:00AM (3:59, etc.) go to the "now" message/
goto 0x875DFC7 /jumps to part 2/

'---------------
#org 0x75E1AA
msgbox 0x875E1B6 MSG_NORMAL '"The TV still has an odd feel to\ni..."
end

'---------------
#org 0x75E166
msgbox 0x875E0E9 MSG_YESNO '"Inside the TV...\nThere appears to..."
compare LASTRESULT 0x1
if 0x1 goto 0x875E06C
closeonkeypress
end

'---------------
#org 0x75DFC7
comparefarbytetobyte 0x3005542 0x14 /Checks the hour again (14 in HEX is 20:00 or 8:00PM)
if 0x4 goto 0x875E166 /If greater than or equal to 8:00PM go to the "now" message
goto 0x875E02A /Jumps to the "not time yet" message

'---------------
#org 0x75E06C
msgbox 0x875E08B MSG_NORMAL '"[player] thumped the TV set!"
setflag 0x1001
setvar 0x6000 0x12A
setvar 0x6002 0x148
wildbattle 0x97 0x14 0x0
release
end

'---------------
#org 0x75E02A
msgbox 0x875E0A4 MSG_NORMAL '"The TV has an oddly malevolent\nfe..."
end


'---------
' Strings
'---------
#org 0x75E1B6
= The TV still has an odd feel to\nit...

#org 0x75E0E9
= Inside the TV...\nThere appears to be a Pokémon?...\pThe Pokémon appears as if it will\ncome out. Want to thump the TV?

#org 0x75E08B
= [player] thumped the TV set!

#org 0x75E0A4
= The TV has an oddly malevolent\nfeel...\pIt's as if it is staring...



This is simple enough, and you CAN check for minutes and seconds and days and months and years and all that.
For the comparefarbytetobyte command, refer to this list:
0x0 means less than
0x1 means equal to
0x2 means greater than
0x3 means less than or equal to
0x4 means greater than or equal to

Please credit karatekid552 for creating it, and robin22gongon for testing it, and me for finalizing it.
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Firstly, please put your script in [ CODE ] brackets (without the spaces obviously) to improve readability.

Secondly, did you know that the DNS actually has a byte held elsewhere in memory which tells you far more simply what time of day it is?

In the DNS, it asks you for a RAM Offset for the "Status Byte". That status byte can tell you, at a glance, what time of day it is, and it's defined by the times you entered when adding the DNS to your ROM.

Just saying, it's quicker and easier to check that status byte than to check the hours, minutes and seconds (or even just the hours).

Spoiler:


It never fails to surprise me how few people make use of this great little inclusion in the DNS.
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Here's another sample I made: This one warps to the Rivals House so I suggest removing the Warp, make a signpost event, put it on the door, and compile this.
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
Comparefarbytetobyte 0x3005542 0x06
if B_>= jump @opened?
goto @closed
end

#org @opened?
comparefarbytetobyte 0x3005542 0x14
if B_>= jump @closed
goto @open
end

#org @open
msgbox @this_shop_is_open 0x2
warp 0x4 0x2 0x1 0x4 0x8
waitstate
end

#org @close
msgbox @this_store_is_closed 0x2
end

#org @this_shop_is_open
= Come in, we're open!

#org @this_store_is_closed
= Sorry we're closed!

Credits to me and karatekid552 if you can but not so necessary.
 
8
Posts
10
Years
  • Age 53
  • Seen Aug 30, 2017
How do I make it to Where at 2 PM Hoothoot can appear in the grass, and then dissappear at 5 PM?
 
27
Posts
10
Years
  • Age 24
  • Seen Jul 29, 2014
Do you happen to know how to add pokemon from other regions to emerald? I really need it.
Also adding them all at the same time would be awesome.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Do you happen to know how to add pokemon from other regions to emerald? I really need it.
Also adding them all at the same time would be awesome.

This is a thread about time-based events, so this question does not belong here, it goes in the simple questions thread.
 
1,344
Posts
14
Years
  • Seen Dec 10, 2021
How would I go about making events on a timer? Like for example, I want an event that can only happen once a day.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
How would I go about making events on a timer? Like for example, I want an event that can only happen once a day.

Easy. The first time the event happens check the day. Then copy the byte to a var. The first half will be the day it is now. The second half will be the day after. So the var is set up like so:
DDAA
DD is the current day, AA is tomorrow.
When the event is going to happen, check if the current day is equal to the After day. If so, re-do the whole thing, and you get a repeating event as the days go by.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
where is stored the other data, like day and month?
please respond :)

This image right here shows the locations and corresponding bytes for what they are:

99f4ew.png


Just make sure to follow the colors lol
 
18
Posts
7
Years
Is possible to make, when eevee friendship reaches the sufficient for evolving check if it is day or night, so eevee can evolve properly?
 
Back
Top