It might be related to common events.
The script uses a [mapID, eventID] pair as the shop ID. Whenever a shop is created or retrieved, it uses that ID.
One thing to note is the way common event shops are handled. Because I don't have access to the ID, I set it when you call a common event, and then clear it out after it's used. So for example, if you call common event 7, the game will store 7 as the "common event shop ID". After the event is done, it gets cleared out.
Now, those two pieces of information are gathered here:
def shop_map_id $game_temp.shop_common_event_id ? 0 : @map_idend def shop_event_id $game_temp.shop_common_event_id ? $game_temp.shop_common_event_id : @event_idendIt is very possible that the shop common event ID somehow got "stuck" somewhere in your common event calls, and it's always being used.A possible situation is this:
The shop key ended up getting stuck with a certain value.
A shop was created with that shop key.
When you access another shop, because the key is still stuck, it returns that shop instead of the correct shop.
Now, you continue to access shops and it just keeps using that same key. When you call a common event again, NOW it resets the common event ID, gets cleared out properly, and the issue disappears.
This would explain why simply moving from one map to another normally does not fix the issue, but calling a common event does.
If you print the map ID and event ID out when you're trying to reproduce the issue, you may find that they are always the same at some point when the issue occurs.
I haven't found a way to trigger the issue.