- 239
- Posts
- 9
- Years
- Seen Apr 17, 2025
Follow Me
This feature was ported from the CFRU, allowing you to add NPC followers to the player.
Setup
For example, here's an example for adding a follower with a new script:
Finally, you can also use the followers in scripts using the local Id, OBJ_EVENT_ID_FOLLOWER like so:
Known Issues:
Credits:
Skeli / Complete Fire Red Upgrade
Touched for original source
This feature was ported from the CFRU, allowing you to add NPC followers to the player.
![[PokeCommunity.com] Follow Me [PokeCommunity.com] Follow Me](https://i.imgur.com/sHoHjxh.gif)
![[PokeCommunity.com] Follow Me [PokeCommunity.com] Follow Me](https://i.imgur.com/TiFG6Zb.gif)
![[PokeCommunity.com] Follow Me [PokeCommunity.com] Follow Me](https://i.imgur.com/IhjXL3B.gif)
![[PokeCommunity.com] Follow Me [PokeCommunity.com] Follow Me](https://i.imgur.com/jRnha2N.gif)
Setup
- Pull from my branch (see spoiler for more detail)
Spoiler:- to add my repo as a remote: git remote add ghoulslash https://github.com/ghoulslash/pokeemerald
- to view your remotes: git remote -v
- to pull from this branch: git pull ghoulslash follow_me
- fix merge conflicts:
Code:<<<<<<< Changes on your working version (the branch that is being merged into) ======= Changes from the branch you are pulling from (being merged in) - typically what you want to keep >>>>>>>
- Update gFollowerAlternateSprites with graphics Ids for your followers. The general structure is:
- normalId - the graphics Id of the regular NPC (just standing or walking around or whatever)
- machBikeId - the mach bike sprites (if applicable - see Step 4)
- acroBikeId - the acro bike sprites (if applicable - see Step 4)
- surfId - surfing sprites graphics Id (if applicable - see Step 4)
- underwaterId - diving sprites graphics Id (if applicable - see Step 4)
- Example - May sprite in the GIFs:
Spoiler:Code:{ .normalId = OBJ_EVENT_GFX_RIVAL_MAY_NORMAL, .machBikeId = OBJ_EVENT_GFX_RIVAL_MAY_MACH_BIKE, .acroBikeId = OBJ_EVENT_GFX_RIVAL_MAY_ACRO_BIKE, .surfId = OBJ_EVENT_GFX_RIVAL_MAY_SURFING, .underwaterId = OBJ_EVENT_GFX_MAY_UNDERWATER, },
- If you have sideways stairs implemented, set SIDEWAYS_STAIRS_IMPLEMENTED to TRUE in include/constants/global.h
- Four new scripting commands are added: (see asm/macros/event.inc for more info)
- setfollower - sets up an NPC to follow you. Takes a byte argument for the NPCs local Id and 2 bytes for the follower flags (see step 4)
- destroyfollower - stop the NPC from following you.
- facefollower - player and follower face one another
- checkfollower - checks if you have a follower, returns the result to VAR_RESULT
- Follower Flags: (see include/constants/follow_me.h)
- FOLLOWER_FLAG_HAS_RUNNING_FRAMES - follower has specific frames used when running. Otherwise they will walk fast behind you when you run.
- FOLLOWER_FLAG_CAN_BIKE - follower has mach/acro biking frames in gFollowerAlternateSprites. If not set, you cannot bike.
- FOLLOWER_FLAG_CAN_LEAVE_ROUTE - you can use teleport / dig / fly / etc. The follower will follow you when you use these field moves. The follower can travel between routes even if not set.
- FOLLOWER_FLAG_CAN_SURF - the follower has surfing graphics defined in gFollowerAlternateSprites. Otherwise, you cannot Surf.
- FOLLOWER_FLAG_CAN_WATERFALL - the follower can follow you up waterfalls. Otherwise, you cannot use Waterfall.
- FOLLOWER_FLAG_CAN_DIVE - the follower has a diving graphics Id defined in gFollowerAlternateSprites. It will follow you underwater. Otherwise you cannot use Dive.
- FOLLOWER_FLAG_CAN_ROCK_CLIMB - unused (no rock climb in the base game), but similar to the previous field move defines.
- FOLLOWER_FLAG_CLEAR_ON_WHITE_OUT - remove the follower if the player whites out.
- FOLLOWER_FLAG_CUSTOM_FOLLOW_SCRIPT - a unique script is run when you talk to the follower whilst they are following you. Requires loading the script (via loadword) prior to the command setfollower).
For example, here's an example for adding a follower with a new script:
Code:
SetFollower::
lock
faceplayer
loadword 0 NewScript
setfollower 1 0x100 @ cause NPC (local ID = 1) to follow you with a custom following script
release
end
NewScript:
msgbox FollowYou MSGBOX_SIGN
end
FollowYou:
.string "I'll keep following you!$"
![[PokeCommunity.com] Follow Me [PokeCommunity.com] Follow Me](https://i.imgur.com/USZcFgh.gif)
Finally, you can also use the followers in scripts using the local Id, OBJ_EVENT_ID_FOLLOWER like so:
Code:
EventScript_Test::
lock
turnobject OBJ_EVENT_ID_FOLLOWER, DIR_NORTH
@ etc
Known Issues:
- If you take a follower into a map with the maximum number of event objects, your follower may inherit a different palette and/or get directionally confused. Fortunately, since we are using decomps, we can easily increase the value of OBJECT_EVENTS_COUNT. This doesn't resolve the 16 palette gba limit, though.
- Sometimes the follower's surf blob won't appear until a menu is entered/exited
Credits:
Skeli / Complete Fire Red Upgrade
Touched for original source
Last edited: