```
(function() {
var parameters = PluginManager.parameters("SRPG_TerrainStates") || $plugins.filter(function (plugin) { return plugin.description.contains('<SRPG_TerrainStates>'); });
var _varSOFFT0ID = Number(parameters['Tag0_removeStateID'] || 0);
var _varSOFFT1ID = Number(parameters['Tag1_removeStateID'] || 0);
var _varSOFFT2ID = Number(parameters['Tag2_removeStateID'] || 0);
var _varSOFFT3ID = Number(parameters['Tag3_removeStateID'] || 0);
var _varSOFFT4ID = Number(parameters['Tag4_removeStateID'] || 0);
var _varSOFFT5ID = Number(parameters['Tag5_removeStateID'] || 0);
var _varSOFFT6ID = Number(parameters['Tag6_removeStateID'] || 0);
var _varSOFFT7ID = Number(parameters['Tag7_removeStateID'] || 0);
var _varSONT0ID = Number(parameters['Tag0_addStateID'] || 0);
var _varSONT1ID = Number(parameters['Tag1_addStateID'] || 0);
var _varSONT2ID = Number(parameters['Tag2_addStateID'] || 0);
var _varSONT3ID = Number(parameters['Tag3_addStateID'] || 0);
var _varSONT4ID = Number(parameters['Tag4_addStateID'] || 0);
var _varSONT5ID = Number(parameters['Tag5_addStateID'] || 0);
var _varSONT6ID = Number(parameters['Tag6_addStateID'] || 0);
var _varSONT7ID = Number(parameters['Tag7_addStateID'] || 0);
var _varEVT0ID = Number(parameters['Tag0_UnitEventID'] || 0);
var _varEVT1ID = Number(parameters['Tag1_UnitEventID'] || 0);
var _varEVT2ID = Number(parameters['Tag2_UnitEventID'] || 0);
var _varEVT3ID = Number(parameters['Tag3_UnitEventID'] || 0);
var _varEVT4ID = Number(parameters['Tag4_UnitEventID'] || 0);
var _varEVT5ID = Number(parameters['Tag5_UnitEventID'] || 0);
var _varEVT6ID = Number(parameters['Tag6_UnitEventID'] || 0);
var _varEVT7ID = Number(parameters['Tag7_UnitEventID'] || 0);
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'SRPG_TerrainStates') {
if (_varEVT0ID >= 1 && ($gameVariables.value(_varEVT0ID)) >= 1 && _varSOFFT0ID >= 1 && ($gameVariables.value(_varSOFFT0ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT0ID))[1].isStateAffected($gameVariables.value(_varSOFFT0ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT0ID)).x),($gameMap.event($gameVariables.value(_varEVT0ID)).y))==0)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT0ID))[1].removeState($gameVariables.value(_varSOFFT0ID))
}
}
if (_varEVT0ID >= 1 && ($gameVariables.value(_varEVT0ID)) >= 1 && _varSONT0ID >= 1 && ($gameVariables.value(_varSONT0ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT0ID))[1].isStateAffected($gameVariables.value(_varSONT0ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT0ID)).x),($gameMap.event($gameVariables.value(_varEVT0ID)).y))==0)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT0ID))[1].addState($gameVariables.value(_varSONT0ID))
}
}
if (_varEVT1ID >= 1 && ($gameVariables.value(_varEVT1ID)) >= 1 && _varSOFFT1ID >= 1 && ($gameVariables.value(_varSOFFT1ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT1ID))[1].isStateAffected($gameVariables.value(_varSOFFT1ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT1ID)).x),($gameMap.event($gameVariables.value(_varEVT1ID)).y))==1)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT1ID))[1].removeState($gameVariables.value(_varSOFFT1ID))
}
}
if (_varEVT1ID >= 1 && ($gameVariables.value(_varEVT1ID)) >= 1 && _varSONT1ID >= 1 && ($gameVariables.value(_varSONT1ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT1ID))[1].isStateAffected($gameVariables.value(_varSONT1ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT1ID)).x),($gameMap.event($gameVariables.value(_varEVT1ID)).y))==1)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT1ID))[1].addState($gameVariables.value(_varSONT1ID))
}
}
if (_varEVT2ID >= 1 && ($gameVariables.value(_varEVT2ID)) >= 1 && _varSOFFT2ID >= 1 && ($gameVariables.value(_varSOFFT2ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT2ID))[1].isStateAffected($gameVariables.value(_varSOFFT2ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT2ID)).x),($gameMap.event($gameVariables.value(_varEVT2ID)).y))==2)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT2ID))[1].removeState($gameVariables.value(_varSOFFT2ID))
}
}
if (_varEVT2ID >= 1 && ($gameVariables.value(_varEVT2ID)) >= 1 && _varSONT2ID >= 1 && ($gameVariables.value(_varSONT2ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT2ID))[1].isStateAffected($gameVariables.value(_varSONT2ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT2ID)).x),($gameMap.event($gameVariables.value(_varEVT2ID)).y))==2)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT2ID))[1].addState($gameVariables.value(_varSONT2ID))
}
}
if (_varEVT3ID >= 1 && ($gameVariables.value(_varEVT3ID)) >= 1 && _varSOFFT3ID >= 1 && ($gameVariables.value(_varSOFFT3ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT3ID))[1].isStateAffected($gameVariables.value(_varSOFFT3ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT3ID)).x),($gameMap.event($gameVariables.value(_varEVT3ID)).y))==3)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT3ID))[1].removeState($gameVariables.value(_varSOFFT3ID))
}
}
if (_varEVT3ID >= 1 && ($gameVariables.value(_varEVT3ID)) >= 1 && _varSONT3ID >= 1 && ($gameVariables.value(_varSONT3ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT3ID))[1].isStateAffected($gameVariables.value(_varSONT3ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT3ID)).x),($gameMap.event($gameVariables.value(_varEVT3ID)).y))==3)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT3ID))[1].addState($gameVariables.value(_varSONT3ID))
}
}
if (_varEVT4ID >= 1 && ($gameVariables.value(_varEVT4ID)) >= 1 && _varSOFFT4ID >= 1 && ($gameVariables.value(_varSOFFT4ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT4ID))[1].isStateAffected($gameVariables.value(_varSOFFT4ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT4ID)).x),($gameMap.event($gameVariables.value(_varEVT4ID)).y))==4)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT4ID))[1].removeState($gameVariables.value(_varSOFFT4ID))
}
}
if (_varEVT4ID >= 1 && ($gameVariables.value(_varEVT4ID)) >= 1 && _varSONT4ID >= 1 && ($gameVariables.value(_varSONT4ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT4ID))[1].isStateAffected($gameVariables.value(_varSONT4ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT4ID)).x),($gameMap.event($gameVariables.value(_varEVT4ID)).y))==4)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT4ID))[1].addState($gameVariables.value(_varSONT4ID))
}
}
if (_varEVT5ID >= 1 && ($gameVariables.value(_varEVT5ID)) >= 1 && _varSOFFT5ID >= 1 && ($gameVariables.value(_varSOFFT5ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT5ID))[1].isStateAffected($gameVariables.value(_varSOFFT5ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT5ID)).x),($gameMap.event($gameVariables.value(_varEVT5ID)).y))==5)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT5ID))[1].removeState($gameVariables.value(_varSOFFT5ID))
}
}
if (_varEVT5ID >= 1 && ($gameVariables.value(_varEVT5ID)) >= 1 && _varSONT5ID >= 1 && ($gameVariables.value(_varSONT5ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT5ID))[1].isStateAffected($gameVariables.value(_varSONT5ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT5ID)).x),($gameMap.event($gameVariables.value(_varEVT5ID)).y))==5)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT5ID))[1].addState($gameVariables.value(_varSONT5ID))
}
}
if (_varEVT6ID >= 1 && ($gameVariables.value(_varEVT6ID)) >= 1 && _varSOFFT6ID >= 1 && ($gameVariables.value(_varSOFFT6ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT6ID))[1].isStateAffected($gameVariables.value(_varSOFFT6ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT6ID)).x),($gameMap.event($gameVariables.value(_varEVT6ID)).y))==6)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT6ID))[1].removeState($gameVariables.value(_varSOFFT6ID))
}
}
if (_varEVT6ID >= 1 && ($gameVariables.value(_varEVT6ID)) >= 1 && _varSONT6ID >= 1 && ($gameVariables.value(_varSONT6ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT6ID))[1].isStateAffected($gameVariables.value(_varSONT6ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT6ID)).x),($gameMap.event($gameVariables.value(_varEVT6ID)).y))==6)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT6ID))[1].addState($gameVariables.value(_varSONT6ID))
}
}
if (_varEVT7ID >= 1 && ($gameVariables.value(_varEVT7ID)) >= 1 && _varSOFFT7ID >= 1 && ($gameVariables.value(_varSOFFT7ID)) >= 1) {
if ($gameSystem.EventToUnit($gameVariables.value(_varEVT7ID))[1].isStateAffected($gameVariables.value(_varSOFFT7ID)) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT7ID)).x),($gameMap.event($gameVariables.value(_varEVT7ID)).y))==7)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT7ID))[1].removeState($gameVariables.value(_varSOFFT7ID))
}
}
if (_varEVT7ID >= 1 && ($gameVariables.value(_varEVT7ID)) >= 1 && _varSONT7ID >= 1 && ($gameVariables.value(_varSONT7ID)) >= 1) {
if ((!$gameSystem.EventToUnit($gameVariables.value(_varEVT7ID))[1].isStateAffected($gameVariables.value(_varSONT7ID))) && ($gameMap.terrainTag(($gameMap.event($gameVariables.value(_varEVT7ID)).x),($gameMap.event($gameVariables.value(_varEVT7ID)).y))==7)) {
$gameSystem.EventToUnit($gameVariables.value(_varEVT7ID))[1].addState($gameVariables.value(_varSONT7ID))
}
}
}
};
})();
```