• 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?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script] [EMERALD] Trouble Adding a "Replant Berry" Feature

bitKoder

completely unreasonable
36
Posts
7
Years
    • Seen Feb 28, 2024
    Hey guys,

    What I thought would be a relatively simple operation - prompting the player to plant a berry immediately after picking one - has not worked out to be quite so straightforward. Somehow a frankenfunction is being created out of my script when I compile it.

    By the way, I am working with a clean Pokémon Emerald ROM.

    Here was the part of the berry script I was to edit BEFORE I edited it (the clean vanilla script, in other words):
    Code:
    Berry picking function:
    #org 0x274448
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    end
    
    Berry picking message:
    #org 0x274630
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pThe soil returned to its soft and\nloamy state.

    And after I edited it:
    Code:
    Berry picking function:
    #org 0x274448
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    [COLOR="Lime"]release
    msgbox 0x8274630 MSG_YESNO '"[player] put away the [buffer1]\ni..."
    end[/COLOR]
    
    Berry picking message:
    #org 0x274630
    [COLOR="lime"]= [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pPlant another BERRY?
    [/COLOR]

    In essence, a very minimal change. The completed version will actually do something with the player's response, but at this stage of development I have encountered a problem. Here is the script after compiling:
    Code:
    #org 0x274421
    buffernumber 0x1 0x8006
    lock
    faceplayer
    special 0x2E
    msgbox 0x82745EE MSG_YESNO '"You found [buffer2] [buffer1]!\pDo..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274448
    compare LASTRESULT 0x0
    if 0x1 goto 0x8274479
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    release
    msgbox 0x8274630 MSG_YESNO '"[player] put away the [buffer1]\ni..."
    [COLOR="Red"]preparemsg 0x827468F '"The BAG's BERRIES POCKET is full.\..."
    waitmsg
    waitkeypress[/COLOR]
    release
    end

    Somehow "The BAG's BERRIES POCKET is full." (part of the next function) is being cloned into this function. Why is this happening?

    I have tried repointing the function, twice. The first time it broke the overworld (the game crashed on trying to load the overworld) and the second time it just seemed to keep using the old, unedited function (even though I had edited the "goto" to point to the new, edited function. This has confirmed my suspicion that I have no idea how to repoint things.

    Help would be much appreciated, thank you!
    Please let me know if you need more information and I would be happy to supply it. Thanks in advance :)
     
    Last edited:
    1,591
    Posts
    10
    Years
    • Seen Mar 20, 2024
    Code:
    Berry picking function:
    [COLOR="Red"]#org 0x274448[/COLOR]
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    [COLOR="Lime"]release
    msgbox 0x8274630 MSG_YESNO '"[player] put away the [buffer1]\ni..."
    end[/COLOR]
    
    Berry picking message:
    [COLOR="red"]#org 0x274630[/COLOR]
    [COLOR="lime"]= [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pPlant another BERRY?
    [/COLOR]
    So just to clarify this is the what the script looks like before you compile it? If so, it hasn't been repointed and that's most likely what is causing your problem. The parts in red are the ROM addresses that each of those sections are being compiled to, and as they're the same as the unedited script, there's no room for the edited version at those addresses. I suggest replacing both of them with dynamic labels, like so:

    Code:
    [COLOR="Lime"]#freespace 0xFF
    #dynamic [your free space location here][/COLOR]
    
    [COLOR="lime"]#org @berryFunction[/COLOR]
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    [COLOR="Lime"]release
    msgbox @berryText MSG_YESNO '"[player] put away the [buffer1]\ni..."
    end[/COLOR]
    
    Berry picking message:
    [COLOR="lime"]#org @berryText[/COLOR]
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pPlant another BERRY?

    XSE will tell you what the offsets actually are when you compile or debug the script. Hope that's helpful, but let me know if not.
     

    bitKoder

    completely unreasonable
    36
    Posts
    7
    Years
    • Seen Feb 28, 2024
    So just to clarify this is the what the script looks like before you compile it? If so, it hasn't been repointed and that's most likely what is causing your problem. The parts in red are the ROM addresses that each of those sections are being compiled to, and as they're the same as the unedited script, there's no room for the edited version at those addresses. I suggest replacing both of them with dynamic labels, like so:

    Code:
    [COLOR="Lime"]#freespace 0xFF
    #dynamic [your free space location here][/COLOR]
    
    [COLOR="lime"]#org @berryFunction[/COLOR]
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    [COLOR="Lime"]release
    msgbox @berryText MSG_YESNO '"[player] put away the [buffer1]\ni..."
    end[/COLOR]
    
    Berry picking message:
    [COLOR="lime"]#org @berryText[/COLOR]
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pPlant another BERRY?

    XSE will tell you what the offsets actually are when you compile or debug the script. Hope that's helpful, but let me know if not.

    Firstly, I'm almost certain that my edited script is (at least at this stage) shorter than the original. It's certainly less lines.

    I also have no idea how to use Free Space Finder. Do I search for FF bytes or 00 bytes? How do I know how many bytes I need? Is the search interval important? Should I look from an offset or can I just search from the beginning of the ROM? (These are all legit questions by the way, I genuinely don't know the answer to any of those)

    Guidance on this would be fantastic :)
     
    Last edited:
    1,591
    Posts
    10
    Years
    • Seen Mar 20, 2024
    Firstly, I'm almost certain that my edited script is (at least at this stage) shorter than the original. It's certainly less lines.

    I also have no idea how to use Free Space Finder. Do I search for FF bytes or 00 bytes? How do I know how many bytes I need? Is the search interval important? Should I look from an offset or can I just search from the beginning of the ROM? (These are all legit questions by the way, I genuinely don't know the answer to any of those)

    Guidance on this would be fantastic :)

    Your script certainly seems shorter than the original, though the only way to be absolutely sure is to compile it and see how much space it takes up. Generally it's just safer to repoint unless you're doing something really simple, like a single byte change (e.g. modifying a gift item or something).

    To use Free Space Finder with Emerald, search for FF bytes starting at 0xE3CF64. You don't need to know exactly how many bytes you need, just search for a large number (200 is usually more than enough). Everything from 0xE3CF64 onward is completely unused, so even if you do actually need more space than what you search for, you won't overwrite anything. The search interval isn't too important, it essentially just controls the search speed. Leaving it at one will check every byte from the starting offset, setting it to two will check every second byte, etc.
     

    bitKoder

    completely unreasonable
    36
    Posts
    7
    Years
    • Seen Feb 28, 2024
    Your script certainly seems shorter than the original, though the only way to be absolutely sure is to compile it and see how much space it takes up. Generally it's just safer to repoint unless you're doing something really simple, like a single byte change (e.g. modifying a gift item or something).

    To use Free Space Finder with Emerald, search for FF bytes starting at 0xE3CF64. You don't need to know exactly how many bytes you need, just search for a large number (200 is usually more than enough). Everything from 0xE3CF64 onward is completely unused, so even if you do actually need more space than what you search for, you won't overwrite anything. The search interval isn't too important, it essentially just controls the search speed. Leaving it at one will check every byte from the starting offset, setting it to two will check every second byte, etc.

    Thanks man! It's very nearly working now, I'm pretty sure this isn't supposed to happen though...


    Here's the script I inserted:
    Code:
    #dynamic 0xE3CF64
    
    #org 0x2742F9
    special 0x2C
    copyvar 0x8000 0x8004
    compare 0x8000 0xFF
    if 0x1 goto 0x827434F
    compare 0x8000 0x0
    if 0x1 goto 0x8274359
    compare 0x8000 0x1
    if 0x1 goto 0x82743B1
    compare 0x8000 0x2
    if 0x1 goto 0x82743C1
    compare 0x8000 0x3
    if 0x1 goto 0x82743D1
    compare 0x8000 0x4
    if 0x1 goto 0x82743E1
    compare 0x8000 0x5
    if 0x1 goto @querypickfunc
    end
    
    #org @querypickfunc
    buffernumber 0x1 0x8006
    lock
    faceplayer
    special 0x2E
    msgbox 0x82745EE MSG_YESNO '"You found [buffer2] [buffer1]!\pDo..."
    compare LASTRESULT 0x1
    if 0x1 goto @pickberryfunc
    compare LASTRESULT 0x0
    if 0x1 goto 0x8274479
    end
    
    #org @pickberryfunc
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    msgbox @replantberry MSG_YESNO '"[player] put away the [buffer1]\ni..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    #org @replantberry
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pThe soil returned to its soft and\nloamy state.\pPlant another berry?

    It looks like the berry tree only gets removed after the end of the script, meaning if I replace it with a new berry before the script ends things screw up? Except I can't find where the berry tree is actually being removed...
     
    Last edited:

    Jaizu

    Average rom hacker
    281
    Posts
    14
    Years
  • Code:
    #dynamic 0xE3CF64
    
    '---------------
    #org 0x2742F9
    special 0x2C
    copyvar 0x8000 0x8004
    compare 0x8000 0xFF
    if 0x1 goto 0x827434F
    compare 0x8000 0x0
    if 0x1 goto 0x8274359
    compare 0x8000 0x1
    if 0x1 goto 0x82743B1
    compare 0x8000 0x2
    if 0x1 goto 0x82743C1
    compare 0x8000 0x3
    if 0x1 goto 0x82743D1
    compare 0x8000 0x4
    if 0x1 goto 0x82743E1
    compare 0x8000 0x5
    if 0x1 goto @script2
    end
    
    '---------------
    #org 0x27434F
    lockall
    preparemsg 0x8274744 '"!"
    waitmsg
    waitkeypress
    releaseall
    end
    
    '---------------
    #org 0x274359
    lock
    faceplayer
    special2 LASTRESULT 0x34
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274374
    preparemsg 0x82744F0 '"It's soft, loamy soil."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org 0x2743B1
    lockall
    special 0x2E
    preparemsg 0x8274560 '"One [buffer1] was planted here."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743C1
    lockall
    special 0x2D
    preparemsg 0x8274579 '"[buffer1] has sprouted."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743D1
    lockall
    special 0x2D
    preparemsg 0x827458A '"This [buffer1] plant is growing ta..."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743E1
    call 0x82743F6
    lockall
    special 0x2D
    preparemsg 0x82745AB '"These [buffer1] flowers are bloomi..."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org @script2
    buffernumber 0x1 0x8006
    lock
    faceplayer
    special 0x2E
    msgbox 0x82745EE MSG_YESNO '"[player] found [buffer2] [buffer1]..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8E3E5DE
    compare LASTRESULT 0x0
    if 0x1 goto 0x8274479
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    pause 0x30
    call @replant
    
    '---------------
    #org 0x274374
    msgbox 0x8274507 MSG_YESNO '"It's soft, loamy soil.\nWant to pl..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    '---------------
    #org 0x27448D
    checkitem 0x10C 0x1
    compare LASTRESULT 0x0
    if 0x1 goto 0x82744BE
    special 0x2D
    msgbox 0x82746E4 MSG_YESNO '"Want to water the [buffer1] with t..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x82744C4
    compare LASTRESULT 0x0
    if 0x1 goto 0x82744BE
    releaseall
    end
    
    '---------------
    #org 0x2743F6
    compare 0x8005 0x0
    if 0x1 goto 0x827441A
    compare 0x8005 0x4
    if 0x1 goto 0x8274413
    bufferstring 0x1 0x82745E5 '"prettily"
    return
    
    '---------------
    #org @script1
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    pause 0x30
    call @replant
    '---------------
    #org 0x274479
    preparemsg 0x82746CB '"[player] left the [buffer1]\nunpic..."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org 0x274470
    preparemsg 0x827468F '"The BAG's BERRIES POCKET is full.\..."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org @replant
    special 0x2C
    copyvar 0x8000 0x8004
    msgbox @text MSG_YESNO '"Do you want to plant another berry..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    '---------------
    #org 0x274393
    fadescreen 0x1
    closeonkeypress
    special 0x2F
    waitstate
    compare 0x800E 0x0
    if 0x1 goto 0x82743AF
    removeitem 0x800E 0x1
    call 0x82744DD
    release
    end
    
    '---------------
    #org 0x2743AF
    release
    end
    
    '---------------
    #org 0x2744BE
    releaseall
    end
    
    '---------------
    #org 0x2744C4
    special 0x2D
    preparemsg 0x8274710 '"[player] watered the [buffer1]."
    waitmsg
    special 0x33
    special 0x61
    waitstate
    preparemsg 0x8274723 '"The plant seems to be delighted."
    waitmsg
    waitkeypress
    releaseall
    end
    
    '---------------
    #org 0x27441A
    bufferstring 0x1 0x82745DE '"cutely"
    return
    
    '---------------
    #org 0x274413
    bufferstring 0x1 0x82745CD '"very beautifully"
    return
    
    '---------------
    #org 0x2744DD
    special 0x30
    cmdc3 0x3
    special 0x15E
    special 0x2E
    preparemsg 0x8274535 '"[player] planted one [buffer1] in\..."
    waitmsg
    waitkeypress
    return
    
    
    '---------
    ' Strings
    '---------
    #org 0x274744
    = !
    
    #org 0x2744F0
    = It's soft, loamy soil.
    
    #org 0x274560
    = One [buffer1] was planted here.
    
    #org 0x274579
    = [buffer1] has sprouted.
    
    #org 0x27458A
    = This [buffer1] plant is growing taller.
    
    #org 0x2745AB
    = These [buffer1] flowers are blooming\n[buffer2].
    
    #org 0x2745EE
    = [player] found [buffer2] [buffer1]!\pDo you want to pick the\n[buffer1]?
    
    #org 0x27461B
    = [player] picked the [buffer2] [buffer1].
    
    #org 0x274630
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pThe soil returned to its soft and\nloamy state.
    
    #org 0x274507
    = It's soft, loamy soil.\nWant to plant a BERRY?
    
    #org 0x2746E4
    = Want to water the [buffer1] with the\nWAILMER PAIL?
    
    #org 0x2745E5
    = prettily
    
    #org 0x2746CB
    = [player] left the [buffer1]\nunpicked.
    
    #org 0x27468F
    = The BAG's BERRIES POCKET is full.\pThe [buffer1] couldn't be taken.
    
    #org @text
    = Do you want to plant another berry?
    
    #org 0x274710
    = [player] watered the [buffer1].
    
    #org 0x274723
    = The plant seems to be delighted.
    
    #org 0x2745DE
    = cutely
    
    #org 0x2745CD
    = very beautifully
    
    #org 0x274535
    = [player] planted one [buffer1] in\nthe soft, loamy soil.

    Took way more than expected lol

    Sometimes when I compile that script the first letter of some texts gets replaced, just open the script, change them back again and compile.
     

    bitKoder

    completely unreasonable
    36
    Posts
    7
    Years
    • Seen Feb 28, 2024
    Code:
    #dynamic 0xE3CF64
    
    '---------------
    #org 0x2742F9
    special 0x2C
    copyvar 0x8000 0x8004
    compare 0x8000 0xFF
    if 0x1 goto 0x827434F
    compare 0x8000 0x0
    if 0x1 goto 0x8274359
    compare 0x8000 0x1
    if 0x1 goto 0x82743B1
    compare 0x8000 0x2
    if 0x1 goto 0x82743C1
    compare 0x8000 0x3
    if 0x1 goto 0x82743D1
    compare 0x8000 0x4
    if 0x1 goto 0x82743E1
    compare 0x8000 0x5
    if 0x1 goto @script2
    end
    
    '---------------
    #org 0x27434F
    lockall
    preparemsg 0x8274744 '"!"
    waitmsg
    waitkeypress
    releaseall
    end
    
    '---------------
    #org 0x274359
    lock
    faceplayer
    special2 LASTRESULT 0x34
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274374
    preparemsg 0x82744F0 '"It's soft, loamy soil."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org 0x2743B1
    lockall
    special 0x2E
    preparemsg 0x8274560 '"One [buffer1] was planted here."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743C1
    lockall
    special 0x2D
    preparemsg 0x8274579 '"[buffer1] has sprouted."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743D1
    lockall
    special 0x2D
    preparemsg 0x827458A '"This [buffer1] plant is growing ta..."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org 0x2743E1
    call 0x82743F6
    lockall
    special 0x2D
    preparemsg 0x82745AB '"These [buffer1] flowers are bloomi..."
    waitmsg
    waitkeypress
    goto 0x827448D
    
    '---------------
    #org @script2
    buffernumber 0x1 0x8006
    lock
    faceplayer
    special 0x2E
    msgbox 0x82745EE MSG_YESNO '"[player] found [buffer2] [buffer1]..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8E3E5DE
    compare LASTRESULT 0x0
    if 0x1 goto 0x8274479
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    pause 0x30
    call @replant
    
    '---------------
    #org 0x274374
    msgbox 0x8274507 MSG_YESNO '"It's soft, loamy soil.\nWant to pl..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    '---------------
    #org 0x27448D
    checkitem 0x10C 0x1
    compare LASTRESULT 0x0
    if 0x1 goto 0x82744BE
    special 0x2D
    msgbox 0x82746E4 MSG_YESNO '"Want to water the [buffer1] with t..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x82744C4
    compare LASTRESULT 0x0
    if 0x1 goto 0x82744BE
    releaseall
    end
    
    '---------------
    #org 0x2743F6
    compare 0x8005 0x0
    if 0x1 goto 0x827441A
    compare 0x8005 0x4
    if 0x1 goto 0x8274413
    bufferstring 0x1 0x82745E5 '"prettily"
    return
    
    '---------------
    #org @script1
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    pause 0x30
    call @replant
    '---------------
    #org 0x274479
    preparemsg 0x82746CB '"[player] left the [buffer1]\nunpic..."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org 0x274470
    preparemsg 0x827468F '"The BAG's BERRIES POCKET is full.\..."
    waitmsg
    waitkeypress
    release
    end
    
    '---------------
    #org @replant
    special 0x2C
    copyvar 0x8000 0x8004
    msgbox @text MSG_YESNO '"Do you want to plant another berry..."
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    '---------------
    #org 0x274393
    fadescreen 0x1
    closeonkeypress
    special 0x2F
    waitstate
    compare 0x800E 0x0
    if 0x1 goto 0x82743AF
    removeitem 0x800E 0x1
    call 0x82744DD
    release
    end
    
    '---------------
    #org 0x2743AF
    release
    end
    
    '---------------
    #org 0x2744BE
    releaseall
    end
    
    '---------------
    #org 0x2744C4
    special 0x2D
    preparemsg 0x8274710 '"[player] watered the [buffer1]."
    waitmsg
    special 0x33
    special 0x61
    waitstate
    preparemsg 0x8274723 '"The plant seems to be delighted."
    waitmsg
    waitkeypress
    releaseall
    end
    
    '---------------
    #org 0x27441A
    bufferstring 0x1 0x82745DE '"cutely"
    return
    
    '---------------
    #org 0x274413
    bufferstring 0x1 0x82745CD '"very beautifully"
    return
    
    '---------------
    #org 0x2744DD
    special 0x30
    cmdc3 0x3
    special 0x15E
    special 0x2E
    preparemsg 0x8274535 '"[player] planted one [buffer1] in\..."
    waitmsg
    waitkeypress
    return
    
    
    '---------
    ' Strings
    '---------
    #org 0x274744
    = !
    
    #org 0x2744F0
    = It's soft, loamy soil.
    
    #org 0x274560
    = One [buffer1] was planted here.
    
    #org 0x274579
    = [buffer1] has sprouted.
    
    #org 0x27458A
    = This [buffer1] plant is growing taller.
    
    #org 0x2745AB
    = These [buffer1] flowers are blooming\n[buffer2].
    
    #org 0x2745EE
    = [player] found [buffer2] [buffer1]!\pDo you want to pick the\n[buffer1]?
    
    #org 0x27461B
    = [player] picked the [buffer2] [buffer1].
    
    #org 0x274630
    = [player] put away the [buffer1]\nin the BAG's BERRIES POCKET.\pThe soil returned to its soft and\nloamy state.
    
    #org 0x274507
    = It's soft, loamy soil.\nWant to plant a BERRY?
    
    #org 0x2746E4
    = Want to water the [buffer1] with the\nWAILMER PAIL?
    
    #org 0x2745E5
    = prettily
    
    #org 0x2746CB
    = [player] left the [buffer1]\nunpicked.
    
    #org 0x27468F
    = The BAG's BERRIES POCKET is full.\pThe [buffer1] couldn't be taken.
    
    #org @text
    = Do you want to plant another berry?
    
    #org 0x274710
    = [player] watered the [buffer1].
    
    #org 0x274723
    = The plant seems to be delighted.
    
    #org 0x2745DE
    = cutely
    
    #org 0x2745CD
    = very beautifully
    
    #org 0x274535
    = [player] planted one [buffer1] in\nthe soft, loamy soil.

    Took way more than expected lol

    Sometimes when I compile that script the first letter of some texts gets replaced, just open the script, change them back again and compile.

    That, uh... Didn't work at all :(
    The berry sprite does disappear before the player is asked to plant a new berry, which is good, but the regrowth glitch is still entirely present, and when I chose not to replant the berry, the pecha tree next to it fizzed and turned into a sapling.
     

    bitKoder

    completely unreasonable
    36
    Posts
    7
    Years
    • Seen Feb 28, 2024
    UPDATE

    Maybe the glitch was happening because my save slot was in the area where the berries were and it was an .sgm so it had already loaded the scripts before?

    I went back to the previous area and saved there so that way the game actually has to load the area with the berries rather than have it already loaded. Haven't had any glitches since then so I think it's working!

    Here's my script. You can open up an Emerald ROM with XSE, paste this in the editor, hit compile and just like that, you can replant berries. Make sure to leave and re-enter the area you're currently in if it contains berries.
    Code:
    #dynamic 0xE3CF64
    
    #org 0x2742F9
    special 0x2C
    copyvar 0x8000 0x8004
    compare 0x8000 0xFF
    if 0x1 goto 0x827434F
    compare 0x8000 0x0
    if 0x1 goto 0x8274359
    compare 0x8000 0x1
    if 0x1 goto 0x82743B1
    compare 0x8000 0x2
    if 0x1 goto 0x82743C1
    compare 0x8000 0x3
    if 0x1 goto 0x82743D1
    compare 0x8000 0x4
    if 0x1 goto 0x82743E1
    compare 0x8000 0x5
    if 0x1 goto @querypickfunc
    end
    
    #org @querypickfunc
    buffernumber 0x1 0x8006
    lock
    faceplayer
    special 0x2E
    msgbox 0x82745EE MSG_YESNO '"You found [buffer2] [buffer1]!\pDo..."
    compare LASTRESULT 0x1
    if 0x1 goto @pickberryfunc
    compare LASTRESULT 0x0
    if 0x1 goto 0x8274479
    end
    
    #org @pickberryfunc
    special 0x31
    compare 0x8004 0x0
    if 0x1 goto 0x8274470
    special 0x15F
    special 0x32
    preparemsg 0x827461B '"[player] picked the [buffer2] [buf..."
    fanfare 0x183
    waitmsg
    waitfanfare
    waitkeypress
    preparemsg 0x8274630 '"[player] put away the [buffer1]\ni..."
    waitmsg
    waitkeypress
    release
    pause 0x10
    msgbox @replantberry MSG_YESNO '"Plant another BERRY?"
    compare LASTRESULT 0x1
    if 0x1 goto 0x8274393
    compare LASTRESULT 0x0
    if 0x1 goto 0x82743AF
    end
    
    #org @replantberry
    = Plant another BERRY?
     
    Last edited:
    Back
    Top