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

BLAx501!

Pokemon Flux
80
Posts
10
Years
if you're using Windows you'll have to go to hell and come back to build it though.

Yay, Linux :D

It's nice to read how two great RomHacking developers work together. It looks pretty well, thanks for the hard work :D

P.S. When are you going to do a tutorial for C programming on Fire Red? I'd love to learn that way :D
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
P.S. When are you going to do a tutorial for C programming on Fire Red? I'd love to learn that way :D

Shinyquagsire sort of has a guide how to do intros in C. I might do one since the process has been refined significantly since then. There is just so much that is different from regular C that I'd rather start by assuming the reader knows basic C (there are plenty of great resources on the internet and C is a great language to learn if you're at all interested in programming) and just highlight the differences. The other problem is that you still have to work with ASM for hooks and other places where very specific instructions are required. However, Since the ASM literacy is still very low (and I'm not sure how much interest people have, my tutorial got like 0 reads), a C tutorial doesn't seem to have that much value.

Obviously I'd be happy to explain how to set up a project to individuals, though.
 

Splash

But nothing happened.
658
Posts
14
Years
Shinyquagsire sort of has a guide how to do intros in C. I might do one since the process has been refined significantly since then. There is just so much that is different from regular C that I'd rather start by assuming the reader knows basic C (there are plenty of great resources on the internet and C is a great language to learn if you're at all interested in programming) and just highlight the differences. The other problem is that you still have to work with ASM for hooks and other places where very specific instructions are required. However, Since the ASM literacy is still very low (and I'm not sure how much interest people have, my tutorial got like 0 reads), a C tutorial doesn't seem to have that much value.

Obviously I'd be happy to explain how to set up a project to individuals, though.

That can't be write I myself have been reading your tutorial touched.. It can't have 0 reads O.o
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
That can't be write I myself have been reading your tutorial touched.. It can't have 0 reads O.o

Oh, that's good to know. I was just judging by the lack of feedback (replies to thread, etc.)
 

Deokishisu

Mr. Magius
990
Posts
18
Years
If you have certain requests or ideas let us know. The project is open source at Touched'd github if you're using Windows you'll have to go to hell and come back to build it though.

I'd like the option for follow me to have certain features from Yellow Version, specifically an easy way to disable/hide the follower and prevent interactions while surfing and biking (which I'm sure can already be done), the follower doing the same little dance that Pikachu did when you had it waiting on top of a ledge (flavor fun!), getting bored and stepping in place/looking around randomly or (counter)clockwise/etc. after a certain amount of idle time, and (I assume this is already a thing) easy ability to manipulate the follower from scripts that are not assigned to it like any other person event on any other map. ...How is that done, by the way? Like, what is the follower's person event number on the maps that you warp to? How is the game even handling spawning the follower on map change?

This is super impressive work, though. Thanks for doing this for the community!
 
Last edited:

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
I'd like the option for follow me to have certain features from Yellow Version, specifically an easy way to disable/hide the follower

The follower is an NPC, so I assume you can just set the flag assigned to the NPC to hide it. Also, you could use an applymovement script using movements 0x60 and 0x61 to hide and show it, respectively. Also there are other commands like showsprite, hidesprite, spritevisible and spriteinvisible. The last two are the same as the applymovement script.

