• 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

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
I played around with the modified mimic function Shiny Quagsire posted, and, correct me if I'm wrong, but it will only follow you a short distance? It'll go across routes, sure, but it's limited by steps.

NPCs have a movement-distance variable (right under movement type in Advanced Map, which I put as the first 'Mirror Player' there - that's the correct one, right? Worked anyway.) in XY format I think, so I guess the max any NPC can go is the movement value FF, or 16 y and 16 x. That's as far as I was able to make it go.

If you go far enough away from the NPC, they teleport back to their original position, and for me at least go kinda bonkers when you go back to retrieve them. So you could spam NPCs at a far enough distance from each other to hax it into longer distance, or less spastically put some kind of periodic script to mod the movement-type/start-pos of the NPC following you? o_0 Or a combo of the two, which sounds more feasible if it's a small hack and you, say, only have the NPC following you around for a short while/area anyway. Although it seems like there should be a way, since the NPC seems to check how far it's gone since the origin point, to silently find and ASM repoint that origin as you move along so the NPC never runs out of space to roam from the origin. If it's just one var, it shouldn't be too lag inducing. Maybe I'm completely wrong and that isn't how NPCs move, or maybe since the origin is hardcoded and probably not used as a temp var you'd just have to get the NPC to stop looking for the origin altogether rather than repointing it.

If there's a way to make NPCs move further and I'm just ignorant and blathering about nothing, please correct me, I'm a newbie.

Yeah, you can't move them outside that boundary box, as it's built into the collision detection. The NPC literally views that box as a solid wall, meaning they're unable to pass through it. So I just rewrote part of the collision detection for this behaviour.

I've made significant progress on this, so I thought I would share that with you (some of you have been waiting 4 years for this O.o). Following (pun not intended) on from shinyquagsire's idea of reusing the behaviour byte, I've got basic following working. This means you can walk and run around with a follower and you won't lose them. Right now, there are significant bugs, because I haven't finished all of the code.

Let's start off with what DOESN'T work

  • Bumping into NPCs and water, maybe some more things (laziness, haven't finished collision detection)
  • NPCs can walk through the follower, but this was because I was lazy with my collision detection again
  • Biking
  • Surfing
  • Warps
  • Applymovement

However, let's go over what does work
  • Walking around
  • Running
  • Map connections
  • Regular height based collision
  • Scripts on the following NPC
  • The player can walk through the NPC
  • Ledges

Whether the last point is working or not is debatable; the ledge jumping is really ugly, as the follower just kinda walks over it. I tried a number of things, and finally settled on this approach. The reason for this is because the regular "hop" animation takes twice as long as walking two steps takes, which means you'll always lose the follower if you hold down. To fix this, I just made the NPC walk 2 steps while you're jumping. This means you don't lose the follower, but if you take a break at the bottom of the ledge they will just sit on the ledge and it'll look weird.

Anyway, I'll be uploading a video shortly, showing all of what does and doesn't work.

EDIT: No video yet, because VBA hates me

Collision detect, which is the last big obstacle in the way of completing this, has been fixed :D
 
Last edited:
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
Sweet! So it was collision detection that made the NPC only follow a short distance and that's fixed? Neat.

The surf/bicycling issue wouldn't be much of an issue for people who don't want the character to follow you while you surf and such; imma thinking of Yellow remakes here where Pikachu just disappeared when you did that anyway. Of course, maybe I'm just over-eager to play with this. One'd still have to have coding to make the char disappear on Surf/Bicycle and reappear if one went that lazy way, like Nintendo did.

I think the ledge jumping is just fine by default, but then I've never had the best nose for aesthetics. Altho' it's weird you say it doesn't hop, because the Pikachu I had following me DID hop over ledges with me, or I swear it did. Perhaps some sprites are built to hop and others aren't? That would be weird.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Altho' it's weird you say it doesn't hop, because the Pikachu I had following me DID hop over ledges with me, or I swear it did. Perhaps some sprites are built to hop and others aren't? That would be weird.

Noone but the main player can hop over ledges, they just dont have those sprites.

Now... if you were building a yellow remake and ONLY 1 sprite (pikachu) followed you ALL the time. yeah just give him some hopping animation and your good.

if ANYONE can follow at ANY time depending on your hacks design, to make them hop you would need to give each sprite that could follow you during the course of your hack hopping sprites...

this is COMPLETELY possible IF the walking script could give the command to allow NPCs to hop... which would have to be written from scratch because it doesnt exist at all.

What I am seeing here is... Touched could finish the script as is (finish all the collision detection) and release it for specific areas where you would want a person to follow you through a room with no water or ledges... or just deal with the ledge issue... or finish it for a single characterr (like yellow version) or you could rewrite all the sprites giving them hopping animation and make it totally universal... sounds like alot of work. just releasing it general purpose without hopping sounds easiest (but of course least useful lol)
 
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
Nooo, I'm not making this up! I double-checked, and Pikachu hops! In FireRed with the rotation hack, not Yellow. Look, screenie (Sorry, it doesn't like me posting links):

i955.photobucket.com/albums/ae37/ketchupdragon/pikahops_zps81e37f55.png

So maybe I have some weird mutant pikachu, or, some sprites besides the player will hop.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Nooo, I'm not making this up! I double-checked, and Pikachu hops! In FireRed with the rotation hack, not Yellow. Look, screenie (Sorry, it doesn't like me posting links):

