Need a plugin for setting battleback based on Terrain Tags

I need a plugin to set Battlebacks based on Terrain Tags. I thought that maybe Yanfly would've included this option in his Region Battlebacks plugin but he didn't. I'd appreciate any help with this.
bump
I think I can do this. I will give this a try, give me a day or two. If I haven't figured it out by then, I'll reply back here and someone else could take a shot at it.

To make sure I'm completely clear, the requirements are:
  • Based on the "Terrain Tag" that the Player is standing on when the battle is initiated, a certain Battleback will default
    • "Terrain Tags" are defined in the Tileset portion of the Database and can have values of 0-7
  • There are two types of Battlebacks (1 and 2) so based on the Terrain Tag, it's actually a pair of Battlebacks will show in the Battle Scene. Example:
    • Terrain Tag 0 = Battleback1-A / Batleback2-A
    • Terrain Tag 1 = Battleback1-B / Battleback2-B
    • Terrain Tag 2 = Battleback1-C / Battleback2-C
    • etc.
  • The developer (you) will be able to select which Battlebacks correspond to which Terrain Tags as Parameters in the Plugin Manager
  • The Battlebacks that correspond to the terrain tags can be changed mid-game with a Script or Plugin Command?? (this is an important distinction)

@Animebryan Please review and confirm/clarify.
Yep. That basically all there is to it.
Here you go -

Terms of Use: Free for use in any RPG Maker MV game, commercial or non-commercial
Credit: Aloe Guvner
Directions: Copy and save in plugins folder as "ALOE_TerrainTag_BattleBacks.js"

Spoiler: ALOE_TerrainTag_BattleBacks.js
Code:
//=============================================================================
// RPG Maker MV - Terrain Tag Battlebacks
// ALOE_TerrainTag_BattleBacks.js
//=============================================================================

var Imported = Imported || {};
Imported.ALOE_TerrainTag_BattleBacks = true;

var ALOE = ALOE || {};
ALOE.TTBB = ALOE.TTBB || {};


//=============================================================================
 /*:
 * @plugindesc Certain battlebacks can be defaulted based on the
 * Terrain Tag that the player is standing on when battle is initiated.
 * @author Aloe Guvner
 *
 * @param ---TerrainTagZero---
 * @default
 *
 * @param TerrainTag_0_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagZero---
 * @desc The filename used for battleback1 on Terrain Tag 0
 *
 * @param TerrainTag_0_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagZero---
 * @desc The filename used for battleback2 on Terrain Tag 0
 *
 * @param ---TerrainTagOne---
 * @default
 *
 * @param TerrainTag_1_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagOne---
 * @desc The filename used for battleback1 on Terrain Tag 1
 *
 * @param TerrainTag_1_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagOne---
 * @desc The filename used for battleback2 on Terrain Tag 1
 *
 * @param ---TerrainTagTwo---
 * @default
 *
 * @param TerrainTag_2_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagTwo---
 * @desc The filename used for battleback1 on Terrain Tag 2
 *
 * @param TerrainTag_2_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagTwo---
 * @desc The filename used for battleback2 on Terrain Tag 2
 *
 * @param ---TerrainTagThree---
 * @default
 *
 * @param TerrainTag_3_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagThree---
 * @desc The filename used for battleback1 on Terrain Tag 3
 *
 * @param TerrainTag_3_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagThree---
 * @desc The filename used for battleback2 on Terrain Tag 3
 *
 * @param ---TerrainTagFour---
 * @default
 *
 * @param TerrainTag_4_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagFour---
 * @desc The filename used for battleback1 on Terrain Tag 4
 *
 * @param TerrainTag_4_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagFour---
 * @desc The filename used for battleback2 on Terrain Tag 4
 *
 * @param ---TerrainTagFive---
 * @default
 *
 * @param TerrainTag_5_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagFive---
 * @desc The filename used for battleback1 on Terrain Tag 5
 *
 * @param TerrainTag_5_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagFive---
 * @desc The filename used for battleback2 on Terrain Tag 5
 *
 * @param ---TerrainTagSix---
 * @default
 *
 * @param TerrainTag_6_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagSix---
 * @desc The filename used for battleback1 on Terrain Tag 6
 *
 * @param TerrainTag_6_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagSix---
 * @desc The filename used for battleback2 on Terrain Tag 6
 *
 * @param ---TerrainTagSeven---
 * @default
 *
 * @param TerrainTag_7_BattleBack1
 * @type file
 * @dir img/battlebacks1
 * @parent ---TerrainTagSeven---
 * @desc The filename used for battleback1 on Terrain Tag 7
 *
 * @param TerrainTag_7_BattleBack2
 * @type file
 * @dir img/battlebacks2
 * @parent ---TerrainTagSeven---
 * @desc The filename used for battleback2 on Terrain Tag 7
 *
 * @help
 * ============================================================================
 * Introduction
 * ============================================================================
 *
 * This plugin allows you to define battleback graphics corresponding to the
 * Terrain Tag of the player when a battle is initiated.
 *
 * If a Terrain Tag battleback is not defined in the parameters, the standard
 * process to determine the battleback is still used.
 *
 * ============================================================================
 * Parameters
 * ============================================================================
 *
 * Parameters defined in the plugin include only Battleback graphics.
 * The images must be in the img/battlebacks1 or img/battlebacks2 folder.
 *
 * ============================================================================
 * Plugin Commands
 * ============================================================================
 *
 * The following plugin commands may be used to change the battleback graphic
 * during the game for a given Terrain Tag
 *
 * TerrainTagBattleback1 X NAME
 * TerrainTagBattleback2 X NAME
 *
 * X = The number of the Terrain Tag to change (0,1,2,etc.)
 * NAME = The file name of the Battleback graphic (no quotes, no file extension)
 *
 * Example Plugin Command:
 *
 * TerrainTagBattleback1 3 PoisonSwamp
 * TerrainTagBattleback2 3 PoisonSwamp
 *
 */

