• 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
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.
 
Last edited:

ZodiacDaGreat

Working on a Mobile System
429
Posts
17
Years
Uh, level scripts are out of the picture here XD And as for the routine, I don't thinking hacking the keypress routine is a good idea. Anyway, here's my idea... Who know's you might see one in Pure Gold too ;)

Part 1 - We hack the sprite loading routine and load a extra sprite... But not just anywhere :P This sprite should be the last, as Map overworlds might overwrite this. Then, we hack a routine that's executed a lot. What this routine does, is:
1) Check for a flag - A flag must be set meaning that the sprite can follow the player.
2) Check the party - To see if the overworld (Pikachu, or what so ever) is in the party.
3) Other checks - whether Pikachu has evolved or not and so on...

Should any of these previous checks fail then the sprite does not appear and follow the player. But once the conditions are fulfilled, the routine will take the player's position and calculate it for the overworld, so it'll be following it.
 

interdpth

I've seen things, man.
275
Posts
19
Years
  • Seen Jun 8, 2021
The games all have a function which happens everytime you take a step. Like the check for poision or an egg hatching happens in this function I have the offsets for FR/LG. So if you could hack the function and throw a script execution in, this would enable you to have following pokemon.
 

Co500

Nostalgia Edition
563
Posts
15
Years
What about if someone find the script or asm or evel script in yellow and translate it to the newer GBA generation?
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
What about if someone find the script or asm or evel script in yellow and translate it to the newer GBA generation?
You can not do that, nuff said.



Well, his script is... interesting at best, at least in this context.
I've had a script written out that was quite long indeed, it worked almost exactly like this, only I hadn't thought to use the movesprite command.

The problem is, you have to take into account other sprites on the map, small cliffs the player can jump off of, and things like that.
And no doubt we want to be able to supply this to hackers NOT using JPAN's Hacked Engine.

(Very possible, as we can just as easily check what button the player is pressing by comparing to a number found in a certain area of the RAM. (I knew what it was, but my memory has gotten a bit rusty, haven't gotten so fired up about hacking in a long time. (That is why I am going to post, and contribute a lot to PC's R&D department, lol)))

Anywho, I like Zodiac's idea a lot, and I like interdpth's too... problem is, actually hacking the routine's needed.
I wish I could help with that, WHEN ARE YOU GUYS RELEASING ANOTHER ASM TUT?!?! lol

So, are we going to take interdpth's route? If so, I'll get writing... I've made the script once before, no harm in writing it again...
 
Last edited:

colcolstyles

Yours truly
1,588
Posts
15
Years
I believe that the key register is located at 0x4000130. In my opinion, interdpth has the best idea. If he has the address of that routine, we can examine it. Otherwise, I guess just run a ROM with VBA-SDL-H and put a breakpoint on 0x4000130 and try to locate that routine. davidthefat also makes an excellent point about the location of the hack; we don't want to put it before anything important such as collision detection or behavior data like, as 0m3GA said, those ledges that the player jumps over.
 
Last edited:

interdpth

I've seen things, man.
275
Posts
19
Years
  • Seen Jun 8, 2021
here's the function

SAME FOR FR/LG

Spoiler:
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
here's the function

SAME FOR FR/LG

Spoiler:

Sweet
I think that if one were to branch off into the movement of a second sprite, it would be important to do that, BEFORE the Poison and Egg Checks.
I don't know if it would make any difference, but if the second sprite moves after an egg hatches, then would the second sprite move? Or would it sit there, and end up de-syncing with the player?

Also, I have East Asian Language Suppourt on for programs, so any letters that aren't normal, show up as Chinese... what is "EachStepTests+7Cr"
But more importantly, what is the +7Cr thing?
All I see after the C is a strange box that looks like...
___
|00|
|18|

Sorry for the crappy ASCII representation...
 

JPAN

pokemon rom researcher
104
Posts
15
Years
  • Seen Jul 2, 2016
The games all have a function which happens everytime you take a step. Like the check for poision or an egg hatching happens in this function I have the offsets for FR/LG. So if you could hack the function and throw a script execution in, this would enable you to have following pokemon.

