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

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 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[.]
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
@Dark Sneasel
Steps are in HEX, so the line

is currently wrong and produces 256 steps-repel.

Nice to see someone else dont mess up the hole bag routine :) Thats the better soulotion i guess to ;)

In the newest XSE you don't need to put 0x in front of a number and it won't be hex.
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
@Dark Sneasel
Steps are in HEX, so the line

is currently wrong and produces 256 steps-repel.

Nice to see someone else dont mess up the hole bag routine :) Thats the better soulotion i guess to ;)
You know, you keep saying Darthatron's routine sucks. Why don't you share your routine with us? You have more than 15 posts now, I believe.
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
Because DarkSneasel posted the soulution? If you setvar 0x4021 0x9, repel work for 9 steps. Some Routines do "backgroundwork" and those stepcounters are some of those.
You can compare also this var, for example, for an quest or sth. else like this:

Code:
compare 0x4021 25
if 0x1 goto @operdoor
//doorclosed
end

@opendoor
//open secret door
end
DarkSneasel's script doesn't work exactly like BW's repels though. BW automatically uses the type of repel you used last time. You have to manually choose the repel you want to use though, in DarkSneasel's case. So it's, like DarkSneasel said, a ratchet solution.
(I still think this is cool, but an ASM port of Darthatron's repel routine would be better though)
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Wait, there's an emerald item ASM hack? So can't we just make one var, and give it a different value depending on the repel they use, then do the repel effect, and then after the repel wears off, compare the var?

edit: it appears that ASM doesn't work, and big daddy Touched is working on some items stuff ;)
 
Last edited:

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
544929_731667556901303_6606515769621833474_n.jpg


I DID IT! ! !

But wait?

After I pressed YES, It restarts!!

Hpw can I fix that? Also The callasm offset given by dartharton, Do I need to change that or just copy that?
 
45
Posts
9
Years
  • Seen May 26, 2018
That's Awesome! I Don't Play around with Scripting much...Not a stronghold for me. Maybe someone can make this into an ips Patch for Everyone to enjoy!
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
That's Awesome! I Don't Play around with Scripting much...Not a stronghold for me. Maybe someone can make this into an ips Patch for Everyone to enjoy!
9 times out of 10, you're not going to get an ips patch in the research forums. I suggest learning how to compile scripts and how to use a hex editor, since this isn't really hard to insert if you know how to do those two things.
 
45
Posts
9
Years
  • Seen May 26, 2018
9 times out of 10, you're not going to get an ips patch in the research forums. I suggest learning how to compile scripts and how to use a hex editor, since this isn't really hard to insert if you know how to do those two things.
Yeah, I Had Realized that when i saw Non ips stuff in the research forms here. I started to learn how to insert a hex editor... Thanks!
 

thiaguinhohp

Hacking newbie
49
Posts
10
Years
Why people dont do amazing things like this for Emerald ??? Emerald got battle frontier so its much better than fire red. Wake up hackers :o
 
3,044
Posts
9
Years
Hello! So, I have managed to develop another ratchet repel system for Emerald, and here's the script:
Code:
#dynamic 0xE40000

#org @repelsystem
lock
msgbox @1 0x5
compare 0x800D 0x1
if 0x1 goto @yes
release
end

#org @yes
lock
multichoice 0x0 0x3 0x71 0x0
copyvar 0x8000 0x800D
compare 0x800D 0x0
if 0x1 goto @repel
compare 0x800D 0x1
if 0x1 goto @superrepel
compare 0x800D 0x2
if 0x1 goto @maxrepel
compare 0x800D 0x3
if 0x1 goto @exit
release
end

#org @exit
release
end

#org @1
= Repel's effect wore off...\pUse another?

#org @repel
checkitem 0x56 0x1
compare 0x800D 0x1
if 0x4 goto @rp
msgbox @notenough 0x6
release
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 @superrepel
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 @maxrepel
checkitem 0x54 0x1
compare 0x800D 0x1
if 0x4 goto @mp
msgbox @notenough 0x6
release
end

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

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

Here's how to apply it. First, you must grab hold of XSE, and this tool: http://www.pokecommunity.com/showthread.php?t=335308, and of course, a clean Emerald ROM.

Open your ROM with Complete Multichoice Box Editor and XSE. Copy this script in XSE. And, in CMBE, expand or edit one of the choices, to

Repel
Super Repel
Max Repel
Exit

Save it. And compile the script. Fire up your hex editor, and navigate to where you implemented your repel system, and copy it, then go to 2A4B2A, and paste it there.
And, if you have some questions, or you found some bugs, just PM or VM me.

PS: Here's a pic:
iIBvJNQ.png


edit: btw, I copied some parts from Dark Sneasel's script. So, some of this, is to him.
 
Last edited:

PoK3Matr1x

A ROM Hackerino ( ͡° ͜ʖ ͡°)
30
Posts
9
Years
HxD (the hex editor i use) Says it cant find any of those offsets, even if though i tried searching it using hex, dec, and oct. (e.g. it says The file does not contain that offset when i search 080830CA)
 
3,044
Posts
9
Years
HxD (the hex editor i use) Says it cant find any of those offsets, even if though i tried searching it using hex, dec, and oct. (e.g. it says The file does not contain that offset when i search 080830CA)

In HxD press CTRL + G and then type in that offset minus the 080 at the beginning.

Any chance this could work on Sapphire as well?

Nope.
 
46
Posts
9
Years
  • Age 32
  • Seen Dec 16, 2015
Can anyone confirm if the compiled script in the first post actually works? No matter how many times I do this, following every step to a tee, I get a gibberish string of "qAF" that freezes the game.


EDIT: Ok, compiled my own script and the proper message comes up, but clicking "yes" freezes the game. For simple hex edits, this feature is obscenely annoying to get working. It's gotta be something with the "callASM" command right?
 
Last edited:
1,344
Posts
14
Years
  • Seen Dec 10, 2021
Can anyone confirm if the compiled script in the first post actually works? No matter how many times I do this, following every step to a tee, I get a gibberish string of "qAF" that freezes the game.


EDIT: Ok, compiled my own script and the proper message comes up, but clicking "yes" freezes the game. For simple hex edits, this feature is obscenely annoying to get working. It's gotta be something with the "callASM" command right?

I've never had any problems with it. Are you sure you repointed the script at 0x083100 correctly?
 
46
Posts
9
Years
  • Age 32
  • Seen Dec 16, 2015
I've never had any problems with it. Are you sure you repointed the script at 0x083100 correctly?

I compiled the script to 74B8B4. I've tried every combination at 083100 to make sure (I've used 74 B8 B4 08, B4 B8 74 08, 75 B8 B4 08, B5 B8 74 08). What should go there?
 
22
Posts
9
Years
  • Age 26
  • Seen Feb 1, 2020
I want to do this in a spanish ROM but I when the repel finishes, my game restart. I find my game offsets and I tried to modify the ASM routine, but it still no works, can anyone help me?
PD: can anyone give me the routines dissasebbled?
 
Back
Top