Tips & Tricks – Map Linked Battle Effects – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here

Support Yanfly on Patreon

Ever wanted to link certain region ID’s to have certain effects applied when you encounter a battle on them? Now you can! This Tips & Tricks will show you just how to do that!

You can grab the copy/paste code here: 

Insert the following code into your map effect. Change the values in red to fit the settings of your game.

<Custom Passive Condition>
// Set the initial condition setting to true.
var condition = true;
// Check if it is a battle playtest...
if (BattleManager.isBattleTest()) {
  // ...set it to false.
  condition = false;
// Check if a map exists and the party is in battle.
} else if ($gameMap && $gameParty.inBattle()) {
  // Make a list of the active maps to automatically enable the effect.
  var activeMaps = [];
  // Insert the ID's of the maps you want this state to be active on.
  activeMaps.push(123, 124, 125, 126, 75);
  activeMaps.push(127, 128, 129, 130); 
  // Make a list of the terrain tags to automatically enable the effect.
  var terrainTags = [];
  // Insert the terrain tags you want this state to be active on.
  terrainTags.push(0, 1, 2, 3);
  // Make a list of the region ID's to enable the effect.
  var regionIds = [];
  // Insert the region ID's you want this state to be active on.
  regionIds.push(10, 11, 12, 13);
  regionIds.push(14, 15, 16, 17);
  // Check if the list of active maps has any items.
  if (activeMaps.length > 0) {
    // Check if the active maps do not contain the current map.
    if (!activeMaps.contains($gameMap.mapId())) {
      // If it doesn't, disable the effect.
      condition = false;
    }
  }
  // Check if the list of terrain tags has any items.
  if (terrainTags.length > 0) {
    // Check if the terrain tags do not contain the current terrain tag.
    if (!terrainTags.contains($gamePlayer.terrainTag())) {
      // If it doesn't, disable the effect.
      condition = false;
    }
  }
  // Check if the list of region ID's has any items.
  if (regionIds.length > 0) {
    // Check if the region ID's do not contain the current region ID.
    if (!regionIds.contains($gamePlayer.regionId())) {
      // If it doesn't, disable the effect.
      condition = false;
    }
  }
// If the player isn't in battle...
} else {
  // ...then disable the effect.
  condition = false;
}
</Custom Passive Condition>

Enjoy!

Please wait while you are redirected...or Click Here if you do not want to wait.