i955.photobucket.com/albums/ae37/ketchupdragon/pikahops_zps81e37f55.png

So maybe I have some weird mutant pikachu, or, some sprites besides the player will hop.

thats... nutty. someone must have made them cause its not native to fr. (idk what the rotation hack is) In an unhacked fr pikachu only has 3 actual sprite images. looking forward, backward, and to the side...

but like I said previously, hacking 1 special follower is not such a big deal (like yellow). hacking in the hopping for any possible follower... thats a headache.
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
thats... nutty. someone must have made them cause its not native to fr. (idk what the rotation hack is) In an unhacked fr pikachu only has 3 actual sprite images. looking forward, backward, and to the side...
There are no special sprites for jumping. They're just the walking ones with a shadow underneath. All overworlds can do this. Just look at applymovement.

but like I said previously, hacking 1 special follower is not such a big deal (like yellow)
Let's see you do it then.

Shiny added a rudimentary hop hook, that's why it will follow you over ledges. It makes the follower mimic the player's hopping. This doesn't work at all - I had to rewrite all of his code as it had many bugs. The main issue is timing. The ledge hop throws this all off. Even with my collision detection hack, ledge hopping still causes the follower to be lost.
I suppose I probably will just be lazy and hide the follower when biking/surfing. I'm hardly concerned about that at the moment. If I can finish ledges (I've decided to change how I previously had them) and warping, I'll regard this hack as complete.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Let's see you do it then.

I did not mean it like that. I ment if you simply gave one guy everything the player could do, and just have him globally always follow you. is far simpler than allowing any sprite this ability. You are working for a general purpose follow script so it may be less perfect to opt for more hackers the ability to use it.
 
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
By rotation hack I mean the hack Shiny Quagsire did to make the character rotate properly when mirroring so it'd follow you, sorry.

Hah I feel like an idiot, I just remembered the routine is called 'hophook' and Shiny said they'd made an attempt at hopping... so of course it hops. And playing with it more and having the poke follow behind rather than at your side makes the bugs obvious; Touched you are right, it is broken, the poke will do a hop when you do so it will hop before it reaches the ledge. If the poke always is one step behind your back, then maybe delaying hop movements by one step would work? Or would that just be more bug inducing?

Well, I see I managed to contribute nothing, but thank you for indulging my curiosity about the movement mechanism anyway.
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
By rotation hack I mean the hack Shiny Quagsire did to make the character rotate properly when mirroring so it'd follow you, sorry.

Hah I feel like an idiot, I just remembered the routine is called 'hophook' and Shiny said they'd made an attempt at hopping... so of course it hops. And playing with it more and having the poke follow behind rather than at your side makes the bugs obvious; Touched you are right, it is broken, the poke will do a hop when you do so it will hop before it reaches the ledge. If the poke always is one step behind your back, then maybe delaying hop movements by one step would work? Or would that just be more bug inducing?

Well, I see I managed to contribute nothing, but thank you for indulging my curiosity about the movement mechanism anyway.

