Map Linked Battle Effects (MV Plugin Tips & Tricks)

From Yanfly.moe Wiki
Jump to navigation Jump to search

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.


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!

Required Plugins

The following plugin(s) is required to create this Tips & Tricks effect:

For help on how to install plugins, click here.

For help on how to update plugins, click here.

About

This is a Tips & Tricks effect created for RPG Maker MV. Tips & Tricks are not to be confused with plugins. Instead, they are usually customized code created for the sake of producing unique features/effects that do not require an entire plugin to do.

Yanfly Engine Plugins

This Tips & Tricks effect is made possible due to the Yanfly Engine Plugins library.

Click here if you want to help support Team Yanfly on Patreon.

Instructions

Follow video instructions.

You can grab the copy/paste code here:

Insert the following code into your map effect. Change the values 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!