I found a pretty weird bug. When you jump over a ledge and land in tall grass, you will get an encounter 100% of the time as soon as you take a step. I tested it on the unmodified FollowerGen1-3 branch.
You are right, that bug is definitely there. I've tried looking into the code relating to the odds of a wild encounter, as well as code relating to jumping off of ledges, but I didn't see something that would be causing this issue. Very strange. If anyone has any ideas for fixing that bug, I'd be happy to hear it.
I experienced this bug too and decided to have a look...
It seems the game checks for random encounters on the first frame a player is standing still after having moved or turned. When the player takes a step after having jumped a ledge, the time it takes for the player to walk to the next tile and stop is shorter than the time it takes for the follower Pokémon to land after jumping the ledge. Looking at the code, it seems the player's
tileTransitionState
becomes
T_TILE_CENTER
once they finish walking to the next tile, but it stays as
T_TILE_CENTER
until the follower Pokémon has finished jumping the ledge (where normally it would stay as
T_TILE_CENTER
for only one frame). This causes the game to check for an encounter every frame until the follower has landed from the jump.
encounter.gif
This can be fixed by adding an additional check on line 121 in
src/field_control_avatar.c
to see if the player is allowed to move (which as far as I can tell doesn't break anything else...).
if (forcedMove == FALSE)
{
if (tileTransitionState == T_TILE_CENTER && runningState == MOVING)
input->tookStep = TRUE;
if (forcedMove == FALSE && tileTransitionState == T_TILE_CENTER && gPlayerAvatar.preventStep == FALSE)
input->checkStandardWildEncounter = TRUE;
}
encounter2.gif
I hope this helps. :)