• 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?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • 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.

[Other] Pokemon FireRed: Rebattling Gym Leaders

  • 38
    Posts
    12
    Years
    • Seen Aug 16, 2021
    If I wanted to rematch Gym Leaders and Trainers in Pokemon FireRed after defeating them, what would I need to do? For example, let's say I wanted to rematch Brock immediately after beating him, and all it took was talking to him again after beating him... what would I need to get rid of in his script?

    Code:
    #org 0x816A593
    '-----------------------------------
    setvar 0x8004 0x2
    setvar 0x8005 0x2
    special FAME_CHECKER_NEW
    trainerbattle 0x1 0x19E 0x0 0x8190CD4 0x8190E4F 0x816A5C5
    checkflag 0x254
    if false jump 0x816A5F3 ' Flag is unset
    msgbox 0x819110F ' There are all kinds ...
    callstd MSG_NOCLOSE ' Non-closing message
    release
         ' Release commands close any open messages
    end
    
    #org 0x816A5C5
    '-----------------------------------
    setvar 0x8004 0x2
    setvar 0x8005 0x1
    special FAME_CHECKER
    setflag 0x4B0
    setflag FR_BADGE_1
    setvar 0x406C 0x1
    setflag 0x2E
    clearflag 0x92
    setvar 0x8008 0x1
    call 0x81A6B18
    jump 0x816A5F3
    
    #org 0x81A6B18
    '-----------------------------------
    copyvar 0x8000 0x8008
    compare 0x8000 0x1
    if == jump 0x81A6B76 ' Equal To
    compare 0x8000 0x2
    if == jump 0x81A6B7A ' Equal To
    compare 0x8000 0x3
    if == jump 0x81A6B81 ' Equal To
    compare 0x8000 0x4
    if == jump 0x81A6B8B ' Equal To
    compare 0x8000 0x5
    if == jump 0x81A6BA1 ' Equal To
    compare 0x8000 0x6
    if == jump 0x81A6BB4 ' Equal To
    compare 0x8000 0x7
    if == jump 0x81A6BCA ' Equal To
    compare 0x8000 0x8
    if == jump 0x81A6BE0 ' Equal To
    end
    
    #org 0x81A6B76
    '-----------------------------------
    cleartrainerflag 0x8E
    return
    
    #org 0x816A5F3
    '-----------------------------------
    msgbox 0x8190FC1 ' Wait!\nTake this wit...
    callstd MSG_NOCLOSE ' Non-closing message
    checkitemspaceinbag TM39 1
    compare LASTRESULT 0x0
    if == jump 0x816A634 ' Equal To
    additem TM39 1
    msgbox 0x8190FDB ' \v\h01 received TM39...
    copyvarifnotzero 0x8000 TM39
    copyvarifnotzero 0x8001 0x1
    copyvarifnotzero 0x8002 0x101
    callstd MSG_ITEM ' Shows a message, then... 'Player put the yyy in the zzz!'
    setflag 0x254
    msgbox 0x8190FF8 ' A TM, Technical Mach...
    callstd MSG_NOCLOSE ' Non-closing message
    release
         ' Release commands close any open messages
    end
    
    #org 0x816A634
    '-----------------------------------
    msgbox 0x81911CE ' You don't have room ...
    callstd MSG_NOCLOSE ' Non-closing message
    release
         ' Release commands close any open messages
    end
    
    #org 0x81A6B7A
    '-----------------------------------
    cleartrainerflag 0x96
    cleartrainerflag 0xEA
    return
    
    #org 0x81A6B81
    '-----------------------------------
    cleartrainerflag 0x8D
    cleartrainerflag 0xDC
    cleartrainerflag 0x1A7
    return
    
    #org 0x81A6B8B
    '-----------------------------------
    cleartrainerflag 0x84
    cleartrainerflag 0x85
    cleartrainerflag 0xA0
    cleartrainerflag 0x109
    cleartrainerflag 0x10A
    cleartrainerflag 0x10B
    cleartrainerflag 0x192
    return
    
    #org 0x81A6BA1
    '-----------------------------------
    cleartrainerflag 0x126
    cleartrainerflag 0x127
    cleartrainerflag 0x120
    cleartrainerflag 0x121
    cleartrainerflag 0x124
    cleartrainerflag 0x125
    return
    
    #org 0x81A6BB4
    '-----------------------------------
    cleartrainerflag 0x118
    cleartrainerflag 0x119
    cleartrainerflag 0x11A
    cleartrainerflag 0x11B
    cleartrainerflag 0x1CE
    cleartrainerflag 0x1CF
    cleartrainerflag 0x1D0
    return
    
    #org 0x81A6BCA
    '-----------------------------------
    cleartrainerflag 0xB1
    cleartrainerflag 0xB2
    cleartrainerflag 0xB3
    cleartrainerflag 0xB4
    cleartrainerflag 0xD5
    cleartrainerflag 0xD6
    cleartrainerflag 0xD7
    return
    
    #org 0x81A6BE0
    '-----------------------------------
    cleartrainerflag 0x128
    cleartrainerflag 0x129
    cleartrainerflag 0x142
    cleartrainerflag 0x143
    cleartrainerflag 0x144
    cleartrainerflag 0x188
    cleartrainerflag 0x190
    cleartrainerflag 0x191
    return
    
    
    #org 0x8190CD4
    = So, you're here. I'm BROCK.\nI'm PEWTER's GYM LEADER.\pMy rock-hard willpower is evident\neven in my POK\eMON.\pMy POK\eMON are all rock hard, and\nhave true-grit determination.\pThat's right - my POK\eMON are all\nthe ROCK type!\pFuhaha! You're going to challenge\nme knowing that you'll lose?\pThat's the TRAINER's honor that\ncompels you to challenge me.\pFine, then!\nShow me your best!\c\h0B\h56\h01
    
    #org 0x8190E4F
    = I took you for granted, and so\nI lost.\pAs proof of your victory, I confer\non you this[.]the official POK\eMON\lLEAGUE BOULDERBADGE.\p\c\h06\h02\v\h01 received the BOULDERBADGE\nfrom BROCK!\c\h17\c\h0B\h04\h01\c\h08\n\c\h08\h56\c\h18\p\c\h06\h04Just having the BOULDERBADGE makes\nyour POK\eMON more powerful.\pIt also enables the use of the\nmove FLASH outside of battle.\pOf course, a POK\eMON must know the\nmove FLASH to use it.
    
    #org 0x819110F
    = There are all kinds of TRAINERS in\nthis huge world of ours.\pYou appear to be very gifted as a\nPOK\eMON TRAINER.\pSo let me make a suggestion.\pGo to the GYM in CERULEAN and test\nyour abilities.
    
    #org 0x8190FC1
    = Wait!\nTake this with you.
    
    #org 0x8190FDB
    = \v\h01 received TM39\nfrom BROCK.
    
    #org 0x8190FF8
    = A TM, Technical Machine, contains a\ntechnique for POK\eMON.\pUsing a TM teaches the move it\ncontains to a POK\eMON.\pA TM is good for only one use.\pSo, when you use one, pick the\nPOK\eMON carefully.\pAnyways[.]\nTM39 contains ROCK TOMB.\pIt hurls boulders at the foe and\nlowers its SPEED.
    
    #org 0x81911CE
    = You don't have room for this.
     
    You'd need to add another part to the start of the script like this:

    checkflag 0x820
    if 0x1 goto @rematch

    Then at @rematch put another trainerbattle and whatever you want him to say
     
    You'd need to add another part to the start of the script like this:

    checkflag 0x820
    if 0x1 goto @rematch

    Then at @rematch put another trainerbattle and whatever you want him to say

    So, if I do this, I can rematch Brock as many times as I like?
     
    Yes, you'd also need to add a settrainerflag 0x(his trainer ID) before the battle so you can continually battle him.
     
    Yes, you'd also need to add a settrainerflag 0x(his trainer ID) before the battle so you can continually battle him.

    I see. Truth be told, I've spent most of my time yesterday (as of this response), trying to script the rebattle, but I just don't have the faintest idea on how to start. I think I might have somewhat of an idea, but I don't think it'll work...

    Code:
    checkflag 0x820
    if 0x1 goto @rematch
    
    #dyn 0x8740001
    #org @rematch
    trainerbattle 0x0 0x19E 0x0 @intro @defeat
    settrainerflag 0x19E
    msgbox @afterwards
    callstd msg_normal
    end
    #org @intro
    = I will crush you!!!
    
    #org @defeat
    = You crushed me[.]
    
    #org @afterwards
    = I can also say something after the battle

    Yeah, I'm new to the scripting game, so... forgive me if I'm not getting it.
     
    I see. Truth be told, I've spent most of my time yesterday (as of this response), trying to script the rebattle, but I just don't have the faintest idea on how to start. I think I might have somewhat of an idea, but I don't think it'll work...

    Code:
    checkflag 0x820
    if 0x1 goto @rematch
    
    #dyn 0x8740001
    #org @rematch
    trainerbattle 0x0 0x19E 0x0 @intro @defeat
    settrainerflag 0x19E
    msgbox @afterwards
    callstd msg_normal
    end
    #org @intro
    = I will crush you!!!
    
    #org @defeat
    = You crushed me[.]
    
    #org @afterwards
    = I can also say something after the battle

    Yeah, I'm new to the scripting game, so... forgive me if I'm not getting it.

    Here you go, I spent 5 minutes editing Brock's script so it has a very basic rematch functionality. Changes in bold.
    Spoiler:

    If you have any questions let me know but hopefully it makes sense, you should be able to compile this using XSE and replace Brock's old script with it.
     
    You'd need to add another part to the start of the script like this:

    checkflag 0x820
    if 0x1 goto @rematch

    Then at @rematch put another trainerbattle and whatever you want him to say

    what should I do if I want to rebattle gym leaders after getting national dex ie becoming champion the first time. for example brock will only battle second time after he checks you has a national dex
     
    Thanks a lot! Now, I can battle Brock to my heart's content. Of course, there's one more favor I need... Giovanni Viridian Gym match. I could make a rematch script for Giovanni, but the problem is he seems to vanish after battle. In Pokemon Yellow, you could respawn and rematch him with this code:

    Giovanni (Viridian Rematch, Pokemon Yellow) [JDonald]
    Code:
    010050D7
    0100ABD5

    In FR/LG, I don't think it's that simple. What in the script tells Giovanni to vanish after the "Farewell!" part?
     
    Thanks a lot! Now, I can battle Brock to my heart's content. Of course, there's one more favor I need... Giovanni Viridian Gym match. I could make a rematch script for Giovanni, but the problem is he seems to vanish after battle. In Pokemon Yellow, you could respawn and rematch him with this code:

    Giovanni (Viridian Rematch, Pokemon Yellow) [JDonald]
    Code:
    010050D7
    0100ABD5

    In FR/LG, I don't think it's that simple. What in the script tells Giovanni to vanish after the "Farewell!" part?
    Delete this part of the script:
    Code:
    fadescreen 0x1
    hidesprite 0x8
    fadescreen 0x0

    You also might want to replace his person ID in Advance map with 0000 incase he still disappears after exiting the map.
     
    Delete this part of the script:
    Code:
    fadescreen 0x1
    hidesprite 0x8
    fadescreen 0x0

    You also might want to replace his person ID in Advance map with 0000 incase he still disappears after exiting the map.

    Thanks for your help so far... Just one more thing and my troubles are over: the Gym Trainers... This is Camper Liam's script I made for rebattling him:

    Code:
    [SPOILER]#dyn 0x800000
    
    #org 0x816A63E
    '-----------------------------------
    checkflag 0x820
    if 0x1 goto @rematch
    trainerbattle 0x0 0x8E 0x0 0x81911EC 0x8191237
    msgbox 0x819126B ' You're pretty hot.\n...
    callstd MSG_LOCK ' Built-in lock command
    end
    
    #org @rematch
    settrainerflag 0x8E
    trainerbattle 0x0 0x8E 0x0 0x81911EC 0x8191237
    end
    
    #org @after
    msgbox 0x819126B ' You're pretty hot.\n...
    callstd MSG_LOCK ' Built-in lock command
    release
    end
    
    #org 0x81911EC
    = Stop right there, kid!\pYou're ten thousand light-years \nfrom facing BROCK!
    
    #org 0x8191237
    = Darn!\pLight-years isn't time[.]\nIt measures distance!
    
    #org 0x819126B
    = You're pretty hot.\n[.]But not as hot as BROCK!
    [/SPOILER]

    Problem? The game crashes after Liam comes my way with the Rocket Grunt encounter music playing, just before he talks. The only way I can stop this from happening is if I strip him of his Trainer data ($00) and View Radius, and he works like Brock... which seems to implicate to me I'm doing something wrong there when it comes to Gym/Dungeon Trainers... either that, or the @rematch doesn't work with normal trainers. What would this be?
     
    Thanks for your help so far... Just one more thing and my troubles are over: the Gym Trainers... This is Camper Liam's script I made for rebattling him:

    Code:
    [SPOILER]#dyn 0x800000
    
    #org 0x816A63E
    '-----------------------------------
    checkflag 0x820
    if 0x1 goto @rematch
    trainerbattle 0x0 0x8E 0x0 0x81911EC 0x8191237
    msgbox 0x819126B ' You're pretty hot.\n...
    callstd MSG_LOCK ' Built-in lock command
    end
    
    #org @rematch
    settrainerflag 0x8E
    trainerbattle 0x0 0x8E 0x0 0x81911EC 0x8191237
    end
    
    #org @after
    msgbox 0x819126B ' You're pretty hot.\n...
    callstd MSG_LOCK ' Built-in lock command
    release
    end
    
    #org 0x81911EC
    = Stop right there, kid!\pYou're ten thousand light-years \nfrom facing BROCK!
    
    #org 0x8191237
    = Darn!\pLight-years isn't time[.]\nIt measures distance!
    
    #org 0x819126B
    = You're pretty hot.\n[.]But not as hot as BROCK!
    [/SPOILER]

    Problem? The game crashes after Liam comes my way with the Rocket Grunt encounter music playing, just before he talks. The only way I can stop this from happening is if I strip him of his Trainer data ($00) and View Radius, and he works like Brock... which seems to implicate to me I'm doing something wrong there when it comes to Gym/Dungeon Trainers... either that, or the @rematch doesn't work with normal trainers. What would this be?

    Normal trainers work differently. If you move the checkflag under the trainerbattle then it should work but you'll have to talk to him to rematch him. Do you want to be able to infinitely battle him too, and do you want to only be able to after beating brock?
     
    Normal trainers work differently. If you move the checkflag under the trainerbattle then it should work but you'll have to talk to him to rematch him. Do you want to be able to infinitely battle him too, and do you want to only be able to after beating brock?

    Well, let's say I wanted to rematch Liam infinitely after defeating Brock for the first time? I think I figured out how to do it before battling Brock.
     
    Then just do what I said and move the checkflag.

    I see. But, I just discovered if you do the "checkflag for [Gym Badge Hex]" routine to the trainers, it's obviously gonna overwrite the guy at the entrance's script. You know, "Yo! Champ in the making!"? and you obviously can't do this with two trainers in the gym (I did this in Cerulean Gym to know for sure). So, let's say I wanted to do this for multiple gym trainers without screwing up the script of another person... is there any way to do that?

    P.S., Giovanni disappearing didn't really matter because the checkflag thing just looped back to his starting script before you beat him, "Fuahahaha! This is my hideout..." that pre-battle speech at Viridian? But I took that out of his Gym Leader script like you said, chrunch.
     
    I see. But, I just discovered if you do the "checkflag for [Gym Badge Hex]" routine to the trainers, it's obviously gonna overwrite the guy at the entrance's script. You know, "Yo! Champ in the making!"? and you obviously can't do this with two trainers in the gym (I did this in Cerulean Gym to know for sure). So, let's say I wanted to do this for multiple gym trainers without screwing up the script of another person... is there any way to do that?

    P.S., Giovanni disappearing didn't really matter because the checkflag thing just looped back to his starting script before you beat him, "Fuahahaha! This is my hideout..." that pre-battle speech at Viridian? But I took that out of his Gym Leader script like you said, chrunch.
    When you edit and recompile any script in the game, and it's bigger than the original version, than yeah it overwrites and corrupts whatever comes after it. This is why I told you to compile brock's script in XSE and replace the old one, not just edit it.

    To do this first make sure in Options>Decompile Options in XSE you have ticked refactoring and unticked comments. find your script and it should be in the same format as any normal script you write, which makes it a bit easier to understand. From here you can copy the script into a new tab and once you've edited it, compile it. You will get an offset that can be pasted over the old one in A-map.
     
    When you edit and recompile any script in the game, and it's bigger than the original version, than yeah it overwrites and corrupts whatever comes after it. This is why I told you to compile brock's script in XSE and replace the old one, not just edit it.

    To do this first make sure in Options>Decompile Options in XSE you have ticked refactoring and unticked comments. find your script and it should be in the same format as any normal script you write, which makes it a bit easier to understand. From here you can copy the script into a new tab and once you've edited it, compile it. You will get an offset that can be pasted over the old one in A-map.

    Well, my good man, I've done it and I did that without corrupting the guy at the entrance. I guess we can finally consider this case closed.
     
    When you edit and recompile any script in the game, and it's bigger than the original version, than yeah it overwrites and corrupts whatever comes after it. This is why I told you to compile brock's script in XSE and replace the old one, not just edit it.

    To do this first make sure in Options>Decompile Options in XSE you have ticked refactoring and unticked comments. find your script and it should be in the same format as any normal script you write, which makes it a bit easier to understand. From here you can copy the script into a new tab and once you've edited it, compile it. You will get an offset that can be pasted over the old one in A-map.

    ...Of course, while this case is solved, I kinda did it in a more... complicated way. I got PKSV-UI involved. Dunno if that was necessary, but it seemed appropriate at the time... heh heh heh...
     
    Well, it took a few years, but I figured out how to not only rematch Brock via scripts, but I've done it with these scripts. I use XSE to compile these, BTW... and you can put them on the signs outside the Gyms. They're what I like to call "Restart the Gym" scripts.

    https://www.mediafire.com/file/g6tv2xqe714prh4/Brock_Yes_No_Script.txt
    https://www.mediafire.com/file/8xa3u82pkxp5v3v/Misty_Script.txt
    https://www.mediafire.com/file/7ve7emm2dq7r928/Lt._Surge_Script.txt
    https://www.mediafire.com/file/i37a2f7m4spax7h/Erika_Yes_No_Script.txt
     
    Back
    Top