v21.1 move_random_range/saving bug

This thread pertains to v21.1 of Pokémon Essentials.

CRMM

Rookie
Member
Joined
Sep 9, 2023
Posts
3
Age
23
When the player starts a game after saving at the origin point of an NPC that utilizes "move_random_range(x,y)", the NPC does not retain their saved location. Instead, they return to their origin, underneath the player. This bug was not present in v20.1, and does not seem to affect the default RMXP movement options like "Move at Random".
 

CRMM

Rookie
Member
Joined
Sep 9, 2023
Posts
3
Age
23
Thanks for looking into it. I did a little more testing and found there is a second criteria: the "ignore if can't move" checkbox. If that is un-checked, and the move route is move_random_range, then they return to their origin consistently. If "ignore if can't move" is checked off, they retain their saved location.
 

Maruno

Pokémon Essentials dev
Essentials Developer
Joined
Apr 5, 2017
Posts
536
I believe it actually happens if you save your project in RMXP. Doing so increments a magic number in the project files. The save file has a copy of this value, and the game compares the two when loading a save file. If they don't match, the map is loaded from scratch (so that you can see any changes you might have made to the map you're on).

Moreover, this affects any movement of events no matter how they move. They can use the "Random" movement or a "Custom" movement with specific Move Up/Down/Left/Right commands, and they'll still reset their positions if you've saved the game project in RMXP.

This behaviour makes a lot of sense. If you've saved your game project, you've probably changed something, and you'll want to see those changes immediately when you start playing, even if those changes are in the map you've saved in. That's why everything gets reset.

This behaviour only affects devs and not players. Players can't save the game project, and so can't affect the magic number. So it's not like it's an actual bug that affects the final game. Since it's always been like this, I'm not going to change anything.
 
Last edited:

CRMM

Rookie
Member
Joined
Sep 9, 2023
Posts
3
Age
23
That makes sense as I've only run my game from the playtest button in RPG Maker XP. It didn't look like it was happening when I tested in v20, but of course, I wasn't making changes between launching the game either. I was only relaunching it to see if the NPC's retained their position. Good to know it only happens in playtesting. Thanks again!
 
Top