I have recently developed for my engine a hack that allows you to activate a script every time you take a step. Oddly enough, it was inspired by the two subjects on this section, the RNG-generated weather and the Follow me scripts, both requiring level scripts and only able to be executed once each map load.
Anyway, after some testing, that caused some problems that quickly become bothersome, like the fact waitmovement is a blocking function, and every step you need to wait for the other OW to follow you. That creates a form of lag that is slightly irritating, as walking has to stop each step it takes, and running is nearly impossible. I won't even get started with the bike... So, my approach was trying some of the other possible walking actions, like trainer events, but halt me nontheless. What I think is, by altering Waitmovement (or creating a spinoff) so that we have a movement-applying function that doesn't block us, it might be possible.

The other option, a level event, has so many checks required that the script would be gigantic. Remember that, with your custom moving around, you also need to check for movement permissions, behaviour bytes, wild battles, activate animations, call scripts, warps... And it must be the same one for all maps. In other words, you would have to script the game engine.

(Very possible, as we can just as easily check what button the player is pressing by comparing to a number found in a certain area of the RAM.
There are several locations with the Key configuration, but the most important here would be the game ones, located at 03003118, 0300311a and 0300311c. the difference between them is that 118 keeps a real keymap at all times, where 11a keeps only instant-keymaps (key presses, not key holds), and 11c keeps a keymap where in-game options were applied(like R = A). Because I don't know where the keys are found in-game other than in FR, 0x04000130 is the GBA location, but keep in mind the keys here are inverted, that is 0x3ff = no keys pressed.
 

ZodiacDaGreat

Working on a Mobile System
429
Posts
17
Years
interdpth said:
It's supped to be an up arrow xD
lol, yeah that's IDA Pro :P Anyway, I believe all games have a step counter or something, it increments every time the player takes a step.
 

HackChu

I need a haircut...
674
Posts
17
Years
JPAN is right I have thought of all kinds of scenarios for my yellow hack not even would you worry about a pokemon follow you but a script would be needed to make sure if a pokemon is deposited the ow would disappear and stuff, in other words ALOT of scripting needed for this and lets not start on backsprite recognization.
 
5,256
Posts
16
Years
HAI Y DONT U ASK PKMN LEEG CHMP BECOZ GREEN SAFIRE HAS IT!!!!!!!!!!!!!!!!!!!!!!!!!

-cough-

Good luck on this, guys. It's a shame I have hardly any knowledge in ASM/hex, but you know JPAN's hack has key recognition? I'm unsure if it's possible, but couldn't you manipulate it so that if START or SELECT or whatever, the OW comes out and then the script is executed or something? I don't know - the idea doesn't contribute much, I know, sorry. D:
 

Pokepal17

More cowbell~
1,519
Posts
15
Years
Guys there's a "copy player" movement in Advance Map. Now I was able to make some sort of following from that but I think the ASM of that movement could be the key for this. The only problem is that when you push against the OW, the OW will move away a bit. Now I'm wondering if the routine could be edited then it'd work right. But then we'd have the depositing and entering maps to try and figure out. So, I think if we focus on the following and worry about the other bits later, this could be acheived. ;)
 

davidthefat

I Love C++
437
Posts
14
Years
  • Age 30
  • Seen Mar 3, 2012
I might have a solution for the map to map transition, make it OK for the pokemon to be on the same tile as the player but never 1 away from it. So make it if the player did not move, the poke does not move either, just dont check for collison for the pokemon, only player
 

interdpth

I've seen things, man.
275
Posts
19
Years
  • Seen Jun 8, 2021
Map to map transition is easy, just create the sprite virtually via a script! :)
 

Omega Zero

Is back...
444
Posts
14
Years
Well as Full metal said that the reason giga universe's script isn't letting him interact with anything and Full metal said it was cause the game is checking for button presses
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
Map to map transition is easy, just create the sprite virtually via a script! :)

Whenever I tried it didn't work as I thought... would it work? Could we make it tangible so we can talk to it?

Well as Full metal said that the reason giga universe's script isn't letting him interact with anything and Full metal said it was cause the game is checking for button presses

Not exactly, he is stuck in an eternal loop...
 
Last edited:
Back
Top