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:
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 0x
08830000. 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 0x
08830000, 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.