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

[Pokeemerald] Follow Me

Very cool stuff!
I noticed an issue in Pokecenters when healing pokemon, the follower's palettes seem to be affected during the pokeball glowing animation, is there a way to prevent this from happening? Or is it just my project? thanks in advance.

It sounds like you're running into a palette limitation issue. You can only have 16 sprite palettes on screen at a time. So the issue could be coming from having too many characters on the map, or if you're not using dynamic overworld palettes, assigning the same palette slots for your follower as the pokeball healing field effect palette.

But to answer your question, this is unrelated to the follow me code.
 
It sounds like you're running into a palette limitation issue. You can only have 16 sprite palettes on screen at a time. So the issue could be coming from having too many characters on the map, or if you're not using dynamic overworld palettes, assigning the same palette slots for your follower as the pokeball healing field effect palette.

But to answer your question, this is unrelated to the follow me code.

Thanks, I used dynamic palettes to fix my unrelated issue.

I found a few other things with the follower system I was curious about, is there is a way to fix/implement these?
(for reference, I set the follower using the FOLLOWER_FLAG_ALL)
- After using Fly, or the Escape Rope, the follower is invisible, until you enter a new area/building.
- The Follower doesn't dismount bike upon entering buildings when the player does (ex. houses, and Pokecenters).
- The follower doesn't perform the Falling down holes, and warp animations (ex. at Mt Pyre, Flannery's gym, Aqua Hideout).
- the follower's Dive sprite gets bugged after entering other areas and no longer bobbing (visible at the end of the gif you have in the OP).
- Doing side-ways bunny hops on the Acro Bike can cause the follower to lose sync with the player, and get stuck on a higher elevation in mid air.

Thanks for your time!
 
Thanks, I used dynamic palettes to fix my unrelated issue.

I found a few other things with the follower system I was curious about, is there is a way to fix/implement these?
(for reference, I set the follower using the FOLLOWER_FLAG_ALL)
- After using Fly, or the Escape Rope, the follower is invisible, until you enter a new area/building.
- The Follower doesn't dismount bike upon entering buildings when the player does (ex. houses, and Pokecenters).
- The follower doesn't perform the Falling down holes, and warp animations (ex. at Mt Pyre, Flannery's gym, Aqua Hideout).
- the follower's Dive sprite gets bugged after entering other areas and no longer bobbing (visible at the end of the gif you have in the OP).
- Doing side-ways bunny hops on the Acro Bike can cause the follower to lose sync with the player, and get stuck on a higher elevation in mid air.

Thanks for your time!

Thanks for the bug reports. I'll get around to investigating when I have some more free time
 
Thanks for the bug reports. I'll get around to investigating when I have some more free time

Thanks, you rock 👍

I'm a pokeemerald / C noob but I ended up figuring out a thing:
To fix "The Follower doesn't dismount bike upon entering buildings when the player does", I added a check to the "FollowMe_HandleSprite" like so:
void FollowMe_HandleSprite(void):
if (gSaveBlock2Ptr->follower.flags & FOLLOWER_FLAG_CAN_BIKE && Overworld_IsBikingAllowed())


I also was able to partially implement the "Follower falling down holes" by editing cave_hole.inc's EventScript_FallDownHole. I check the player's facing direction, then move the follower/make them invisible/play the SE. Next I might try to figure out how to make the follower do the "falling" animation. But I can live without the animations, no big deal.

More importantly, I've noticed some game-breaking issues, however.
I've recorded some gifs showing examples, hopefully it helps with investigating.
At the time of my previous post I wasn't sure if it was me who messed something up. Now, I've confirmed that changes I've made are not causing this, by cloning a fresh "follow-me" and testing.

Dismounting bikes: ("Softlocks" happen when mounting/dismounting the bike in certain areas, as well as when dismounting surfing. As I press select to dismount/mount, it seems to "warp" me around the map)
https://imgur.com/wI4cKR9

Exiting caves with water tile: (ex Aqua Hideout, Scorched Slab, causes softlock)
https://imgur.com/Nix72sR

