A few days ago, I was searching for a method to invoke a common event whenever the player transitions to a different map. After some time, I discovered this thread:
forums.rpgmakerweb.com
This does exactly what I was looking for. I utilized the abridged version of the code posted by @Soulrender :
However, I recently realized that all the skills in my game that call a common event on the map (outside of battles) aren't functioning as intended. It appears that closing the menu also initiates "Scene_Map", and as you know, only one common event can be reserved.
Therefore, I am in search of a solution to ensure this script operates solely when the map changes.
One potential method could be to store the last map in a variable and then verify whether the current map differs from the stored one before reserving the common event. But I am unsure of how to implement this, or even if there might be a better approach.
Thank you!
how do i make a common event that plays every time you enter a new map/area? (and doesn't repeat)
for a common event to not loop and freeze the game, the trigger switch has to be off by the end. in order for it to play upon entering each area, the trigger switch has to be on by the end. i've tried autorun and parallel and any number of conditionals. and for whatever reason, "exit event...
forums.rpgmakerweb.com
This does exactly what I was looking for. I utilized the abridged version of the code posted by @Soulrender :
JavaScript:
//=============================================================================
// MapChange.js
//=============================================================================
/*:
* @plugindesc Calls a common event 75 on map change
* @author Soulrender
*/
var alias = Scene_Map.prototype.start;
Scene_Map.prototype.start = function(){
alias.call(this);
$gameTemp.reserveCommonEvent(75); // common event
}
However, I recently realized that all the skills in my game that call a common event on the map (outside of battles) aren't functioning as intended. It appears that closing the menu also initiates "Scene_Map", and as you know, only one common event can be reserved.
Therefore, I am in search of a solution to ensure this script operates solely when the map changes.
One potential method could be to store the last map in a variable and then verify whether the current map differs from the stored one before reserving the common event. But I am unsure of how to implement this, or even if there might be a better approach.
Thank you!