//=============================================================================
// Parameters
//=============================================================================

ALOE.Parameters = PluginManager.parameters('ALOE_TerrainTag_Battlebacks');
ALOE.TTBB.Params = ALOE.TTBB.Params || {};

ALOE.TTBB.Params.Battleback1 = [];
ALOE.TTBB.Params.Battleback2 = [];

for (var i = 0; i < 8; i++) {
    ALOE.TTBB.Params.Battleback1[i] = String(ALOE.Parameters['TerrainTag_' + i + '_BattleBack1']);
    ALOE.TTBB.Params.Battleback2[i] = String(ALOE.Parameters['TerrainTag_' + i + '_BattleBack2']);
}

//=============================================================================
// Game_Map
// New Methods
//=============================================================================

Game_Map.prototype.getTerrainTagBattleback1Name = function() {
    if (!$dataMap) return '';
    var tag = $gameMap.terrainTag($gamePlayer.x, $gamePlayer.y);
    if (ALOE.TTBB.Params.Battleback1[tag]) return ALOE.TTBB.Params.Battleback1[tag];
  };

  Game_Map.prototype.getTerrainTagBattleback2Name = function() {
    if (!$dataMap) return '';
    var tag = $gameMap.terrainTag($gamePlayer.x, $gamePlayer.y);
    if (ALOE.TTBB.Params.Battleback2[tag]) return ALOE.TTBB.Params.Battleback2[tag];
  };


//=============================================================================
// Spriteset_Battle
// Overwrites
//=============================================================================

Spriteset_Battle.prototype.battleback1Name = function() {
    if (BattleManager.isBattleTest()) {
        return $dataSystem.battleback1Name;
    } else if ($gameMap.getTerrainTagBattleback1Name()) {
        return $gameMap.getTerrainTagBattleback1Name();
    } else if ($gameMap.battleback1Name()) {
        return $gameMap.battleback1Name();
    } else if ($gameMap.isOverworld()) {
        return this.overworldBattleback1Name();
    } else {
        return '';
    }
};

Spriteset_Battle.prototype.battleback2Name = function() {
    if (BattleManager.isBattleTest()) {
        return $dataSystem.battleback2Name;
    } else if ($gameMap.getTerrainTagBattleback2Name()) {
        return $gameMap.getTerrainTagBattleback2Name();
    } else if ($gameMap.battleback2Name()) {
        return $gameMap.battleback2Name();
    } else if ($gameMap.isOverworld()) {
        return this.overworldBattleback2Name();
    } else {
        return '';
    }
};

//=============================================================================
// Game_Interpreter
//=============================================================================


ALOE.TTBB.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;

Game_Interpreter.prototype.pluginCommand = function(command, args) {
    ALOE.TTBB.Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === "TerrainTagBattleback1") {
        ALOE.TTBB.Params.Battleback1[args[0]] = args[1];
    }
    if (command === "TerrainTagBattleback2") {
        ALOE.TTBB.Params.Battleback2[args[0]] = args[1];
    }
}

//=============================================================================
// End of File
//=============================================================================

In theory it is also compatible with Yanfly's Region Battlebacks plugin that you mentioned since none of the same methods are used, but I didn't test that part.
I tested it & it works. Thank you so much! 1 hurdle down, many more to go.

Original thread: https://forums.rpgmakerweb.com/threads/need-a-plugin-for-setting-battleback-based-on-terrain-tags.86958/