Dive sprite bugged: (Sprite doesn't get updated when dismounting surf, or entering buildings, but mounting the bike "fixes" it)
https://imgur.com/jtUaU7z

Acro bike bugginess: (happens when a sideways hop is performed, followed by moving forward 2 tiles quickly without stopping)
https://imgur.com/epSIeTC


Thanks again for all your efforts, no rush either 😁
 
EDIT: Disregard, it was my mistake. Sorry about that 😅
 
Last edited:
Even after fixing all of the merge conflicts, when trying to build, I still get this error when trying to compile:

Code:
src/follow_me.c: In function `HideFollower':
src/follow_me.c:125: warning: implicit declaration of function `BindFieldEffectToSprite'
 
Even after fixing all of the merge conflicts, when trying to build, I still get this error when trying to compile:

Code:
src/follow_me.c: In function `HideFollower':
src/follow_me.c:125: warning: implicit declaration of function `BindFieldEffectToSprite'

Looks like a bunch of the functions were properly named on pret's end recently. I just merged upstream so this should be fixed. Thanks for letting me know!
 
I've been trying to dynamically change the graphic info of the follower object event, but I can't get it to work the way I'm wanting.

The process I'm currently using is this: I have a function that, when called, will update gSaveBlock2Ptr->follower.graphicsId to equal the proper graphic info constant, as well as update gObjectEvents[GetFollowerMapObjId()].graphicsId to be the same. If there's some type of transition, like going through a warp zone or opening and closing the bag, the follower graphics will update properly when this function is run. However, if I just call a script that runs my function and does not trigger a transition, the follower's graphics won't update, and that's exactly when I'm trying to get it to update. As soon as I walk through a warp zone or open and close the bag, however, it will then update.

Do you have any idea on how to change the graphics of the follower object with just a script call without there being some sort of transition?
 
Do you have any idea on how to change the graphics of the follower object with just a script call without there being some sort of transition?

Maybe ObjectEventSetGraphicsId? I haven't tried using it on followers though.
 
Maybe ObjectEventSetGraphicsId? I haven't tried using it on followers though.

That did kind of work. However, the animation for the object got a little bit wonky for some reason until the player moved. I ended up finding a different solution, where I just took the part of SetFollowerSprite from src/follow_me.c that creates a duplicate object event of the current follower and destroys the original. That ended up doing the trick, and the animation stayed consistent.
 
Hi folks,

I've been running into a really strange bug related to Follow Me -- occasionally, after having a battle and then moving to a different map, a follower will start following me (without the setfollower command ever getting used). By testing save states and such, I've found that this behavior seems to be determined at the start of battle (the follower shows up afterwards even if I white out, for example), and can happen with both wild and trainer battles, but doesn't happen consistently when the same trainer is faced.
When I try to talk repeatedly to the follower, usually nothing happens, but occasionally I receive a yellow nectar, then a master ball, then an ultra ball every subsequent time.

Any ideas on what could be causing this? I'm using pokeemerald-expansion with quite a few add-ons merged in, so it might be hard to isolate, but any tips would be greatly appreciated. Thanks a lot!
 
Hi folks,

I've been running into a really strange bug related to Follow Me -- occasionally, after having a battle and then moving to a different map, a follower will start following me (without the setfollower command ever getting used). By testing save states and such, I've found that this behavior seems to be determined at the start of battle (the follower shows up afterwards even if I white out, for example), and can happen with both wild and trainer battles, but doesn't happen consistently when the same trainer is faced.
When I try to talk repeatedly to the follower, usually nothing happens, but occasionally I receive a yellow nectar, then a master ball, then an ultra ball every subsequent time.

Any ideas on what could be causing this? I'm using pokeemerald-expansion with quite a few add-ons merged in, so it might be hard to isolate, but any tips would be greatly appreciated. Thanks a lot!

Hi, I've encountered this before. Want to check, in include/global.h under SaveBlock2, is your "struct Follower follower;" below "struct BattleFrontier frontier;"?

I moved it above 'frontier' and the problem stopped. My guess is 'frontier' is somehow used during normal battles, and has an overflow into the first byte of 'follower', setting 'inProgress' with junk data in the rest of 'follower'. Didn't and not sure how to confirm it though.
 
I think there's an error in the follow me code regarding the custom script setup. In TurnNPCIntoFollower, the way the code checks to see if this follower should have a script is by running CheckFollowerFlag(FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT), which will do a bitwise operation with gSaveBlock2Ptr->follower.flags to see if the custom script flag is set. However, by this point in TurnNPCIntoFollower, gSaveBlock2Ptr->follower.flags has not been set to the given followerFlags. This leads to whatever garbage data that exists at that location in memory to be used to check the flag, which, in my experience, more often than not leads to the game trying to use a custom script when no custom script is given, which results in weird things happening whenever you talk to your follower.

I've fixed this in my project by changing
Code:
if (CheckFollowerFlag(FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT))
to this:
Code:
if (followerFlags & FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT)
You could also fix this by moving that if-else statement and gSaveBlock2Ptr->follower.script = script; to be below gSaveBlock2Ptr->follower.flags = followerFlags; in the function.
 
I think there's an error in the follow me code regarding the custom script setup. In TurnNPCIntoFollower, the way the code checks to see if this follower should have a script is by running CheckFollowerFlag(FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT), which will do a bitwise operation with gSaveBlock2Ptr->follower.flags to see if the custom script flag is set. However, by this point in TurnNPCIntoFollower, gSaveBlock2Ptr->follower.flags has not been set to the given followerFlags. This leads to whatever garbage data that exists at that location in memory to be used to check the flag, which, in my experience, more often than not leads to the game trying to use a custom script when no custom script is given, which results in weird things happening whenever you talk to your follower.

I've fixed this in my project by changing
Code:
if (CheckFollowerFlag(FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT))
to this:
Code:
if (followerFlags & FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT)
You could also fix this by moving that if-else statement and gSaveBlock2Ptr->follower.script = script; to be below gSaveBlock2Ptr->follower.flags = followerFlags; in the function.

Good catch! I've updated that in my repo
 
Found another bug relating to custom scripts. Currently, if you try to give the follower a custom script, they'll never actually get it. This is due to to one command in ScrCmd_setfollower:
Code:
bool8 ScrCmd_setfollower(struct ScriptContext *ctx)
{
    u8 localId = ScriptReadByte(ctx);
    u8 flags = ScriptReadByte(ctx);

    SetUpFollowerSprite(localId, flags);
    return FALSE;
}
For a custom script to be passed in to the follower, the flags argument will need to be something like "0x1##". However, any number like that will be bigger than one byte. Yet, in ScrCmd_setfollower, the flags variable is only one byte, and only one byte of the passed-in argument is being read via ScriptReadByte. Just change
Code:
u8 flags = ScriptReadByte(ctx);
to this:
Code:
u16 flags = ScriptReadHalfword(ctx);
and you're good to go.
 
Last edited:
Found another bug relating to custom scripts. Currently, if you try to give the follower a custom script, they'll never actually get it. This is due to to one command in ScrCmd_setfollower:
Code:
bool8 ScrCmd_setfollower(struct ScriptContext *ctx)
{
    u8 localId = ScriptReadByte(ctx);
    u8 flags = ScriptReadByte(ctx);

    SetUpFollowerSprite(localId, flags);
    return FALSE;
}
For a custom script to be passed in to the follower, the flags argument will need to be something like "0x1##". However, any number like that will be bigger than one byte. Yet, in ScrCmd_setfollower, the flags variable is only one byte, and only one byte of the passed-in argument is being read via ScriptReadByte. Just change
Code:
u8 flags = ScriptReadByte(ctx);
to this:
Code:
u16 flags = ScriptReadHalfword(ctx);
and you're good to go.

Good catch again! Just fixed it
 
Thanks for the bug reports. I'll get around to investigating when I have some more free time

Was anyone ever able to address some of these, like followers disappearing after using fly? I haven't had much success trying to create my own workaround.
 
I've been trying to get a specific interaction to work with the followers, but haven't been able to figure it out. Assume the player exits a building/cave/etc., does NOT take another step (meaning the follower is still in the building/cave/etc.), then saves and closes the game. I would like to have it where, when the player opens the game again and takes a step, the follower will exit out of the building as usual. Currently, what happens is the follower just appears when the player takes a step, rather than exiting out of the building.

For a visual aid, this is what is currently happening: [PokeCommunity.com] Follow Me(Ignore the fact that the door just stays open, that's due to something else I've been working on)

This is what I would like to have happen: [PokeCommunity.com] Follow Me
I've been trying to force the follower to exit out of the door upon a reloaded save, but I always get that first interaction. As far as I can tell, all of the critical pieces of data (gSaveBlock2Ptr->follower.warpEnd and gSaveBlock2Ptr->follower.comeOutDoorStairs) are still at the correct values when reloading the save. Even when I manually set them to the correct values, I still get the first interaction. Does someone know how to implement this interaction?
 
Back
Top