• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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...

Darthatron

巨大なトロール。
1,152
Posts
18
Years
So, clearly the best thing about BW2 is the fact that it asks if you'd like to use another repel if it expires.
THIS IS AWESOME!
Why did Gamefreak not add this earlier?
Anyway, I've made a port of it for FireRed. I hope you enjoy it.

2OJ4t.png


It will only ask you if you'd like to use another repel if you have another one of the same repel you just used. Otherwise it will just tell you the repel expired. This is how it works in BW2.

There are a lot of byte changes to be made. Sorry for that. :(

Code:
080830CA: 0C 48 EB F7 4C FA 01 06 00 29 16 D0 41 1E 0C 06 0D 0A 07 48 EB F7 51 FA 00 2C 0E D1 03 4C 25 80 05 48 E6 F7 FA FC 01 20 08 E0 30 AD 03 02
08083119: 06
080A19A5: 06
080A19F6: 1C
080A19F8: 11
080A19FC: 0F
080A1A0E: 21 88 09 02 41 40
080A1A1E: 34 4B 28 21 71 43 5B 18 D9 79 30 1C 02 22 17 4B FF F7 49 FB C7 F7 85 FF 70 BD 20 40 00 00 FF FF 00 00 30 AD 03 02
080A1A5A: 00 00 00 00
080A1A68: 00 00 00 00
081BFB66: 00 00 00 B5 04 48 50 21 00 F0 01 F8 00 BD 00 4A 10 47 1D 74 07 08 99 19 0A 08 00 00 00 00 00 00

Then you have to compile this script. You can compile it anywhere, just note the pointer you compiled it to:
Code:
#org @Main
lock
checkitem 0x800E 1
compare LASTRESULT 1
if b_>= goto @ThereAreMore
msgbox @RepelExpired 3
release
end

#org @ThereAreMore
msgbox @UseAnother 5
closeonkeypress
compare LASTRESULT 1
if b_true goto @CallASM
end

#org @CallASM
callasm 0x081BFB69
end

#org @RepelExpired
= Repel's effect wore off.

#org @UseAnother
= Repel's effect wore off...\nUse another?

Here's a compiled version of the script for anyone having problems: (don't use this -- goto commands will not work correctly)
Code:
6A 47 0E 80 01 00 21 0D 80 01 00 06 04 1C 00 80 08 0F 00 39 00 80 08 09 03 6C 02 FF 0F 00 54 00 80 08 09 05 68 21 0D 80 01 00 06 01 32 00 80 08 02 FF 23 69 FB 1B 08 02 FF CC D9 E4 D9 E0 B4 E7 00 D9 DA DA D9 D7 E8 00 EB E3 E6 D9 00 E3 DA DA AD FF 00 FF CC D9 E4 D9 E0 B4 E7 00 D9 DA DA D9 D7 E8 00 EB E3 E6 D9 00 E3 DA DA AD AD AD FE CF E7 D9 00 D5 E2 E3 E8 DC D9 E6 AC FF 00 FF FF FF FF

Finally, replace the pointer at 08083100 with the pointer to the script. TADA! It's done. It works a treat. Let me know if you guys have any trouble, or if you find an issue with it. :)

EMERALD USERS SEE THIS POST
 
Last edited by a moderator:

El Diabeetus

Amateur Voice Actor / ROM Editor ('Hacker')
1,064
Posts
17
Years
  • Age 30
  • Seen Jun 10, 2020
I will implement this to DarkCopper and FireRed Challenge Mode, thanks! You'll be getting credit, this is one of my favorite things about B2/W2 as well.

EDIT: I've edited the bytes, but, I can't seem to get the script to compile correctly in XSE.
 
Last edited:

Lord Varion

Guess who's back?
2,642
Posts
15
Years
  • Age 29
  • Seen Jan 6, 2015
One of the best features in B2/W2.
If I ever get back to hacking, this is going right in there.
 

Tailes

Nothing to see here
21
Posts
16
Years
  • Seen Mar 22, 2022
080A19F6: 1C
080A19F6: 11

This can't be right, can it?
 

tajaros

Hi I'm dawg
855
Posts
11
Years
This is cool Darthatron! Thanks for this I'll definitely be using this. But, the 2 ^ above me are right are those typos or are they typed in one line? :/
 

shinyabsol1

Pokemon DarkJasper!?
333
Posts
13
Years
  • Seen Nov 23, 2022
Darthatron said:
So, clearly the best thing about BW2 is the fact that it asks if you'd like to use another repel if it expires.
THIS IS AWESOME!
Why did Gamefreak not add this earlier?
Anyway, I've made a port of it for FireRed. I hope you enjoy it.

I completely agree with you. Best feature ever! Great work porting this, Darthatron! I will definitely add it to my hack.

But yeah, as those above have asked: are those one line or a typo?
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Oops! That was definitly a typo.

Code:
080A19F6: 1C
080A19F8: 11

Also, there was a small bug where the textbox wouldn't disappear after you used a repel in the overworld. I've updated the first post with the fix, but if you've already implemented it just change these bytes:

Code:
080A1A32: C7 F7 85 FF 70 BD

I've also added the compiled script to the first post. :)
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
I look foward to Darthatron's research threads. ^.^

Definitely going to use this. :)
 

Platinum Lucario

The Legendary Master of [color=#D8D48C]Light[/colo
1,607
Posts
16
Years
This is excellent, it would indeed show that it can also be done in Emerald as well. But having said that, you'd need to know the offsets where it states about "Repel's effect wore off...", it would be really useful for any other ROM hacks that are currently in development, it would save you the time of having to open up your bag again and using repel. ;)
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Well, apparently there is an issue with this hack. Some tiles get messed up until the screen is refreshed. I'm working on a different way of doing things. I'll keep ya'll updated.
 

MegaKuriboh

Yare Yare Daze
811
Posts
15
Years
I have no idea how to edit bytes and stuff like that, so would you mind making a patch for this? It would be awesome if you did. Keep up the great work! ^_^
 

KyX

10
Posts
11
Years
  • Seen Jul 6, 2020
I tried to replace the bytes, but i can't understand the offsets.. I'm using HxD as Hex Editor and when typing in the offset it says that this position could not be found.

Can anyone help me? Thank you.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I tried to replace the bytes, but i can't understand the offsets.. I'm using HxD as Hex Editor and when typing in the offset it says that this position could not be found.

Can anyone help me? Thank you.

Hello! The "08" at the start of the offset just means it's in the ROM, not in the memory of the emulator. So just remove the 08 and it will work fine. :)
 

KyX

10
Posts
11
Years
  • Seen Jul 6, 2020
Hello! The "08" at the start of the offset just means it's in the ROM, not in the memory of the emulator. So just remove the 08 and it will work fine. :)

Thank you! But i have another problem.. Since i'm hacking an Italian rom.. offsets are not the same..
But i managed to find where to modify by compare bytes with a english rom..
I also fixed all pointers correctly.. But after the repel finish, the game restart.. :(
 
Back
Top