and prevent interactions while surfing and biking (which I'm sure can already be done),

I plan to have follower "modes". For Pokemon, it makes sense to have them go into a Pokeball or something, but for people, it would make more sense for them to get on a bike or something. You should be able to toggle the mode using whatever scripting interface we provide (probably a special or a custom command).

the follower doing the same little dance that Pikachu did when you had it waiting on top of a ledge (flavor fun!), getting bored and stepping in place/looking around randomly or (counter)clockwise/etc. after a certain amount of idle time, and (I assume this is already a thing)

As the follower is already and NPC, you can just give it the "look around" behaviour and it will do that. I might be able to change the behaviour if it's waiting to jump over a ledge, but I don't really know if that has much use outside the scope of Yellow remakes.

easy ability to manipulate the follower from scripts that are not assigned to it like any other person event on any other map. ...How is that done, by the way? Like, what is the follower's person event number on the maps that you warp to? How is the game even handling spawning the follower on map change?

We're gonna give the follower a special ID like the player and camera so you can use the standard commands. Probably something like 0xFE. I have had people tell me that is for the camera though (I always thought that it was 0x7F, but whatever), so I'll have to investigate this more. The follower does copy the player automatically though, so you'll have to use the special/command to stop following before you try applymovement on them though.
 
5,256
Posts
16
Years
Oh, that's good to know. I was just judging by the lack of feedback (replies to thread, etc.)

A lack of replies just means it's so well explained nobody has any further questions :P

But yeah I would also definitely be very interested in a C-for-hacks tutorial (I agree the assumption of basic C makes sense, too). Great work on the follow-me stuff!

I'm also pretty sure 0x7F is the camera, so I don't know why 0xFE would also be used by it.
 

Blah

Free supporter
1,924
Posts
11
Years
Ability to manipulate the follower from scripts that are not assigned to it like any other person event on any other map. ...How is that done, by the way? Like, what is the follower's person event number on the maps that you warp to? How is the game even handling spawning the follower on map change?

Yeah, that's already possible since the follower is an NPC in a set map. How is works is basically, we made a super-awesome version of showsprite which can spawn any NPC from one map onto another. From there, is was mostly about handling edge cases.

Also, showsprite x, y is not what it's documented to be (yay for XSE's false documentation!). Anyways, I made one in ASM to do just that. Touched modified it to use SP instead of malloc, and that's what is being used right now.

bleh, it's not designed to be used by a script right now, it's made to be used by another routine, sorry! Basically, all you'd need to do is make a routine to set the parameters appropriately and call this.

Code:
.text
.align 2
.thumb
.thumb_func

@r3 arguement is a word
@first half = x pos
@second half = y pos

main:
	push {r4-r7, lr}
	mov r4, r8
	mov r5, r9
	mov r6, r10
	push {r4-r6}
	sub SP, SP , #0x4

npc_rom_data:
	mov r8, r0  @r0 = npc ROM ID
	mov r9, r1  @r1 = npc bank number
	mov r10, r2 @r2 = npc map bank
	mov r7, r3  @r3 = X and Y pos
	ldr r4, =(0x805FD5C +1) @NPC data from ID and map
	bl linker
	
copy_npc_data:
	mov r5, r0
	mov r0, #0x18
	ldr r4, =(0x8002B9C +1) @malloc
	bl linker
	mov r1, r5              @src
	mov r5, r0              @dest
	mov r2, #0x18           @size
	ldr r4, =(0x81E5E78 +1) @memcpy
	bl linker
	mov r0, r5
	
