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

53
Posts
7
Years
  • Most likley, however, this is not a really important feature, very nice to have, but for now I will focus on other stuff.

    I'm very glad however that you tried to help me, learned quite alot actually, really appreciate it! :)
     

    LCCoolJ95

    Limited Capacity
    638
    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:
    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.
    This does not work. This is not specific enough. I've broken my game twice attempting this. You need to either make this even clearer to understand, or make a video tutorial, because I'm not getting this at all...
     

    Froosty

    The_Learner
    535
    Posts
    9
    Years
  • This does not work. This is not specific enough. I've broken my game twice attempting this. You need to either make this even clearer to understand, or make a video tutorial, because I'm not getting this at all...

    Well if its not working,
    I can try to help you out, by mine method would be a lot shorter and different than it...
    I can do something like
    "asking if to use or not to use repel after the expiration of repel,
    and if you select yes "multioption box will appear with "REPEL", "SUPER REPEL" and "MAX REPEL" as option and work accordingly upon your choice, but if you select none, or select "NO" in previous option, nothing will happen i.e. game will continue without execution of repel.... :)

    I have already dont it in FR now the only thing would be to change some bytes in the previous script I made and find some pointer (Which is already found in some of the earlier posts) :)

    Now If you want me to do this, I can make a go, but make sure to make a reply to this thread to notify me :)
     
    52
    Posts
    7
    Years
    • Seen Dec 28, 2021
    Well if its not working,
    I can try to help you out, by mine method would be a lot shorter and different than it...
    I can do something like
    "asking if to use or not to use repel after the expiration of repel,
    and if you select yes "multioption box will appear with "REPEL", "SUPER REPEL" and "MAX REPEL" as option and work accordingly upon your choice, but if you select none, or select "NO" in previous option, nothing will happen i.e. game will continue without execution of repel.... :)

    I have already dont it in FR now the only thing would be to change some bytes in the previous script I made and find some pointer (Which is already found in some of the earlier posts) :)

    Now If you want me to do this, I can make a go, but make sure to make a reply to this thread to notify me :)

    @The_learner

    What are the offsets to put the the BW2 Repel system in Emerald? All I see is scripts. I see the offsets for Fire Red, but not for Emerald. May you or someone post a quick step by step guide with easier understanding?
     

    bitelaserkhalif

    Falcon Punch!!
    69
    Posts
    10
    Years
  • Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Did you added any other thing into it?
    Because I applied this mod, and no problem happened. Repel is still giving exact amount of steps.
    Oh, one thing again, Can you repost the script code please? (the hastebin had 30 day expiry)

    At some point after that post, since nobody really tried to help me, I deleted the ROM and re-applied all the modifications that I wanted. I used TL's Quick Enhancer Tool for most of them because it was the fastest way to do so and it was worth trying. Since it worked perfectly fine, I didn't need to try this again.
     

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • Anyways, follow the tutorial here, http://www.pokecommunity.com/showthread.php?t=281573 and do the Emerald part in another post instead.

    Mine is working with the assembly bytes 10 B5 04 1C 78 46 13 30 0C 49 08 60 20 1C 0C 49
    00 F0 10 F8 10 BC 01 BC 00 47 10 B5 04 1C 0A 48
    05 49 00 F0 07 F8 20 1C 06 49 00 F0 03 F8 10 BC
    01 BC 00 47 08 47 C0 46 F9 8E 09 08 F4 A0 03 02
    DD D0 0F 08 9D 90 0A XX XX XX 08
    rather than what is listed here.

    Getting an error for first time a repel is used that I've had to brute force my way around. The effects of repels *always* seem to linger from earlier, until you successfully use one for the first time.

    You can fix this by adjusting the code in danny's post to check a repel has never been used before (or rather, check a flag you chose hasn't been set yet) BEFORE going to his repel scripts. If it *has* never been used before, you need to bypass the check to see if the scent lingers from earlier.

    Here's an example of a script that would do this.
    checkflag 0x3e9
    if 0x1 goto (offset of original code for this repel)
    setflag 0x3e9
    goto (offset of original code for this repel + 11)

    '11' is equal to 'B' in hexadecimal, so don't try this script unless you understand what hexadecimal means. Adding eleven to the hex value 08 increases it to 13, not 19.
    (this means your code jumps to a point LATER ON in the old code, just after the check for scents lingering the first time it's used.)
     
    Last edited:

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    Someone can make a updated tutorial for it? its very hard... i think everybodys trying to figure it, its not simple.
     

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    For emerald:

    Alright, so with the help of Le Pug and Touched, I've made a very, very ratchet system for it. The repel's effect wore off script offset is at 2A4B2A, so you can repoint it or just goto @pointer it...
    Anyways, of course, this would be much better with a multichoice, but just for testing I did yes/no boxes. Anyways, here it is, you don't need to credit us or anything..

    #dynamic 0xE40000
    #org @start
    lockall
    msgbox @woreoff 0x6
    msgbox @1 0x5
    compare 0x800D 0x1
    if 0x1 goto @Repel
    msgbox @2 0x5
    compare 0x800D 0x1
    if 0x1 goto @Super
    msgbox @3 0x5
    compare 0x800D 0x1
    if 0x1 goto @Max
    releaseall
    end

    #org @Repel
    checkitem 0x56 0x1
    compare 0x800D 0x1
    if 0x4 goto @rp
    msgbox @notenough 0x6
    releaseall
    end

    #org @notenough
    = You don't have enough.

    #org @rp
    sound 0x2F
    msgbox @usedr MSG_SIGN
    removeitem 0x56 0x1
    setvar 0x4021 100
    release
    end

    #org @usedr
    = [player] used a Repel.

    #org @1
    = Use a Repel?

    #org @2
    = Use a Super Repel?

    #org @3
    = Use a Max Repel?

    #org @Super
    checkitem 0x53 0x1
    compare 0x800D 0x1
    if 0x4 goto @sp
    msgbox @notenough 0x6
    releaseall
    end

    #org @sp
    sound 0x2F
    msgbox @useds MSG_SIGN
    removeitem 0x53 0x1
    setvar 0x4021 200
    releaseall
    end

    #org @useds
    = [player] used a Super Repel.

    #org @Max
    checkitem 0x54 0x1
    compare 0x800D 0x1
    if 0x4 goto @mp
    msgbox @notenough 0x6
    releaseall
    end

    #org @mp
    sound 0x2F
    msgbox @usedm MSG_SIGN
    removeitem 0x54 0x1
    setvar 0x4021 250
    release
    end

    #org @usedm
    = [player] used a Max Repel.

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

    I just found another system in emerald offset 2A4B2A​, the problem is, if i use max repel, and i have a repel in bag, it will use repel instead of MAX repel again, someone can help me correct this?

    #dynamic 0x800000
    #org 0x2A4B2A​
    goto @snippet1

    '---------------
    #org @snippet1
    lock
    msgbox @String1 MSG_SIGN '"El efecto del REPELENTE se\nagotó[..."
    checkitem 0x56 0x1
    compare LASTRESULT 0x1
    if 0x1 goto @snippet2
    checkitem 0x53 0x1
    compare LASTRESULT 0x1
    if 0x1 goto @snippet3
    checkitem 0x54 0x1
    compare LASTRESULT 0x1
    if 0x1 goto @snippet4
    release
    end

    '---------------
    #org @snippet2
    msgbox @String2 MSG_YESNO '"¿Quieres usar otro REPELENTE?"
    compare LASTRESULT 0x1
    if 0x1 goto @snippet5
    closeonkeypress
    release
    end

    '---------------
    #org @snippet3
    msgbox @String2 MSG_YESNO '"¿Quieres usar otro REPELENTE?"
    compare LASTRESULT 0x1
    if 0x1 goto @snippet6
    closeonkeypress
    release
    end

    '---------------
    #org @snippet4
    msgbox @String2 MSG_YESNO '"¿Quieres usar otro REPELENTE?"
    compare LASTRESULT 0x1
    if 0x1 goto @snippet7
    closeonkeypress
    release
    end

    '---------------
    #org @snippet5
    removeitem 0x56 0x1
    sound 0x2F
    setvar 0x4021 0x64
    msgbox @String3 MSG_NORMAL '"Usaste REPELENTE."
    release
    end

    '---------------
    #org @snippet6
    removeitem 0x53 0x1
    sound 0x2F
    setvar 0x4021 0xC8
    msgbox @String4 MSG_NORMAL '"Usaste SUPER REPEL."
    end

    '---------------
    #org @snippet7
    removeitem 0x54 0x1
    sound 0x2F
    setvar 0x4021 0xFA
    msgbox @String5 MSG_NORMAL '"Usaste MAX REPEL."
    end


    '---------
    ' Strings
    '---------
    #org @String1
    = El efecto del REPELENTE se\nagotó[.][.]

    #org @String2
    = ¿Quieres usar otro REPELENTE?

    #org @String3
    = Usaste REPELENTE.

    #org @String4
    = Usaste SUPER REPEL.

    #org @String5
    = Usaste MAX REPEL.
     
    Last edited:
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    @The_learner

    What are the offsets to put the the BW2 Repel system in Emerald? All I see is scripts. I see the offsets for Fire Red, but not for Emerald. May you or someone post a quick step by step guide with easier understanding?

    Offsets are just whatever free space you want to use.
    Get a free space editor find free space and then use that offset in your script.

    For anyone that doesn't understand this just read this guide.
    https://www.pokecommunity.com/showthread.php?t=164276

    Also if you're(anyone is) directly applying this code to emerald when the code posted is for fire red, you're gonna have issues because flags differ between games.

    (if my post is passed the deadline sorry)
     
    Last edited:
    31
    Posts
    3
    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.

    Hi Sir can you also help me to implement this....i wanted this quality of life in my normal Pokemon Emerald game...i also have the tools XSE and hXD... but i dont know how to start inserting the script... because looking at the beginning it was E4 00 00 is this the default?..or should i change it to normal 80 00 00 then im confused now because of the next part...#org @start now where should i compile the script in the 0x[OPEN BLANK SPACE] in the XSE....what and which address should be selected the E40000 or 800000...thanks in advance sir...
     
    173
    Posts
    4
    Years
    • Seen Feb 4, 2024
    I think this is an actual BW2 repel system, patch it and give a try!
     

    Attachments

    • EmeraldBW2RepelSystem.ips
      291 bytes · Views: 6
    Back
    Top