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

534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Umm... Well, how do I do that? Do I still have to compile the script on the first page or just edit the bytes where I'm gonna compile it?

OH MY GOD... O-o It worked YAY! thanks dude! I love you! Can I make a patch for this?

This is it right? ZOMG
YayitWorked_zps33e8764f.png


Now onto Ruby!
 
Last edited:

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Umm... Well, how do I do that? Do I still have to compile the script on the first page or just edit the bytes where I'm gonna compile it?

OH MY GOD... O-o It worked YAY! thanks dude! I love you! Can I make a patch for this?

This is it right? ZOMG
YayitWorked_zps33e8764f.png


Now onto Ruby!
I'd rather if you didn't make a patch. Think of how much you learned from doing this. Don't you want others to learn the same?

Good work, though. :)
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Actually it's for personal use. Just so when I make a new Fire Red Hack I can implement it immediately without editing another byte. I just asked if it's okay because it's your property since you made it.

Also, IT IS possible for Ruby right? Can you tell me how I will research on it? I might actually look this up.
 
Last edited:

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Actually it's for personal use. Just so when I make a new Fire Red Hack I can implement it immediately without editing another byte. I just asked if it's okay because it's your property since you made it.
It's public property once I post it here.
Also, IT IS possible for Ruby right? Can you tell me how I will research on it? I might actually look this up.
Of course it's possible. You will need to do a lot of research in to ASM before you'll be capable of doing it, though.
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
It's public property once I post it here.

Of course it's possible. You will need to do a lot of research in to ASM before you'll be capable of doing it, though.

Well right now, I know the basics. Learning a few advanced.
 
Last edited:

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Well right now, I know the basics. Learning a few advanced.

Also one more thing, a little off-topic.
Do you know how I can implement the physical/special split of attack in Ruby? Also the new attacks? Is it through ASM? Sorry just wondering and hoping you know it.
I think someone already ported that to ruby? Either way, it requires the same stuff as porting this. You need to be able to do several things:

  1. Understand what needs to be done and be able to structure code.
  2. Be able to locate/understand functions or write functions that do what you need to do.
  3. Be able to locate somewhere to put your code so it runs.

Either way, it's not easy. It's taken me years to be able to do this stuff. You need to go to the Tutorials section and do some ASM tutorials. Before you can find and use code effectively, you need to be able to write it in the most simple forms.

Follow some tutorials and then PM me. But don't post in here about off-topic stuff because it makes everything look messy.
 

dkp

18
Posts
11
Years
  • Seen Mar 15, 2016
So, I've been testing this out out of late, but I keep running into the same error:

All of the repels seem to have their effects corrupted. The text pulls up fine, the item gets "used", the script seems to work fine. However, whenever I attempt to implement this somehow the repel effect itself seems to stop working.

So say I'm testing it out; I go into the bag and use a repel. The text "Leaf used a Repel" pops up, the number decreases, all normal. But if I then walk into the grass or over water or what have you, I still get wild encounters. Despite still getting wild encounters, once I walk 250 steps or so, I get the right message; it asks me to use a repel, and if I say yes, it subtracts one from the bag until I have none. But even still, I get wild encounters.

May I ask which offset controls the wild encounter altering behavior for the item? Or if that's even changed at all by this (a problem on my end)? (or what part of the script)? While I've checked and rechecked it might be a copy error, though I don't think so.

I've used both a greatly hacked BPRE v1.0 rom and a clean one (though for the clean I did use thethethe's Item Editor via Gamer2020's Pokemon Game Editor to change the price, and A-Map and XSE to insert a shop/sprite in Pallet to make testing easier; this is after the offsets were changed; if there's a problem with this method I'm unaware of it would be nice to know).

Thanks for any help offered.
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Yes, naturally... Unfortunately, it seems to be interfered with by what I've got going already... pity. Brilliant though. Now I just need to track down what's wrong.

Based on your post, I guess you've already started progress on your ROM am I right? If so, and you want to keep your progress and at the same time fix the problem, follow this:

Spoiler:
 

dkp

18
Posts
11
Years
  • Seen Mar 15, 2016
Sorry to keep polluting this - I think I figured it out.

My clean rom seems to have some weird permission/write errors from getting shared between multiple users (me and me and also me). Effectively it seems I have permissions over some sectors within the directory but not others; I don't even know how that works, I'm guessing. It wasn't returning errors due to the fact that the actual rwx flags are true for me but it seems some parts are read-only. It's... nonsense, absolute nonsense. I made a copy into my current working directory and it seems to have done the job. I'm going to pave over the directory, maybe the partition. So... yay? For the record, this is something that's usually the result of improper mounting and unmounting; always eject your cards at the software level, kids!

The hack base obviously I should have known. The mistake was stupidity on my end. I'm "borrowing" (for private use) an item hack from someone else, and somewhere along the line the effects were repointed, and the author (at absolutely no fault of his own) neglected to say so in his patch. I'm simply a huge idiot. So huge. Sorry about this.

tl;dr its all my fault folks


EDIT: Actually, no, that makes no sense. The items are the same - they're read from the table just the same. It points to the right asm routine (I know this because JPAN here: http://www.pokecommunity.com/showthread.php?t=204861 ); and that asm routine is as posted. All of the edits are positively correct. I know it's reading that item as repel, so then... What? I know for a fact that the only changes to the wild pokemon come from A Map... it makes no sense why I'm still having wild encounters.

I mean it is reading the asm, and I actually do know for a fact nothing has been done to the wild encounter code. So there is no reason it should malfunction, dirty rom or not.


