View Single Post
  #20338    
Old January 10th, 2012 (8:08 PM).
redriders180's Avatar
redriders180 redriders180 is offline
Mastermind of Pokemon Glazed
     
    Join Date: Jun 2010
    Location: Path of Victory, Tunod
    Gender: Male
    Nature: Quirky
    Posts: 540
    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:
    Spoiler:
    '---------------
    #org 0x82551B
    lock
    comparefarbytes 0x3005540 0x8830000
    if 0x1 goto 0x8825564
    call 0x88255D2
    msgbox 0x8825660 MSG_YESNO '"It's a berry tree.\nThere are [buf..."
    compare LASTRESULT 0x0
    if 0x1 goto 0x882560E
    checkitemroom 0x407C 0x1
    compare LASTRESULT 0x0
    if 0x1 goto 0x8825611
    additem 0x407C 0x1
    copybyte 0x8830000 0x3005540
    release
    end

    '---------------
    #org 0x825564
    msgbox 0x88256AE MSG_NORMAL '"There are no more ripe berries\nle..."
    release
    end

    '---------------
    #org 0x8255D2
    copybyte 0x20370C0 0x203F4E0
    setvar 0x407B 0x888
    writebytetooffset 0x4 0x203F4D8
    writebytetooffset 0x80 0x203F4D9
    writebytetooffset 0x7B 0x203F4DA
    writebytetooffset 0x40 0x203F4DB
    special 0x41
    random 0x8004
    addvar LASTRESULT 0x85
    copyvar 0x407C LASTRESULT
    bufferitem 0x0 0x407C
    return

    '---------------
    #org 0x82560E
    release
    end

    '---------------
    #org 0x825611
    msgbox 0x882561C MSG_FACE '"Oh, there's no room for a berry!\n..."
    release
    end


    '---------
    ' Strings
    '---------
    #org 0x825660
    = It's a berry tree.\nThere are [buffer1]s growing.\lWould you like to pick one?

    #org 0x8256AE
    = There are no more ripe berries\nleft to pick.

    #org 0x82561C
    = Oh, there's no room for a berry!\nDecided to leave the tree alone.


    I can't tell if the reason the commands won't work are because of the data types, or simple error. Please help!
    __________________


    I think I'm done with ROM hacking. I'll still pop in and visit, though.