- Joined
- Jun 17, 2014
- Messages
- 344
- Reaction score
- 385
- First Language
- English
- Primarily Uses
Hi folks,
I recently downloaded mykrme's Secret Passage plugin in the hopes that it would make it easier to map buildings that you can walk behind. However, when testing the demo that was provided in the thread, I discovered that it simply did not function, as it didn't allow the hero's sprite to walk behind any walls.
A link to the plugin thread is here: https://forums.rpgmakerweb.com/index.php?threads/secret-passage-plugin.73296/
I've also provided screenshots from the demo that was provided by @mykrme :
As you can see in the second picture, as I walk into the wall, rather than going behind it as the plugin intends, the character simply walks on top of the wall.
I was wondering if someone would be able to look at the code provided in the thread and see what was causing the problem.
Thanks!
EDIT:
Here is the code provided from the plugin itself:
It can also be found here on his Github.
I recently downloaded mykrme's Secret Passage plugin in the hopes that it would make it easier to map buildings that you can walk behind. However, when testing the demo that was provided in the thread, I discovered that it simply did not function, as it didn't allow the hero's sprite to walk behind any walls.
A link to the plugin thread is here: https://forums.rpgmakerweb.com/index.php?threads/secret-passage-plugin.73296/
I've also provided screenshots from the demo that was provided by @mykrme :
As you can see in the second picture, as I walk into the wall, rather than going behind it as the plugin intends, the character simply walks on top of the wall.
I was wondering if someone would be able to look at the code provided in the thread and see what was causing the problem.
Thanks!
EDIT:
Here is the code provided from the plugin itself:
/*:
* @plugindesc The SecretPassage plugin allows you to make an otherwise impassable tile passable through the use of regions.
* @author mykrme
*
* @param Passable
* @desc The region number used for a secret passage - always passable.
* @Default 1
*
* @param Impassable
* @desc The region number used for the surroundings of a secret passage - always impassable.
* @Default 2
*
* @param Invisible
* @desc The region number used for a secret passage - always passable. Character is invisible.
* @Default 3
*
* @Help
*/
var settings = PluginManager.parameters("SecretPassage");
var passable_region = parseInt(settings["Passable"]) || 1;
var impassable_region = parseInt(settings["Impassable"]) || 2;
var invisible_region = parseInt(settings["Invisible"]) || 3;
var _Game_Map_checkPassage = Game_Map.prototype.checkPassage;
Game_Map.prototype.checkPassage = function(x, y, bit) {
var region = $gameMap.regionId(x, y);
switch (region) {
case passable_region:
case invisible_region: return true;
case impassable_region: return false;
default: return _Game_Map_checkPassage.call(this, x, y, bit);
}
};
var temp_mx = 0;
var temp_my = 0;
var tileId_below = 0;
var Tilemap__paintTiles = Tilemap.prototype._paintTiles;
Tilemap.prototype._paintTiles = function(startX, startY, x, y) {
temp_mx = startX + x;
temp_my = startY + y;
tileId_below = this._readMapData(temp_mx, temp_my + 1, 0); // only checks A type tiles
Tilemap__paintTiles.call(this, startX, startY, x, y);
}
var Tilemap__isHigherTile = Tilemap.prototype._isHigherTile;
Tilemap.prototype._isHigherTile = function(tileId) {
var currentTile_invisibleRegion = this._readMapData(temp_mx, temp_my, 5) == invisible_region;
var tileOneBelow_invisibleRegion = this._readMapData(temp_mx, temp_my + 1, 5) == invisible_region;
var playerStandsBelow = $gamePlayer._realY > temp_my;
if (!tileOneBelow_invisibleRegion && playerStandsBelow) { // to show the hat tops
return Tilemap__isHigherTile.call(this, tileId);
}
if (currentTile_invisibleRegion) {
return 0x10;
}
if (tileOneBelow_invisibleRegion && Tilemap.isSameKindTile(tileId, tileId_below)) { // to hide the hat tops
return 0x10;
}
return Tilemap__isHigherTile.call(this, tileId);
};
* @plugindesc The SecretPassage plugin allows you to make an otherwise impassable tile passable through the use of regions.
* @author mykrme
*
* @param Passable
* @desc The region number used for a secret passage - always passable.
* @Default 1
*
* @param Impassable
* @desc The region number used for the surroundings of a secret passage - always impassable.
* @Default 2
*
* @param Invisible
* @desc The region number used for a secret passage - always passable. Character is invisible.
* @Default 3
*
* @Help
*/
var settings = PluginManager.parameters("SecretPassage");
var passable_region = parseInt(settings["Passable"]) || 1;
var impassable_region = parseInt(settings["Impassable"]) || 2;
var invisible_region = parseInt(settings["Invisible"]) || 3;
var _Game_Map_checkPassage = Game_Map.prototype.checkPassage;
Game_Map.prototype.checkPassage = function(x, y, bit) {
var region = $gameMap.regionId(x, y);
switch (region) {
case passable_region:
case invisible_region: return true;
case impassable_region: return false;
default: return _Game_Map_checkPassage.call(this, x, y, bit);
}
};
var temp_mx = 0;
var temp_my = 0;
var tileId_below = 0;
var Tilemap__paintTiles = Tilemap.prototype._paintTiles;
Tilemap.prototype._paintTiles = function(startX, startY, x, y) {
temp_mx = startX + x;
temp_my = startY + y;
tileId_below = this._readMapData(temp_mx, temp_my + 1, 0); // only checks A type tiles
Tilemap__paintTiles.call(this, startX, startY, x, y);
}
var Tilemap__isHigherTile = Tilemap.prototype._isHigherTile;
Tilemap.prototype._isHigherTile = function(tileId) {
var currentTile_invisibleRegion = this._readMapData(temp_mx, temp_my, 5) == invisible_region;
var tileOneBelow_invisibleRegion = this._readMapData(temp_mx, temp_my + 1, 5) == invisible_region;
var playerStandsBelow = $gamePlayer._realY > temp_my;
if (!tileOneBelow_invisibleRegion && playerStandsBelow) { // to show the hat tops
return Tilemap__isHigherTile.call(this, tileId);
}
if (currentTile_invisibleRegion) {
return 0x10;
}
if (tileOneBelow_invisibleRegion && Tilemap.isSameKindTile(tileId, tileId_below)) { // to hide the hat tops
return 0x10;
}
return Tilemap__isHigherTile.call(this, tileId);
};
It can also be found here on his Github.
Last edited:

