Community

The PokéCommunity

We are still working on a better slogan!

Visit Index



Advertise here

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.

Post Reply
 
Thread Tools
  #1    
Old April 3rd, 2013, 07:01 PM
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com
 
Join Date: Nov 2012
Location: Earth
Age: 15
Gender: Male
Nature: Quiet

Advertise here
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).

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

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 by GoGoJJTech; May 22nd, 2014 at 12:44 PM.
  #2    
Old April 5th, 2013, 05:05 AM
Jambo51's Avatar
Jambo51
Glory To Arstotzka
 
Join Date: Jun 2009
Gender: Male
Nature: Quiet
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:
Consider, you want to check a range of times to see if it's a specific period, which requires a minimum of 2 checks, except for times at the extreme ends of the scale.

The status byte checks requires one check and you know straight away.


It never fails to surprise me how few people make use of this great little inclusion in the DNS.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
  #3    
Old April 5th, 2013, 05:09 AM
robin22gongon's Avatar
robin22gongon
 
Join Date: Sep 2012
Location: Want to know? VM me.
Age: 16
Gender: Male
Nature: Quirky
Send a message via Windows Live Messenger to robin22gongon
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.
LET'S PARTY!
  #4    
Old September 28th, 2013, 07:31 PM
superluke's Avatar
superluke
 
Join Date: Sep 2013
How do I make it to Where at 2 PM Hoothoot can appear in the grass, and then dissappear at 5 PM?
  #5    
Old September 29th, 2013, 08:35 AM
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com
 
Join Date: Nov 2012
Location: Earth
Age: 15
Gender: Male
Nature: Quiet
Quote:
Originally Posted by superluke View Post
How do I make it to Where at 2 PM Hoothoot can appear in the grass, and then disappear at 5 PM?
In the grass? You would need to use this ASM: http://www.pokecommunity.com/showthread.php?t=237951
In an event like a script or signpost or whatever, you could just change the checks of hours.
  #6    
Old September 30th, 2013, 09:24 AM
exidia
 
Join Date: Sep 2013
Gender: Male
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.
  #7    
Old September 30th, 2013, 11:39 AM
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com
 
Join Date: Nov 2012
Location: Earth
Age: 15
Gender: Male
Nature: Quiet
Quote:
Originally Posted by exidia View Post
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.
  #8    
Old November 2nd, 2013, 05:48 PM
chrunch's Avatar
chrunch
 
 
Join Date: Oct 2009
Gender: Male
Send a message via Windows Live Messenger to chrunch
How would I go about making events on a timer? Like for example, I want an event that can only happen once a day.
  #9    
Old November 2nd, 2013, 05:54 PM
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com
 
Join Date: Nov 2012
Location: Earth
Age: 15
Gender: Male
Nature: Quiet
Quote:
Originally Posted by chrunch View Post
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.
Post Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:10 PM.

About Us
© 2002 - 2014 The PokéCommunity™, pokecommunity.com. Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.

Copyright
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com. PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator. Header artwork by Jordanice of deviantART.

Social Media
If you would like to stay up-to-date with us on the go, when we're down, or other such things, follow us on social media sites--most notibly Twitter, Facebook, and Google Plus--by clicking on the links provided.

Design presented by Peitharchia. Special thanks to Hiroshi Sotomura and Ausaudriel.