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

Development: The Follow Me Script

Full Metal

C(++) Developer.
810
Posts
16
Years
Don't count me out!
I wouldn't even use it for a hack, only for a learning experience; IE To better myself. :)
 

AimayBee

Mighty Spriter
213
Posts
14
Years
...friggin' peer pressure.

Eh, I'll think about it. There's too much PC drama at the moment.

I guess it is peer pressure but people really like the follow me idea.

Even I have a way I could use it in my hack. lol

Also, isn't your post off topic? :P x
 
1
Posts
12
Years
  • Seen Jun 7, 2011
Maybe this can help us with this little trouble:

"02037078 is a structure that controls the movement of, and only of, the player. However it can be associated to any NPC on screen.

The first two bits (0x03) of 02037078+0 determine the speed. 1 is normal. 2 is bike speed. 3 gives you a bike and changes itself to 2.

No matter what you write to 02037078+1 it is set to 0 again. If the value was 2 before the reset you get a bike. If you change the bike-byte the NPC turns into the hero.

02037078+2 and 02037078+3 behave like this:
0 0 Nothing pressed
0 0 Nothing pressed
1 1 Pressed forward
2 1 Pressed forward
2 1 Pressed forward
2 1 Pressed forward
0 0 Nothing pressed
2 1 Pressed forward
2 1 Pressed forward
0 0 Nothing pressed
0 0 Nothing pressed
1 1 Pressed forward
2 1 Pressed forward
2 1 Pressed forward

I don't know about 02037078+4.
02037078+5 sets the npc-id that is controlled by the keypad. (I wonder which numbers the npcs from connected maps have)
02037078+6 locks all movement when set to 1

More info about the NPCs is stored at 02036E38 in 16 0x24-byte long structures (Does that mean that there can't be more than 16 npcs in the overworld at the same time?!)
0x00 bits 7 and 6 are set when this npc is talking
0x01-0x0A unknown
0x0B height
0x0C-0x0F unknown
0x10 from (coords)
0x14 to (coords)
0x18 unknown
0x19 direction (in which the character actually looks)
0x1A unknown
0x1C direction (set when talked to but not always copied to 0x19)
0x1E unknown
0x20 direction (set after talk)
0x21-0x23 unknown

coordinates are saved as two halfwords (x and y)

The code for moving uses a table to convert the direction to relative coordinates.
Table: 083A64C8
Function that uses the table above: 08063A20
Function that uses the function above to move npcs: 0805C4F4

Note that the table contains 9 and not 5 directions. Yes. Game Freak planned to have diagonally moving npcs."

Thanks to Knizz quote in other thread.

I tryed this but the only troubles are that change in
02037078+5 dissapear whit warping or optios menu.

i xpect have contrbute to this theme :)

Maybe this some Knizz have info about the NPC's moves or moving in a map FR

showthread.php?t=205158&page=4 'in this site
showthread.php?t=205158&page=3 'in this site
 
Last edited:

Meta Paradox

Researching FireRed...
56
Posts
12
Years
  • Seen Jul 18, 2011
Yah, about the Hacked Engine. Darthatron's level script for the follow-me thingy can be translated into a normal script, I guess. So compile the script and replace it with JPAN's behavior byte hack to overwrite the behavior bytes' scripts, and voila!

Oh, and yeah, that was merely a suggestion. :D
 

cbd98

A bouquet of oopsie dasies
333
Posts
13
Years
  • Seen Jan 18, 2021
i have an idea... does anybody else remember the old mew from faraway island that would move the same way you did? maybe if you tried edit that script a little, it would work. of course it probably wouldn't, but its a thought
 
228
Posts
13
Years
i have an idea... does anybody else remember the old mew from faraway island that would move the same way you did? maybe if you tried edit that script a little, it would work. of course it probably wouldn't, but its a thought

The Mew from Faraway Island moved exactly like you do, it didn't follow you. For example, if you first go up, and then you go left, the Mew would do exactly the same, instead of going up two times like a perfectly working following script.
 

Full Metal

C(++) Developer.
810
Posts
16
Years
i have an idea... does anybody else remember the old mew from faraway island that would move the same way you did? maybe if you tried edit that script a little, it would work. of course it probably wouldn't, but its a thought

Although it's not quite what we're looking for, it's a good place to look at. We could probably get some info on how to animate the pokemon's sprite and move it along with the player. :)
 

Spiky-Eared Pichu

NDS Hacker/Researcher
257
Posts
13
Years
  • Seen Oct 2, 2019
If my memory doesn't fail, in Route 119 there's the "Mimic Circle". I don't know how the overworlds there are programmed, but they mirror the movements you do while in the grass. We could take a look at how they are programmed, maybe we have an official "follow me" script in front of us and we haven't noticed it. I may be wrong, though. I haven't hacked GBA since long time ago, when I moved to DS. Making a follow me script in DPPt is way easier, as there's a scripting command programmed for its use in the Amity Square.
 

cbd98

A bouquet of oopsie dasies
333
Posts
13
Years
  • Seen Jan 18, 2021
If my memory doesn't fail, in Route 119 there's the "Mimic Circle". I don't know how the overworlds there are programmed, but they mirror the movements you do while in the grass. We could take a look at how they are programmed, maybe we have an official "follow me" script in front of us and we haven't noticed it. I may be wrong, though. I haven't hacked GBA since long time ago, when I moved to DS. Making a follow me script in DPPt is way easier, as there's a scripting command programmed for its use in the Amity Square.

