rh-hideout / pokeemerald-expansion

Feature branche for the pokeemerald decompilation. See the wiki for more info.
353 stars 1.06k forks source link

Inconsistent follower movement during `applymovement` #5346

Open Kasenn opened 1 month ago

Kasenn commented 1 month ago

Description

Follower movement is very inconsistent when using applymovement OBJ_EVENT_ID_PLAYER with the flag FLAG_SAFE_FOLLOWER_MOVEMENT set. about 90% of the time the follower will just sit still (even going as far as freezing the sprite bobbing) while the rest of the time it moves with the player as if the player was moving manually.

Based on testing, the follower seems to move properly when the script is activated through a trigger, but not through anything else (signs, interacting with objects, ON_FRAME_TABLE mapscript, debug menu script).

Version

1.9.1 (Latest release)

Upcoming/master Version

No response

Discord contact info

No response

Kasenn commented 1 day ago

After doing some tests, it seems that the inconsistent behavior is based on how playerCopyableMovement is set. This is normally handled by player input, but since applymovement does not directly read any inputs, the playerCopyableMovement remains the same through the movement as it was before the movement started.

Hence, since the player has to walk on to a trigger event to trigger it, the follower works correctly, as the playerCopyableMovement remains at COPY_MOVE_WALK. However, since the applymovement does not directly alter the playerCopyableMovement, it's possible to get different results on the follower movement when interacting with objects based on whether or not a movement is still in progress when the object is interacted with. You can see in the included video how the follower reacts completely differently based on whether the player is standing still or walking when interacting with an object

https://github.com/user-attachments/assets/5367eee6-563b-469f-97d2-1eb47e50dbd0