Pokeemerald Following Pokémon Page 2

Started by WiserVisor October 14th, 2021 10:35 PM
  • 5632 views
  • 44 replies

Dvsein

Dark Tyranitar

Age 28
Male
Chile
Seen 8 Hours Ago
Posted March 21st, 2022
5 posts
1.1 Years
hello, I had a problem when I added the system.

When the main character runs, the Pokémon that follows him does well. But when walking he changes position. Also when walking, when I move the main character down, it goes up.

Another error I had is that the pokémon that is loaded is not the one that should be, if not two before (Ex: If my initial pokémon is Pikachu, Ekans will appear as a follower).

Any idea what it could be? Any file that you recommend me to look at? It is worth mentioning that I have the Auto-Run, will there be a conflict with it for the error of the movement of the protagonist when walking?

Sorry for the English, I used a translator.

** I leave you a video of what happens to me

EDIT: Thanks for this implementation

Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
Another error I had is that the pokémon that is loaded is not the one that should be, if not two before (Ex: If my initial pokémon is Pikachu, Ekans will appear as a follower).
For the wrong Pokemon error, my guess is that you have two object events that you added after OBJ_EVENT_GFX_HOOH in
include/constants/event_objects.h
, but before all of the follower object events. This would cause all of the offsets to be off by two. If this is the cause of the issue, you can fix this by going into
src/overworld.c
, and then look at the function
UpdateFollowerPokemonGraphic
. Then make this change to the first line:
u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + 238;
                                                                                                       ↓   ↓   ↓   ↓
u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + OBJ_EVENT_GFX_BULBASAUR - 1;
This will allow you to have as many object event constants as you want before the start of the followers without causing this offset to occur. I'm going to add this in the next time I update the repository, along with a similar fix to
IsFlyingPokemonGraphic
in
gflib/sprite.c
. Thanks for bringing this to my attention!

When the main character runs, the Pokémon that follows him does well. But when walking he changes position. Also when walking, when I move the main character down, it goes up.
Now this error is much harder to solve. I only have a couple ideas, and I'm not really confident in either of them.

The first thing you can try is go into
include/global.h
, and go down to the definition of
struct SaveBlock2
. Make sure that
bool8 autoRun;
is below
struct Follower follower;
. Sometimes the order of the elements of a struct are important, so that might be messing it up. Still, I'm not confident that this is the solution.

The other idea that I have is based on what I saw in the video. From what I could tell, it looked like the follower acted as if it was south of the protagonist, even though it was actually north. It's possible that, when you switch off the auto-run feature, it causes the follower to reset to being south of the player, regardless of where it actually is. It's a stretch, but something like that may be happening. You could try resetting the follower's coordinates to their proper location whenever you switch off the auto-run feature. Again, I'm not very confident with this fix either, but it's worth a shot.

Let me know if these fixes work for you or not!

Dvsein

Dark Tyranitar

Age 28
Male
Chile
Seen 8 Hours Ago
Posted March 21st, 2022
5 posts
1.1 Years
For the wrong Pokemon error, my guess is that you have two object events that you added after OBJ_EVENT_GFX_HOOH in
include/constants/event_objects.h
, but before all of the follower object events. This would cause all of the offsets to be off by two. If this is the cause of the issue, you can fix this by going into
src/overworld.c
, and then look at the function
UpdateFollowerPokemonGraphic
. Then make this change to the first line:
u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + 238;
                                                                                                       ↓   ↓   ↓   ↓
u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + OBJ_EVENT_GFX_BULBASAUR - 1;
This will allow you to have as many object event constants as you want before the start of the followers without causing this offset to occur. I'm going to add this in the next time I update the repository, along with a similar fix to
IsFlyingPokemonGraphic
in
gflib/sprice.c
. Thanks for bringing this to my attention!



Now this error is much harder to solve. I only have a couple ideas, and I'm not really confident in either of them.

The first thing you can try is go into
include/global.h
, and go down to the definition of
struct SaveBlock2
. Make sure that
bool8 autoRun;
is below
struct Follower follower;
. Sometimes the order of the elements of a struct are important, so that might be messing it up. Still, I'm not confident that this is the solution.

The other idea that I have is based on what I saw in the video. From what I could tell, it looked like the follower acted as if it was south of the protagonist, even though it was actually north. It's possible that, when you switch off the auto-run feature, it causes the follower to reset to being south of the player, regardless of where it actually is. It's a stretch, but something like that may be happening. You could try resetting the follower's coordinates to their proper location whenever you switch off the auto-run feature. Again, I'm not very confident with this fix either, but it's worth a shot.