set_personalized_xy_pos:
	mov r2, r7 
	lsr r2, r7, #0x10
	strh r2, [r0, #0x4] @x pos
	lsl r2, r7, #0x10
	lsr r2, r2, #0x10
	strh r2, [r0, #0x6] @y pos
	
instanciate_npc_by_ROM_data:
	mov r0, r5   @NPC Data
	mov r1, r9   @Map number
	mov r2, r10  @Map Bank
	mov r3, #0x0 @x value to add to pos
	str r3, [SP] @y value to add to pos
	ldr r4, =(0x805E72C +1)
	bl linker
	mov r6, r0
	mov r0, r5
	ldr r4, =(0x8002BC4 +1) @free
	bl linker
	
end:
	mov r0, r6
	add SP, SP, #0x4
	pop {r4-r6}
	mov r8, r4
	mov r9, r5
	mov r10, r6
	pop {r4-r7, pc}
	
linker:
	bx r4
	
.align 2

Have fun :0
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
We all know what this is, so I'll cut to the chase. This is basically fully working - an example can be seen in GoGo's hack, Platinum Red (and eventually Blue). This is basically all we have so far:



The code for doing this has been open sourced, and is available on my GitHub, here. You're welcome to fork and send me pull requests if you have anything to contribute. Any bugs or issues should also be reported on GitHub rather than in this thread.

I will post build instructions soon.

Hello, after installing what is in your github, what will I do after? How do I make the OW follows you, it's okay if it can be used only in 1 map and cannot be used permanently. Thnks for response
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
Hello, after installing what is in your github, what will I do after? How do I make the OW follows you, it's okay if it can be used only in 1 map and cannot be used permanently. Thnks for response

Read the post literally right above yours
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
Hello, after installing what is in your github, what will I do after? How do I make the OW follows you, it's okay if it can be used only in 1 map and cannot be used permanently. Thnks for response

For that follow me you need to set the behaviour for the NPC you want to be the follower to 0x35 (mimic player or something; I forget) in Advance Map. It should work over connections, but won't work properly for most warps.
 
9
Posts
8
Years
  • Age 29
  • Seen Jun 11, 2016
hello, i have a question to a problem with the pokemon essentials DS2.0 and essentials gen 6v1
there are some scripting problems.
exampel the pokemons form me are to big... i use the gen VI pokemons :D
sry for bad english
 
5,256
Posts
16
Years
hello, i have a question to a problem with the pokemon essentials DS2.0 and essentials gen 6v1
there are some scripting problems.
exampel the pokemons form me are to big... i use the gen VI pokemons :D
sry for bad english
Questions regarding Pokémon Essentials belong in its subforum; this thread is for the development of the Follow Me functionality for ROM hacks.
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
For that follow me you need to set the behaviour for the NPC you want to be the follower to 0x35 (mimic player or something; I forget) in Advance Map. It should work over connections, but won't work properly for most warps.

Ahh, thanks for the response, so I'm assuming that the insertion of it is the same as mega evolution, I'll create build folder, open command prompt, type make and insert.py --offset 9437184 --debug.

EDIT:
This is what I did, I changed the rom offsets in assemply.py then load it on command prompt.
I had succesfully installed it, but I had encountered some problem.
12366369_925743207493736_3213711192861882550_n.jpg


That OW keeps on appearing on every map, plus it does nothing. I also set the NPC behavior into 35 which is copy player but when I load it on game, it just disappeared.
 
Last edited:

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
Ahh, thanks for the response, so I'm assuming that the insertion of it is the same as mega evolution, I'll create build folder, open command prompt, type make and insert.py --offset 9437184 --debug.

EDIT:
This is what I did, I changed the rom offsets in assemply.py then load it on command prompt.
I had succesfully installed it, but I had encountered some problem.
12366369_925743207493736_3213711192861882550_n.jpg


That OW keeps on appearing on every map, plus it does nothing. I also set the NPC behavior into 35 which is copy player but when I load it on game, it just disappeared.

You need to comment out this line (put a # at the beginning of the line) and it should work. It might also be using behaviour 0x34 though, I can't remember.

Keep in mind that that repo is not under active development. There is a C rewrite going on but it is incomplete (you can't control which NPC is going to follow you yet).
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
You need to comment out this line (put a # at the beginning of the line) and it should work. It might also be using behaviour 0x34 though, I can't remember.

Keep in mind that that repo is not under active development. There is a C rewrite going on but it is incomplete (you can't control which NPC is going to follow you yet).

okay, I'll try it as soon as I'm on PC
 

PokéMew1

Pokémon Fuchsia
484
Posts
10
Years
I was assembling the code in cmd by typing assemble.py, and got this error:

File "C:\Users\Desktop\FollowMe-master\assemble.py", line 54, in <module>
rom.write((0x2102).to_bytes(2, 'little'))
AttributeError: 'int' object has no attribute 'to_bytes'

What would be the fix for this error?
 
137
Posts
10
Years
  • Age 35
  • Seen Apr 23, 2024
The fix for that error is to stop using outdated versions of Python. int.to_bytes was only added in Python 3; the shebang line at the top of assemble.py indicates it's supposed to be run with Python 3.
 

PokéMew1

Pokémon Fuchsia
484
Posts
10
Years
The fix for that error is to stop using outdated versions of Python. int.to_bytes was only added in Python 3; the shebang line at the top of assemble.py indicates it's supposed to be run with Python 3.

I could have sworn I had 3.4.3 installed. Apparently I removed it at some point.. Well thanks for reminding me of it.
 
Back
Top