This plugin gives you the ability to make terrain passable or not by turning switches on or off. Instead of using regions (which are not related to the tiles used) it uses terrain tags. Up to 6 terrain tags may have their passability controlled. It overides the passability of land tiles with specific terrain tags.
Spoiler: Why use Terrain Tags to Control Access?
Terrain Tags are settings that can be made in the "Tilesets" tab of the editor. Individual tiles can be given a terrain tag of 0 to 7. Multiple tiles can have the same terrain tag. By default, all terrain tags are 0.
Whenever a tile is used, the places it is used have the terrain tag of that tile. Unlike regions, if you change your mind where a wood or mountain range is, the terrain tag of each place is set automatically.
Terrain tags are a feature that I haven't previously used, and I suspect, are not used by many other people. Regions are sometimes used by other plugins for various effects. By default, they get used to control which enemies may be encountered in different areas of the same map. With this plugin, you could, for example, make all mountains impassable to the party, until they learn the mountaineering. Using a plugin that controls access by region, means that every time you edit the map you have to check whether the regions need updating. With this plugin, the party can be given access to previous blocked terrain by setting a switch.
To use a switch to control passability for a terrain tag, put the switch number into the relevant parameter. If the switch is "On", then tiles with that terrain tag are passable for the party, while if the switch is "Off" then they are impassable. [Be aware that when using B to E sheet tiles, the uppermost tile's terrain tag tends to overwrite that of the A sheet tile underneath.] If you don't want to overide the passability of tiles with a particular terrain tag, leave the parameter for the switch controlling it as '0'.
PG.TFlag2 = Number(PG.parameters['Terrain Tag 2 Flag']);
PG.TFlag3 = Number(PG.parameters['Terrain Tag 3 Flag']);
PG.TFlag4 = Number(PG.parameters['Terrain Tag 4 Flag']);
PG.TFlag5 = Number(PG.parameters['Terrain Tag 5 Flag']);
PG.TFlag6 = Number(PG.parameters['Terrain Tag 6 Flag']);
PG.TFlag7 = Number(PG.parameters['Terrain Tag 7 Flag']);
Game_Map.prototype.checkPassage = function(x, y, bit) {
var flags = this.tilesetFlags();
var tiles = this.allTiles(x, y);
var TerTag = $gameMap.terrainTag(x,y);
for (const tile of tiles) {
const flag = flags[tile];
if ((flag & 0x10) !== 0) //
[*] No effect on passage
continue;
for (let i = 2; i <= 7; i++) {
const propName = `TFlag${i}`;
if (TerTag === i && PG[propName] > 0) {
return $gameSwitches.value(PG[propName]);
}
}
if ((flag & bit) === 0) // [o] Passable
return true;
if ((flag & bit) === bit) // [x] Impassable
return false;
}
return false;
};
复制代码
Terms and Conditions:
Free to use for both free and commercial games. Please do not publish this elsewhere on the Internet, but link to this thread. (This is in case I ever need to update the plugin; I would want only the latest version to be available.) I would prefer to be credited, either as "Piyan Glupak" or by my real name. Please credit Trihan as well, if using version 2.
Trihan's Supplementary Plugin may be found in post 7 of this thread.