1 Roamers On Map Show A Message
judicornadamsfoster edited this page 2026-09-13 02:28:38 +01:00

original source: pokeHnS-Expansion

this code adds a message pop-up when moving to a map that has a Roamer

roamer_message1 roamer_message2

IMPORTANT NOTE:
this guide differs slightly depending if you have added more Roamers to your hack or not.


data/event_scripts.s

this code can be added to any script file (eg. if you have a separate file you use for your custom code, you can enter it there instead)

add to end of file


EventScript_RoamerNearby::
	lockall
	msgbox EventScript_RoamerNearby_Text, MSGBOX_DEFAULT
	releaseall
	end

EventScript_RoamerNearby_Text:
	.string "A powerful presence is nearby…$"


include/constants/global.h

IMPORTANT NOTE:
if you have added more Roaming Pokemon (like using the RoamerPlus guide),
do not add this line as you will already have ROAMER_COUNT defined.

add after line #define PYRAMID_BAG_ITEMS_COUNT 10 (at line 66)

#define ROAMER_COUNT 1

include/event_scripts.h

add to end of file, before #endif


extern const u8 EventScript_RoamerNearby[];


include/roamer.h

add to end of file, before #endif


bool8 IsRoamerOnCurrentMap(void);


src/overworld.c

in section void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
add after line RoamerMove();
(or if you have already added more Roamers, the line should be entered after MoveAllRoamers();)

    if (IsRoamerOnCurrentMap())
        ScriptContext_SetupScript(EventScript_RoamerNearby);

src/roamer.c

IMPORTANT NOTE:
the code in this file depends if you have added Roamers to your hack (like with RoamersPlus)
only use one of the code blocks

If you do not have extra Roamers added,
add to end of file


bool8 IsRoamerOnCurrentMap(void)
{
    u32 i;

    for (i = 0; i < ROAMER_COUNT; i++)
    {
        if (IsRoamerAt(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
            return TRUE;
    }
    return FALSE;
}

If you have extra Roamers, add this version instead


bool8 IsRoamerOnCurrentMap(void)
{
    u32 i;

    for (i = 0; i < ROAMER_COUNT; i++)
    {
        if (IsRoamerAt(i, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
            return TRUE;
    }
    return FALSE;
}


End of guide