Let me know if these fixes work for you or not!

Thank you very much for your response and sorry for my delay in responding. For the first problem (wrong pokémon) I was looking for something similar to what you indicated. Thank you very much, I was able to solve that.

The other problem I definitely couldn't solve. I tried what you told me but I think it's something deeper. The worst thing is that the normal movement of the main character (not running) when pressing the direction down, it goes up. I spent hours looking at the code and seeing where the problem could come from, but still I couldn't. If I manage to solve it, I will leave the answer in this same post.

EDIT (22/03/22):

Fixed. Many many thanks to WiserVisor who gave me his help in solving my problem.


Seen 16 Hours Ago
Posted March 26th, 2022
3 posts
7.6 Years
I tried to implement this in my local repo after adding the item, battle, and pokemon expansions. The game builds fine, but I'm getting some weird graphic issues. Once I'm in the lab and I get the starter, the animation for it to emerge never finishes. I have a pokeball following my character around, which is different depending on which starter I picked, and the NPCs around me will sometimes break for a moment before going back to normal. I'm pretty new to this, so I have no idea if this is a bug or something I did myself while merging the code.
Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
I tried to implement this in my local repo after adding the item, battle, and pokemon expansions. The game builds fine, but I'm getting some weird graphic issues. Once I'm in the lab and I get the starter, the animation for it to emerge never finishes. I have a pokeball following my character around, which is different depending on which starter I picked, and the NPCs around me will sometimes break for a moment before going back to normal. I'm pretty new to this, so I have no idea if this is a bug or something I did myself while merging the code.
This is an issue that is caused by the pokemon_expansion. In the species constants in pret's repository, there's a gap between SPECIES_CELEBI and SPECIES_TREECKO, where the OLD_UNOWN constants are. These OLD_UNOWN constants aren't present in the pokemon_expansion. This causes the first 12 Pokémon from Gen 3 to have their sprites be a Pokeball or a sparkle, and then the rest of Gen 3 have offset sprites. I will push a fix to this either later today or tomorrow, since that is pretty significant. Thanks for pointing this out to me!
Seen 16 Hours Ago
Posted March 26th, 2022
3 posts
7.6 Years
I'm having another weird issue now :/ After a certain point in the Pokedex, the followers start showing up as the wrong pokemon. After managing to set up the debug menu, I tested out giving myself pokemon and seeing which ones worked and which didn't. It looks like Taillow is the first one to show up incorrectly (appears as a Nincada). All the pokemon before it seem fine, and all the ones after are wrong. Again, I'm not familiar enough with the code yet to know for sure if this was something I caused or not. I updated to the latest commits and manually checked my code compared to the repo, didn't see anything out of place, but again I'm still not very familiar with this yet.
Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
I'm having another weird issue now :/ After a certain point in the Pokedex, the followers start showing up as the wrong pokemon.
This was another bug caused by the pokemon_expansion. They reordered the SPECIES constants, which directly affects which follower graphic gets picked. I just pushed a fix for this. Thanks for finding another bug!
Seen 19 Hours Ago
Posted 19 Hours Ago
32 posts
134 Days
I seem to be having trouble adding new followers into this. I had no trouble adding followers beyond the original 386 in Merrp's system, so curious how this is handling them differently.

I've tried declaring my new OBJ_EVENT_GFX for the new species I'm adding, but it seems that anything after Deoxys is not appearing properly. How exactly should we be entering new objects for followers and how strict is it about ordering?
Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
How exactly should we be entering new objects for followers and how strict is it about ordering?
The system is based entirely on the SPECIES constants that are returned by the function
GetMonData
. All of the follower OBJ_EVENT_GFX constants need to be in the species order, or else things get out of whack. Everything else should be the same in terms of adding in new object event stuff. If you're doing that and there are still problems, I would have to know what exactly is going wrong when your new follower appears, and see the entire process you went through to add the object event data.
Seen 19 Hours Ago
Posted 19 Hours Ago
32 posts
134 Days
The system is based entirely on the SPECIES constants that are returned by the function
GetMonData
. All of the follower OBJ_EVENT_GFX constants need to be in the species order, or else things get out of whack. Everything else should be the same in terms of adding in new object event stuff. If you're doing that and there are still problems, I would have to know what exactly is going wrong when your new follower appears, and see the entire process you went through to add the object event data.
Thanks for the confirmation! I'll give that a shot.
Seen 19 Hours Ago
Posted 19 Hours Ago
32 posts
134 Days
Is there a way to control follower placement/spawning during scenes where there is forced movement on a map? I can get hidefollower to work during events or my own scripts, but when the map launches right into a script on warp/load, it seems like 'hidefollower' is triggering before the follower spawns in and won't work. You run into situations where the follower then runs to your player from off screen or really far away, etc.
Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
Is there a way to control follower placement/spawning during scenes where there is forced movement on a map? I can get hidefollower to work during events or my own scripts, but when the map launches right into a script on warp/load, it seems like 'hidefollower' is triggering before the follower spawns in and won't work. You run into situations where the follower then runs to your player from off screen or really far away, etc.
I think so, yeah. ghoulslash's Follow Me code is currently designed so that the follower doesn't copy the player's movements when those movements are dictated by a script rather than player input. You can change that by going into
src/event_object_movement.c
, and then go into the function
ObjectEventSetHeldMovement
. Make this change:
Original
...............
    objectEvent->heldMovementFinished = FALSE;
    gSprites[objectEvent->spriteId].sActionFuncId = 0;
    FollowMe(objectEvent, movementActionId, FALSE); ← ← ← ←
    return FALSE;
}

Change
.................
    objectEvent->heldMovementFinished = FALSE;
    gSprites[objectEvent->spriteId].sActionFuncId = 0;
    FollowMe(objectEvent, movementActionId, TRUE); ← ← ← ←
    return FALSE;
}
There may be new problems which I don't know about that will arise by making this change, so do so at your own risk. You could also instead make changes in
src/follow_me.c
, specifically in the
FollowMe
function:
............
    else if (!gSaveBlock2Ptr->follower.inProgress)
        return;
    else if (ScriptContext2_IsEnabled() && !ignoreScriptActive)
        return; //Don't follow during a script
That second else-if is the single statement that determines whether the follower moves during scripted events. You could add extra conditions if you only want the follower to move in specific scripted events, but not all. I suppose you could also add these conditions in
ObjectEventSetHeldMovement
, but it's your call.

As far as I know, those would be the most efficient solutions to your problem without getting anymore detail.
Seen 19 Hours Ago
Posted 19 Hours Ago
32 posts
134 Days
Thanks for the response.

If it helps for some context: where I first noticed the weird behavior was on the Devon Corp's 3F; when you go there the first time, the NPC waiting for you begins to interact with you as soon as you enter (triggers "On Warp", I believe). The Follower hasn't even spawned yet, but once the script is finished, the follower will begin moving towards the player as they move around the room.

Do you have a recommended way to just flat-out prevent these types of followers from spawning at all in specific spaces? When I was working with Merrp's followers, I made it so followers didn't spawn indoors (instead of just large pokemon not spawning), and also created a toggle option in the menu for whether or not followers were visible in the overworld. Would something like that be workable with the FollowMe code or would it cause issues?
Seen 2 Hours Ago
Posted 1 Day Ago
170 posts
4.9 Years
Do you have a recommended way to just flat-out prevent these types of followers from spawning at all in specific spaces?
One technique you could use would be to add your own exit conditions at the top of
FollowMe
in the file
src/follow_me.c
. For example, if you didn't want any followers to appear when the player is indoors, you could change that if-else chain to be this:
    if (player != npc) //Only when the player moves
        return;
    else if (!gSaveBlock2Ptr->follower.inProgress)
        return;
    else if (ScriptContext2_IsEnabled() && !ignoreScriptActive)
        return; //Don't follow during a script
    else if (gMapHeader.mapType == MAP_TYPE_INDOORS) ← ← ← ←
        return; //Don't spawn follower indoors
With this added condition, the follower will never move while indoors, which in turn causes the follower to never appear indoors. Changing that statement to be whatever condition you want will allow you to disallow the spawning of a follower in any situation you want, assuming the follower hasn't already spawned at the time of that condition being met.


.....a toggle option in the menu for whether or not followers were visible in the overworld.
For this feature, you would need to add multiple checks to see whether or not that option has been turned on or not. This would require you to add a new exit statement to the top of
FollowMe
and making sure the follower just becomes invisible when
UpdateFollowerPokemonGraphic
is run, which can be found in
src/overworld.c
, rather than going throught its normal process. I think that would be all you would need, since I've made a lot of the follower interactions not happen as long as the follower is invisible. Of course, I could be forgetting some specific interaction, but I'll leave you the joy of finding those edge cases!