What I did was made the follower approach the ledge while you are in the air. The problem arises after you've hopped. You can do one of three things:
  1. Wait at the bottom of the ledge without walking
  2. Continue walking without pause after the jump
  3. Same as 2), but run instead of walk

Now, each of those cases causes a different delay if using the hop animation. The problem is that the Jump 2 step animation takes twice as long as it does to walk FOUR steps normally. This results in NO gap if you wait, a 1 tile gap if you walk and a 2 tile gap if you run. The problem is handling all these cases separately.

You seem pretty capable at inserting ASM, so maybe seeing this in action would be better than me trying to explain it. I've uploaded my work to https://github.com/Touched/FollowMe
It's based of the same mechanism as Shiny Quagsire's. You need to use the copy player behaviour for this to work. Right now, there are some problems with starting up. daniilS informs me that if you place the follower next to where the player appears from a warp and then talk to it before walking following will work. Obviously, I still mean to fix this, but I haven't settled on a way to do that yet.

If you don't know where to insert each hook, check out assemble.py. I use this file to automatically insert the ASM, since there are far to many hooks to do it manually each time I want to test.
Sorry for the lack of instructions. I'll probably fix that soon.

EDIT: Warping works! :D Well, at least my idea works. It doesn't move to the correct position yet :P
 
Last edited:

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
Wow, there's all this progress in a short amount of time.

So now that you've got warps figured out, is being able to move from map-to-map a possibility in the near future?
Haha {XD}

I don't know what you mean by that ~_~. Connections already work 100% if that's what you're asking.
Right now, you can have perfect follow me as long as you don't warp (and jump over ledges ;-;)

Warps are just difficult, because there are so many different types that I have to account for.
 

Teh Blazer

Divider of Zero
776
Posts
15
Years
Haha {XD}

I don't know what you mean by that ~_~. Connections already work 100% if that's what you're asking.
Right now, you can have perfect follow me as long as you don't warp (and jump over ledges ;-;)

Warps are just difficult, because there are so many different types that I have to account for.

In the past I've had trouble with scripts that span over two maps because the overworld from one map wouldn't be the same in the second map. So as soon as I cross over into another map with my npc, they would disappear and I would be left in tears. Just wondering how you found a way around that. :P
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
Walking in Touched's footsteps, I decided to follow his lead and jump in with both feet. Ledges should be completely finished today or tomorrow.

Update: ledges can go jump into a lake. Mewsus Christ I really hate them.
 
Last edited:
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
Ah, didn't Touched say they got ledges working daniils? So you can relax, it's done. ^_^ It seems to work a lot better now from what little I've played with it.

Anyway, I'm afraid I'm still quite a newb at ASM, so I was only able to figure out inserting a few of the hooks -embarrassed-. I figured out the free space for the actual functions, and where the hooks are supposed to go ( the second hex you provided in that hook function in your py script right?), but, ehh, kinda got muddled on the actual hooks. Instructions would definitely be nice.

But, I got the movement one, the collide one, and the ledge one, and they seem to work pretty good (for, you know, being only half the script)! Only, and I'm sure this is probably a result of me being bad at inputting things, I got a weird bug where when my meowth follower jumped after me, they temporarily turned into a Seel instead for the duration of the jump! They turned back into a meowth immediately after.
 
Last edited:

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018


GoGo has kindly recorded a video of my current Follow Me implementation in Platinum Red/Blue
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years


GoGo has kindly recorded a video of my current Follow Me implementation in Platinum Red/Blue

Wow, good job touched. Does this support warps 100% and is the no collision what so ever still a thing?
 

Touched

Resident ASMAGICIAN
625
Posts
9
Years
  • Age 122
  • Seen Feb 1, 2018
Wow, good job touched. Does this support warps 100% and is the no collision what so ever still a thing?

Thanks. Warps are still an issue: I can get the follower to move but there are a huge amount of checks that need to be done to reposition it properly. Connections and collision work 100% though. In its current state it is perfect for a short follow me like in Platinum.
 

Yvtq8K3n

muhaha
91
Posts
9
Years
Im working on emerald and also would like know if is possible to do it on emerald.
If you could give the script would be great.
 
Back
Top