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

Jaizu

Average rom hacker
261
Posts
14
Years
Let me see your friend's and I'll tell you why.

He just found the script a few bytes above the repel dialogue and made a checkitem and removeitem. I think his system is like yours, but I can't find the reason yo insert the routine that u mention since i cant see any callasm or any reason to put it.
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
He just found the script a few bytes above the repel dialogue and made a checkitem and removeitem. I think his system is like yours, but I can't find the reason yo insert the routine that u mention since i cant see any callasm or any reason to put it.

Does his ask which repel to use 3 times/ have a multibox?

Oh, parece que hablas espanol, es Reoneky?
 
9
Posts
9
Years
  • Age 33
  • Seen Jan 2, 2016
I tried it twice now and it ended the same way both times.

First i tried MrDollSteak's FireRed rombase and it didn't work,
so I used a clean FireRed rom for my next attempt, but it didn't work either.

So what happens is that when the repel runs out, nothing happens...
No message, no crash, nothing, it's simply not notifying me but I can use another one without any problems
 
20
Posts
9
Years
  • Age 35
  • NY
  • Seen Aug 6, 2018
I tried it twice now and it ended the same way both times.

First i tried MrDollSteak's FireRed rombase and it didn't work,
so I used a clean FireRed rom for my next attempt, but it didn't work either.

So what happens is that when the repel runs out, nothing happens...
No message, no crash, nothing, it's simply not notifying me but I can use another one without any problems

This is the same thing happening to me. The repel works fine. I've counted out 100 steps, and afterwards no message comes up. Not even "repel wore off".
 
76
Posts
15
Years
  • Age 31
  • Seen Aug 8, 2021
This is the same thing happening to me. The repel works fine. I've counted out 100 steps, and afterwards no message comes up. Not even "repel wore off".
Same here. I am following the tutorial to the letter and it just will not work. This is why I personally want patches for things like this: it's not that I'm lazy, it's that I am physically incapable of getting non-patches to work no matter how many times I do the exact thing I am told to.
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Same here. I am following the tutorial to the letter and it just will not work. This is why I personally want patches for things like this: it's not that I'm lazy, it's that I am physically incapable of getting non-patches to work no matter how many times I do the exact thing I am told to.

Did you do this part?

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

As harsh as it may sound, unless there's an error on the first post, then you're probably not doing absolutely everything you have to. My suggestion would just be to try again.
 
76
Posts
15
Years
  • Age 31
  • Seen Aug 8, 2021
Did you do this part?

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

As harsh as it may sound, unless there's an error on the first post, then you're probably not doing absolutely everything you have to. My suggestion would just be to try again.
Er... sorry, I never meant to imply the first post was wrong. :( Rather, I was saying that I just can't get it to work correctly because I'm me, and can't do anything right.

Yes, I did do that. In fact, here.
https://www.youtube.com/watch?v=sO_AP6cbaz0
Instead of just saying "I did everything", here is a video of me attempting it a third time, showing step by step what I did, and the result afterwards (failure again). Sorry about the aspect ratio screwery, I didn't think that through very much.
 
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
Yes, I did do that. In fact, here.

Instead of just saying "I did everything", here is a video of me attempting it a third time, showing step by step what I did, and the result afterwards (failure again). Sorry about the aspect ratio screwery, I didn't think that through very much.

As far as I can tell you've made all the byte changes correctly. Have you tried compiling the script in XSE yourself instead of using the compiled version? I had a similar problem and that's what fixed it for me.

EDIT: It's worth noting that there's nothing wrong with the compiled code given in the OP, it's just that it can't be directly pasted into the ROM unless you place it at 0x800000, or edit the pointers within it. It's much easier to just compile the script.
 
Last edited:
76
Posts
15
Years
  • Age 31
  • Seen Aug 8, 2021
As far as I can tell you've made all the byte changes correctly. Have you tried compiling the script in XSE yourself instead of using the compiled version? I had a similar problem and that's what fixed it for me.

EDIT: It's worth noting that there's nothing wrong with the compiled code given in the OP, it's just that it can't be directly pasted into the ROM unless you place it at 0x800000, or edit the pointers within it. It's much easier to just compile the script.
...oh. Will try this later on.
 
21
Posts
10
Years
  • Age 32
  • Seen Jun 13, 2016
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:
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

Sorry I was dumb >< how can I edit ? I open my rom and search for the address but it said this file does not contain that address >< pls help me
 

FIQ

251
Posts
11
Years
  • Seen Sep 15, 2022
For those using the compiled version, here are the pointers to change depending on where you inserted it, to make people's life easier, with an example if the script was inserted in 8015A0 like it was for me.
80 15 AD: 1C 00 80 08 -> BC 15 80 08
80 15 B3: 39 00 80 08 -> D9 15 80 08
80 15 BE: 54 00 80 08 -> F4 15 80 08
80 15 CC: 32 00 80 08 -> D2 15 80 08
 
Last edited:

Froosty

The_Learner
535
Posts
9
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:
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

It was working properly when I implemented it to a vanilla FR rom but....
its not working with the hack (or base) I am working with...
Is it because i have implemented so many things into the Rom???
.

.pls reply to me... I really need it...
.
.
The actual problem I am facing is it doesnot show any expiration message of repel nor asks to use another repel !!!


sorry for trouble.... but after making this reply i checked other replies and got a suggestion to complite the script by myself and after doing so, the problem was actually fixed... thanks to all making replies for helping me out :)
 
Last edited:

pokefreak890

The One that will make everything great
853
Posts
9
Years
  • Age 26
  • Seen May 18, 2023
It was working properly when I implemented it to a vanilla FR rom but....
its not working with the hack (or base) I am working with...
Is it because i have implemented so many things into the Rom???
.

.pls reply to me... I really need it...
.
.
The actual problem I am facing is it doesnot show any expiration message of repel nor asks to use another repel !!!


sorry for trouble.... but after making this reply i checked other replies and got a suggestion to complite the script by myself and after doing so, the problem was actually fixed... thanks to all making replies for helping me out :)
Usually this happens because when people are adding the code in the one where u change a bunch of pointers you need to scroll down there's a few more to add that solved my issue
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
I've updated the emerald post, made it easier to read. Might make a video soon.
 

Froosty

The_Learner
535
Posts
9
Years
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[.]

Whoa... this is great... i never noticed this though. :P
I am going to make this scripts port to fire red so that it will ask for any repel to use after one expires..... gonna do some drastic changes to original by dartharon...
This is brilliant though :)

EDIT: with the help of your script and the original post by Darthatron i managed to get this script running when a repel expires
bXx3EwW.png
epumte5.png


Now can you tell me what exactly
Spoiler:

the highlighted portion do, and i think its not the same for fire red as well so can you tell me what should i replace it with to make working in fire red... thanks in advance though :)
 
Last edited:
Back
Top