Skip to content

Don't reset Pushable Boulders when moving around the map

judicornadamsfoster edited this page Jul 18, 2026 · 1 revision

Original Source: wiz1989's pokecommunity post
Full credit to wiz1989 for this guide

When creating bigger boulder puzzles you might want the already moved boulders to stay in place when moving around the map. Usually these objects are being removed as soon as you don't see them in the player's screen bounds anymore. And when coming back they are recreated at their original position.

To handle this I added a flag to activate/deactive the regular "delete offscreen objects" behavior. I would set this before entering the desired map/puzzle area and clear it after solving the puzzle (e.g. by leaving the map or on a trigger tile).

Also consider clearing this flag when leaving the area the way you entered it!


include/constants/flags.h

rename an unused flag (unused flag 0x4F used for this example)

#define FLAG_DONT_REMOVE_OFFSCREEN_OBJECT        0x4F // don't reset boulders when they go offscreen

src/event_object_movement.c

in function static void RemoveObjectEventIfOutsideView(struct ObjectEvent *objectEvent) (at line 1699)

add the following if-clause before the RemoveObjectEvent(objectEvent); at the bottom of it.

    if (!(FlagGet(FLAG_DONT_REMOVE_OFFSCREEN_OBJECT) && objectEvent->graphicsId == OBJ_EVENT_GFX_PUSHABLE_BOULDER))

so the section should now be:

{
    s16 left =   gSaveBlock1Ptr->pos.x - 2;
    s16 right =  gSaveBlock1Ptr->pos.x + 17;
    s16 top =    gSaveBlock1Ptr->pos.y;
    s16 bottom = gSaveBlock1Ptr->pos.y + 16;

    if (objectEvent->currentCoords.x >= left && objectEvent->currentCoords.x <= right
     && objectEvent->currentCoords.y >= top && objectEvent->currentCoords.y <= bottom)
        return;
    if (objectEvent->initialCoords.x >= left && objectEvent->initialCoords.x <= right
     && objectEvent->initialCoords.y >= top && objectEvent->initialCoords.y <= bottom)
        return;
    if (!(FlagGet(FLAG_DONT_REMOVE_OFFSCREEN_OBJECT) && objectEvent->graphicsId == OBJ_EVENT_GFX_PUSHABLE_BOULDER))
    RemoveObjectEvent(objectEvent);
}

This will check for said flag and for the object being a boulder. If both is true the object won't be deleted.

Clone this wiki locally