@gogojjtech below; Oh wow. Wow wow. You learn something new everyday.

tl;dr still all my fault folks. But wow.. amazing.
 
Last edited:

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
The repel slows the rate of WEAK wild pokemon, so the first pokemon in your party must be a HIGHER level than the wild pokemon or they will just keep coming out. This is not a result of the byte changes but thats how the repel is supposed to act.
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
For anyone who will try to do this, I modified the script a bit for errors.
Code:
#org @Main
lock
checkitem 0x800E 1
compare LASTRESULT 0x1
if b_>= goto @ThereAreMore
msgbox @RepelExpired 0x3
release
end

#org @ThereAreMore
msgbox @UseAnother 0x5
closeonkeypress
compare LASTRESULT 0x1
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?

And here's the compiled version of it
Code:
6A 47 0E 80 01 00 21 0D 80 01 00 06 04 6C A2 71 08 0F 00 89 A2 71 08 09 03 6C 02 FF 0F 00 A4 A2 71 08 09 05 68 21 0D 80 01 00 06 01 82 A2 71 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
 
Last edited:

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
Omg thank you!!!!!!!!! This is really nice in the fire red rom I play on my ipod!!! Thanks!!!!!!!
 

El Diabeetus

Amateur Voice Actor / ROM Editor ('Hacker')
1,064
Posts
17
Years
  • Age 30
  • Seen Jun 10, 2020
I've tried putting these scripts into both my hack and an unedited ROM, I keep ending up with the script technically working in XSE, but in game it's still only goes to "Repel's effect wore off." without the option to choose whether you want to use it.
 

Tide

Nocturnal ROM Hacker
59
Posts
12
Years
So, this new feature really fascinated me, as it was one of my favorite aspects of convenience in Black and White. I gave this process a few tries, and I came up with the same result. I use a Repel, and when I run enough for the repel to expire, no script pops up at all.


(http://www.youtube.com/watch?v=JVnRVfGm4Tk)​

I figured it'd be most efficient to just capture everything I did, that way anyone can see my mistake rather than me misinterpreting in a tedious conversation on knowledge I am unfamiliar with. Therefore, I made a 3 day conversation to a 12 minute video.
 

The Shiny Ho-Oh

Golden Bird
47
Posts
13
Years
I need some help with this. I have everything done, but I don't know how to put a pointer at 08083100.
Currently, when I use a repel, I can run for a while, then it ends without giving me any message boxes.
So, I've been getting a little bit of help with this. Turns out, I wasn't doing the pointer correctly. I needed to write it 67 45 23 01 as opposed to 01 23 45 67, however, even after doing this correctly, it appears that things aren't going right. I still get no popup, and Pokemon start appearing after the repel runs out.


Jesus. I talked to my programming teacher about this today, and he and I spent about an hour getting this working. Worth it.
 
Last edited:
25
Posts
12
Years
  • Seen Aug 25, 2017
I had some Problems researching the offests for a german Fire Red Version, even though i was pretty sure i got them (i was not sure at two or three offsets), the game resets every time after i use a Repel.
Could you post the Offest for a german rom, too?

Vizor
 

El Diabeetus

Amateur Voice Actor / ROM Editor ('Hacker')
1,064
Posts
17
Years
  • Age 30
  • Seen Jun 10, 2020
This is the most recent attempt I have at this, I attempted editing it. I changed all the necessary parts and the message doesn't pop up. I have the pointer at 083100 as cbba1b to reflect the offset but in reverse.

'-----------------------
#org 0x1BABCB
lock
checkitem 0x800E 0x1
compare LASTRESULT 0x1
if 0x4 goto 0x880001C
msgbox 0x8800039 '"Repel's effect wore off."
callstd 0x3
release
end

'-----------------------
#org 0x80001C
msgbox 0x81C68F2 '"Repel's effect wore off...\nUse ano..."
closeonkeypress
compare LASTRESULT 0x1
if 0x1 goto 0x81C6A02
end

'-----------------------
#org 0x1C6A02
callasm 0x81BFB69
end

'---------
' Strings
'---------
#org 0x800039
= Repel's effect wore off.

#org 0x1C68F2
= Repel's effect wore off...\nUse another?

EDIT: Did it again, when the steps are up instead of the message popping up, it sends me to the Union Room, I get an error message and the game restarts.

EDIT 2: Pointed it somewhere else. It's almost there. It works sort of, if forces me to use the next Repel instead of giving me the choice.
 
Last edited:

rhettz_emboar

Did you just pee??
66
Posts
11
Years
I may sound too noob here, but how can I do this?? >_<
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.

I went to 083100 on HxD but I dont know what to do next. If how can I replace the pointer with the pointer on my script.

Also, where should I paste this?
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
 

ShyRayq

Unprofessional Unprofessional
1,856
Posts
16
Years
  • Seen Mar 26, 2024
I may sound too noob here, but how can I do this?? >_<


I went to 083100 on HxD but I dont know what to do next. If how can I replace the pointer with the pointer on my script.

Also, where should I paste this?

Okay, so you paste the script into free space, basically anywhere that has loads of FFs.
Now, take the offset that you put the script in. For this example it will be 0xABCDEF.

Now go to 0x8083100, and replace that pointer with your pointer.
In this case, you split your offset into parts of 2: AB CD EF
Swap the first and last terms: EF CD AB
Then slap 08 on the end. That's your pointer: EFCDAB08
Replace what is at 0x8083100 with your pointer and it should work.
 
Back
Top