View Single Post
  #20341    
Old January 11th, 2012 (10:52 AM).
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote originally posted by redriders180:
Tricky stuff ahead!
How can I create my own "table" in Firered? This is my idea for a berry system:
Spoiler:
I'm using DNS. Basically, I make a small table, with one byte containing the data for one tree. This data is specifically the day that the tree was last interacted with. The script compares the current day with the day stored in the table. If they're the same, then the script doesnt give a berry. If they aren't the same, then the script gives a berry, and changes the day stored in the table to the current day. The table I *attempted* to make is at offset 0x830000. The script is below:


I can't tell if the reason the commands won't work are because of the data types, or simple error. Please help!
You need to find an unused space in RAM that will also be copied to a "save block" when the game is saved. (Unless you expect your users to rely ENTIRELY on savestates -- but you shouldn't force them to.)

Right now, your table is stored at 0x830000. This, however, is actually only an abbreviation; the proper offset is 0x08830000. 02 and 03 offsets are RAM, 04 and 05 are something to do with graphics, I don't know what 06 and 07 are, but 08 is fixed data in the ROM that can't be changed. So if you put your table at 0x08830000, you're basically adding it to your ROM as a permanent resource, not a mutable set of data.

And again, any random location in RAM will not work, because only certain areas of RAM are copied to the save blocks. (To add more such areas, you'll need ASM. I think JPAN found something that will give you an additional 200-byte save block to work with -- check the early pages in the Quick Research & Development thread.) And most RAM is already used by the game. (Even some of the RAM used in JPAN's Hacked Engine, for example, overlaps that used by the TEACHY TV item.) My signature links to my "RAM map" for FireRed, but I can't guarantee it's comprehensive (for the same reason no other such project has ever been comprehensive) and I don't remember when I last updated it.

Chances are, you'll need ASM for a good berry system. I remember that JPAN once attempted to create such a thing, but I don't recall if he ever succeeded or how well it worked if he did.

Now, if you need to create just any table (rather than one that must be alterable in-game), feel free. All a table is, is a sequential list of data with no "markers" separating it, with each chunk of data having an equal length so that you can tell them apart simply by offset.
__________________