yeah, i think the mimic people move the same way the mew does. but i dont think it would be possible to take the amity square script and move it back a generation. though i havent tried, so idk.
 

AimayBee

Mighty Spriter
213
Posts
14
Years
yeah, i think the mimic people move the same way the mew does. but i dont think it would be possible to take the amity square script and move it back a generation. though i havent tried, so idk.

Would be nice if someone was to post that script on this thread so we can try and convert it. :P

We know people have done the folow me script but aren't telling, so it IS possible.
 

Spiky-Eared Pichu

NDS Hacker/Researcher
257
Posts
13
Years
  • Seen Oct 2, 2019
Would be nice if someone was to post that script on this thread so we can try and convert it. :P

We know people have done the folow me script but aren't telling, so it IS possible.

I work with Diamond and I could post it, but the problem is that it's not a script, it's a command. I mean, it's like one of these commands you use to insert a message box or start a battle. It's coded into the game specifically for the Amity Square, as well as the 5 tag trainers around Sinnoh.

The script works like this:

1. A command draws an overworld in the map for the following Pokémon/trainer (you can do this in GBA easily).

2. A special command sets that overworld to follow you. You can also set a value that enables it to follow you even if you change maps. (Here's the reason of why it can't be ported)

There's also another command which disables the following, and of course there's also one that erases the overworld from the map.
 
17
Posts
12
Years
  • Seen Jun 7, 2018
If someone would learn ASM i think it can be done. But you won't be ever able to convert D/P/Pt scripts to GBA scripts.
 

Full Metal

C(++) Developer.
810
Posts
16
Years
^ Yes, thank you very much for your input. It wasn't obvious at all. :)
Anyways, I've decided to start looking into this myself. I'm really wanting to see this work. Really badly. So, here goes.
First thing I noticed, the player's OW ( OAM ) does not move. It animates, and sets rotation flags, but that's about it ( Which makes sense considering how weird the OAM system is anyways ( ... ) ). Which after a little bit of brain-scratching, I figured out, ohai, the player only looks like he's moving -- it's an illusion! How does that work? The camera moves. :) </rantofnubbliness>
I'm bpw-ing the camera positions ( Credits to this post. )

*edit* Okay, I'm looking at some other stuffs as well.
the camera position is written around the area
08059564
This post looks useful as well, so I'm keeping it on *this* post. haha.
I also have bookmarked a page on the pern project for OAM and sprites information. That should come in handy when I write a routine to actually move the sprite.
**edit2**
Code:
0805945A bc10 pop {r4}                            R00=00000000 R01=0805945b R02=00000027 R03=00000000 R04=00000000 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd0 R14=[COLOR="Red"]0805945b [/COLOR]R15=0805945c
0805945C bc02 pop {r1}                            R00=00000000 R01=0805945b R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd4 R14=[COLOR="red"]0805945b[/COLOR] R15=0805945e
0805945E 4708 bx r1                               R00=00000000 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=08059460
08059554 1c07 add r7, r0, #0x0                    R00=00000000 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=08059556
08059556 1c78 add r0, r7, #0x1                    R00=00000000 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=08059558
08059558 2801 cmp r0, #0x1                        R00=00000001 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=0805955a
0805955A d80d bhi $08059578                       R00=00000001 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=0805955c
0805955C 4805 ldr r0, [$08059574] (=$03005008)    R00=00000001 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=0805955e
0805955E 6801 ldr r1, [r0, #0x0]                  R00=03005008 R01=08059555 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=08059560
08059560 8808 ldrh r0, [r1, #0x0]                 R00=03005008 R01=02025580 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b[/COLOR] R15=08059562
08059562 4450 add r0, r10                         R00=00000003 R01=02025580 R02=00000027 R03=00000000 R04=00000001 R05=00000000 R06=00000000 R07=00000000 R08=00000000 R09=00000000 R10=00000001 R11=00000000 R12=02021737 R13=03007dd8 R14=[COLOR="red"]0805945b [/COLOR]R15=08059564
^ There's a trace I did. Notice that LR is pointing to 0805945b.
I'm now going to look at that code.

***edit 3***

080636f0 1c28 add r0, r5, #0x0
080636f2 1c21 add r1, r4, #0x0
080636f4 f7f5 bl $08059334
080636f8 2101 mov r1, #0x1
080636fa 4249 neg r1, r1
080636fc 4288 cmp r0, r1
080636fe d011 beq $08063724
08063700 1c30 add r0, r6, #0x0
08063702 1c29 add r1, r5, #0x0
08063704 1c22 add r2, r4, #0x0
08063706 1c3b add r3, r7, #0x0
08063708 f000 bl $080638ac
0806370c 0600 lsl r0, r0, #0x18
0806370e 2800 cmp r0, #0x0
08063710 d108 bne $08063724
08063712 7870 ldrb r0, [r6, #0x1]
08063714 09c0 lsr r0, r0, #0x07
08063716 2800 cmp r0, #0x0

The code in red calls the routine that calls the routine 0805945b, and I'm trying to figure out what the value of each of the registers here are.
 
Last edited:
Back
Top