When the map loads or when a player transfers

So I tried to alias the Scene_Map.prototype.onMapLoaded to randomly generate three unique objects based off some other information passed in via tags for that map. the issue is, the "randomization" is called when ever you open a menu and then close it.

So if the map loads, randomization is called once. Great.

If you open a menu, close it, randomization is called again because the map "loads" again.

I just want to do randomization when a player first loads on that map or when they transfer to another map. not when a scene menu is open. 

is Scene_Map.prototype.onMapLoaded  the right function to alias?
You might want to try "Game_Player.prototype.performTransfer".
Game_Map.setup is called when the player is transfered to it.

If you want to create events, you can use the Game_Map.setupEvents that is called inside it.
this isnt really an event. But setup might be what I want. I assume that gets called when the game starts as well, like when you hit new game? I also assume that when you transfer from x -> y and back again its called?
Yes, it is called inside Game_Player.performTransfer. It is also called when the player loads a save file created by an older version of the game.
excellent 
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/when-the-map-loads-or-when-a-player-transfers.50761/