• 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.

Code: Port of the BW2 Repel system to GBA...

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
    • Age 24
    • Seen Nov 19, 2023
    Hey guys, I've finally made an ACTUAL* BW2 repel system for emerald.
    Okay, before I start off, you're gonna have to credit Darthatron, and Phenom2122, and if you want, Le Pug, Tcoppy, and I.

    Anyways, follow the tutorial here, http://www.pokecommunity.com/showthread.php?t=281573 and do the Emerald part in another post instead.

    Once you have that done, you're going to have to make this script for all of them:

    For Repel:
    Code:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x56 0x1
    setvar 0x4021 0x64
    setvar 0x40E9 0x1
    sound 0x2F
    msgbox 0x8E4D3B9 MSG_SIGN '"[player] used a Repel."
    end
    
    #org @no
    msgbox @nope MSG_SIGN
    end

    For Super Repel:
    Code:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x53 0x1
    setvar 0x4021 0xC8
    setvar 0x40E9 0x2
    sound 0x2F
    msgbox 0x8E4D278 MSG_SIGN '"[player] used a Super Repel."
    end
    
    #org @no
    msgbox @nope MSG_SIGN
    end
    
    #org @nope
    = But the effects of a Repel\nlingered from earlier.

    For Max Repel:
    Code:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x54 0x1
    setvar 0x4021 0xFA
    setvar 0x40E9 0x3
    sound 0x2F
    msgbox 0x8E4D2F5 MSG_SIGN '"[player] used a Max Repel."
    end
    
    #org @no
    msgbox @nope MSG_SIGN
    end
    
    #org @nope
    = But the effects of a Repel\nlingered from earlier.


    Change the offsets for the dialogue or it won't work.
    You can also change the second variable, to whichever you want/is safe, but you'll need to change it later.


    Then, make a script with this:

    Code:
    #dynamic 0xE40000
    #org @start
    msgbox @wore MSG_SIGN
    compare 0x40E9 1
    if 0x1 goto @repel
    compare 0x40E9 2
    if 0x1 goto @super
    compare 0x40E9 3
    if 0x1 goto @max
    end
    
    #org @repel
    checkitem 0x56 1
    compare 0x800d 1
    if 0x4 goto @yesrepel
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @yesrepel
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @userepel
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @userepel
    removeitem 0x56 0x1
    setvar 0x4021 0x64
    setvar 0x40E9 0x1
    sound 0x2F
    msgbox 0x8E4D3B9 MSG_SIGN '"[player] used a Repel."
    end
    
    
    #org @super
    checkitem 0x53 1
    compare 0x800d 1
    if 0x4 goto @yessuper
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @yessuper
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @usesuper
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @usesuper
    removeitem 0x53 0x1
    setvar 0x4021 0xC8
    setvar 0x40E9 0x2
    sound 0x2F
    msgbox 0x8E4D278 MSG_SIGN '"[player] used a Super Repel."
    end
    
    #org @max
    checkitem 0x54 1
    compare 0x800d 1
    if 0x4 goto @yesmax
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @yesmax
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @usemax
    setvar 0x40e9 0
    closeonkeypress
    end
    
    #org @usemax
    removeitem 0x54 0x1
    setvar 0x4021 0xFA
    setvar 0x40E9 0x3
    sound 0x2F
    msgbox 0x8E4D2F5 MSG_SIGN '"[player] used a Max Repel."
    end
    
    #org @wore
    = The Repel's effect wore off[.]
    
    #org @use
    = Use another?

    After you're done with that, go to 0x2A4B2A and replace the script there with "goto and 0x(the offset for that script).

    It hasn't been tested much, but it should work. If you find any bugs, write them here.

    *The only difference is that the screen goes to the Overworld when using it. Sorry about that, but I really don't know any other way to do it.
     
    Last edited:
    3,044
    Posts
    9
    Years
  • Ah, a way much more efficient than mine! Nice find, Sneasel! Never would have dreamed of using that way! I'm gonna test this out soon!
     
    218
    Posts
    10
    Years
    • Seen Nov 12, 2021
    Spoiler:

    Nice find ! But I tested and that doesn't work, are you sure about the 0x2A4B2A ? And what are you calling "goto" ? Just make a pointer of our script ?
    Oh yeah, precisions could be useful.
    The first repel works, and after nothing happen, not even the "repel wores off". But if I try to use another it says "already used". Then I saw a pointer 2 bytes after the location you given. At 2A4B2C, so I tried to replace that pointer with the one you gave :
    The first repel works. Then I walk until it wores off, and then a textbox with weird things appear, and I can't reuse a repel, when I try it said "already used".
    I've correctly repointed the textbox so, I don't know why it does not work
     
    Last edited:

    Danny0317

    Fluorite's back, brah
    1,067
    Posts
    10
    Years
    • Age 24
    • Seen Nov 19, 2023
    Nice find ! But I tested and that doesn't work, are you sure about the 0x2A4B2A ? And what are you calling "goto" ? Just make a pointer of our script ?
    Oh yeah, precisions could be useful.
    The first repel works, and after nothing happen, not even the "repel wores off". But if I try to use another it says "already used". Then I saw a pointer 2 bytes after the location you given. At 2A4B2C, so I tried to replace that pointer with the one you gave :
    The first repel works. Then I walk until it wores off, and then a textbox with weird things appear, and I can't reuse a repel, when I try it said "already used".
    I've correctly repointed the textbox so, I don't know why it does not work

    I did the goto cuz I was too lazy to go back and actually point it to the script (repel's effect wore off), lol. Did you make sure to follow both tutorials properly? Had you used the var I used before?
     
    218
    Posts
    10
    Years
    • Seen Nov 12, 2021
    I did the goto cuz I was too lazy to go back and actually point it to the script (repel's effect wore off), lol. Did you make sure to follow both tutorials properly? Had you used the var I used before?

    Yes I did. Basically I copied/passed your script, changed the textbox, added a textbox for the repel because it was missing. But I don't know what are you calling "goto". I know if the address of my script is 95 00 00, a pointer is 00 00 95 08, is that are you calling goto ?

    And for the Darthatron (adapted by phenom) callingscript from item, I already used this and worked every time so I'm sure I haven't missed something here.
     

    Danny0317

    Fluorite's back, brah
    1,067
    Posts
    10
    Years
    • Age 24
    • Seen Nov 19, 2023
    Yes I did. Basically I copied/passed your script, changed the textbox, added a textbox for the repel because it was missing. But I don't know what are you calling "goto". I know if the address of my script is 95 00 00, a pointer is 00 00 95 08, is that are you calling goto ?

    And for the Darthatron (adapted by phenom) callingscript from item, I already used this and worked every time so I'm sure I haven't missed something here.

    come here, so we can fix that :)
    http://chat.linkandzelda.com:9090/?channels=problem&nick=kleenexfeu&uio=MTE9MjA16a#
     

    Criminon

    Forever Spriting
    265
    Posts
    11
    Years
  • Hmmm... anyone have this completely ruin the effect of repel? It just lets me use it infinitely but it no longer repels and I never get an end message.

    Edit: I swear I mess everything up the first time on everything I add... I got it working! Works great.
     

    Splash

    But nothing happened.
    658
    Posts
    14
    Years
  • Hmmm... anyone have this completely ruin the effect of repel? It just lets me use it infinitely but it no longer repels and I never get an end message.

    Edit: I swear I mess everything up the first time on everything I add... I got it working! Works great.

    You did it wrong mate.. try compiling the script yourself..
     

    GalladedOlive

    Former Pokémon ROM Hacker/Video Editor
    15
    Posts
    10
    Years
    • Seen Jul 13, 2015
    Can someone actually make a video tutorial on this, so I can see how to do it? I'm not one of those learners by just reading things, but I'd prefer to just have a video ready so that I can easily just repeat the process in my head. It's really appreciated if you do that. Thanks for your help.
     
    Last edited:

    Danny0317

    Fluorite's back, brah
    1,067
    Posts
    10
    Years
    • Age 24
    • Seen Nov 19, 2023
    Can someone actually make a video tutorial on this, so I can see how to do it? I'm not one of those learners by just reading things, but I'd prefer to just have a video ready so that I can easily just repeat the process in my head. It's really appreciated if you do that. Thanks for your help.

    Well, I don't mean to sound like a dick, and I could be wrong, but I don't think anyone really will. Most tutorials for ROM hacking are written, not videos.. Why not give it a try like this and just ask questions if you get any?
     

    GalladedOlive

    Former Pokémon ROM Hacker/Video Editor
    15
    Posts
    10
    Years
    • Seen Jul 13, 2015
    Well, I don't mean to sound like a dick, and I could be wrong, but I don't think anyone really will. Most tutorials for ROM hacking are written, not videos.. Why not give it a try like this and just ask questions if you get any?




    You know, you're actually right about that. I guess I need to find that extra learning style that I've yet to discover. But, I'll try my best, & see how it goes.
     
    229
    Posts
    8
    Years
  • Alright, I managed to get to the point where I'm alerted that my steps are up and I receive my question. When I answer no, my game is fine. When I answer yes to use another repel, my game freezes. I've gone through all of the bytes twice, but haven't had anything change.

    I'm trying to implement it on an already started hack. Though, I haven't made a ton of progress. I'm able to restart I think, to get this and whatever else I want in my game now.
     

    Exodrake

    The Manliest Chick that Ever Manlied
    163
    Posts
    10
    Years
    • Seen Nov 30, 2016
    I take it this isn't compatible with MrDollSteak's FireRed rombase? I followed the instructions in the OP to the letter and the game freezes when the repel's effect wears off.
     

    Jaizu

    Average rom hacker
    281
    Posts
    14
    Years
  • Hey guys, I've finally made an ACTUAL* BW2 repel system for emerald.
    Okay, before I start off, you're gonna have to credit Darthatron, and Phenom2122, and if you want, Le Pug, Tcoppy, and I.

    Anyways, follow the tutorial here, http://www.pokecommunity.com/showthread.php?t=281573 and do the Emerald part in another post instead.

    Once you have that done, you're going to have to make this script for all of them:

    For Repel:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x56 0x1
    setvar 0x4021 0x64
    setvar 0x40E9 0x1
    sound 0x2F
    msgbox 0x8E4D3B9 MSG_SIGN '"[player] used a Repel."
    end

    #org @no
    msgbox @nope MSG_SIGN
    end

    For Super Repel:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x53 0x1
    setvar 0x4021 0xC8
    setvar 0x40E9 0x2
    sound 0x2F
    msgbox 0x8E4D278 MSG_SIGN '"[player] used a Super Repel."
    end

    #org @no
    msgbox @nope MSG_SIGN
    end

    #org @nope
    = But the effects of a Repel\nlingered from earlier.

    For Max Repel:
    #dynamic 0xE40000
    #org @start
    compare 0x40e9 0x1
    if 0x4 goto @no
    removeitem 0x54 0x1
    setvar 0x4021 0xFA
    setvar 0x40E9 0x3
    sound 0x2F
    msgbox 0x8E4D2F5 MSG_SIGN '"[player] used a Max Repel."
    end

    #org @no
    msgbox @nope MSG_SIGN
    end

    #org @nope
    = But the effects of a Repel\nlingered from earlier.


    Change the offsets for the dialogue or it won't work.
    You can also change the second variable, to whichever you want/is safe, but you'll need to change it later.


    Then, make a script with this:

    #dynamic 0xE40000
    #org @start
    msgbox @wore MSG_SIGN
    compare 0x40E9 1
    if 0x1 goto @repel
    compare 0x40E9 2
    if 0x1 goto @super
    compare 0x40E9 3
    if 0x1 goto @max
    end

    #org @repel
    checkitem 0x56 1
    compare 0x800d 1
    if 0x4 goto @yesrepel
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @yesrepel
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @userepel
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @userepel
    removeitem 0x56 0x1
    setvar 0x4021 0x64
    setvar 0x40E9 0x1
    sound 0x2F
    msgbox 0x8E4D3B9 MSG_SIGN '"[player] used a Repel."
    end


    #org @super
    checkitem 0x53 1
    compare 0x800d 1
    if 0x4 goto @yessuper
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @yessuper
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @usesuper
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @usesuper
    removeitem 0x53 0x1
    setvar 0x4021 0xC8
    setvar 0x40E9 0x2
    sound 0x2F
    msgbox 0x8E4D278 MSG_SIGN '"[player] used a Super Repel."
    end

    #org @max
    checkitem 0x54 1
    compare 0x800d 1
    if 0x4 goto @yesmax
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @yesmax
    msgbox @use 0x5
    compare LASTRESULT 1
    if 0x1 goto @usemax
    setvar 0x40e9 0
    closeonkeypress
    end

    #org @usemax
    removeitem 0x54 0x1
    setvar 0x4021 0xFA
    setvar 0x40E9 0x3
    sound 0x2F
    msgbox 0x8E4D2F5 MSG_SIGN '"[player] used a Max Repel."
    end

    #org @wore
    = The Repel's effect wore off[.]

    #org @use
    = Use another?

    After you're done with that, go to 0x2A4B2A and replace the script there with "goto and 0x(the offset for that script).

    It hasn't been tested much, but it should work. If you find any bugs, write them here.

    *The only difference is that the screen goes to the Overworld when using it. Sorry about that, but I really don't know any other way to do it.

    A friend got that system for RUBY without insert any ASM rutine, can I ask why I need it in Emerald?
     
    Back
    Top