ThePreparator

Veteran
Veteran
Joined
Jun 2, 2020
Messages
32
Reaction score
8
First Language
Arabic
Primarily Uses
RMMV
Hello fellow developers!

As many of you may already know of the star passability problem in the A-tilesheet, having looked around for so long without a definitive solution I finally stumbled across this https://forums.rpgmakerweb.com/index.php?threads/cityshrimps-cover-tiles.96380/
CityShrimp's Cover Tiles
It worked just fine but when I used it on a tile that had shadow on it it still worked but it removed the shadow from the tile.
So I decided to fix it and in the process I recreated it so now it's like a complete new plugin!

I've removed all the parts that I didn't need so that the plugin now just adds star passability to tiles.

It's use is pretty straight forward, just cover the tiles you want to have star passability with region ID and they will become star passable i.e. you will be able to walk under them.

In spite of being a programmer I am by no way familiar with either Javascript nor RMMV JS library and with no clear references out there it was pretty hard developing this plugin, so please be aware that this plugin might cause bugs, instability, errors in your game or doesn't work at all!

I tested it and it works fine for me, so you can try using for yourself and see if it works for you.

This piece of code is free for commercial and non-commercial use!

No credit needed!

This plugin is based on CityShrimp's Cover Tiles plugin, link in the description above, so credit goes to CityShrimp.

If you're going to comment, ask a question, request a fix for the plugin I apologize in advance for by 99% most probably I'm not going to answer.

If updates in the plugin are made I'm gonna post them here.

Thank you.


/*=======================================================================

======
* ThePreparator's Star Passability
* TP_StarPassability.js
* Version: 1.0.0
* Free for commercial and non commercial use no credit nedeed!


*========================================================================

=====*/

/*:
* @plugindesc This plugin lets you add star passability to tiles that

don't have it.
*
* @Author ThePreparator
*
* ===Parameter List===
*
* @param Star_Passability
* @desc This region ID will make the tile higher than the player i.e. it

will make you pass under the tile.
* @Default 19
*
* @Help
*

=========================================================================

===
*/

var Imported = Imported || {};
Imported['TP_StarPassability'] = "1.0.0";

var TP_StarPassability = TP_StarPassability || {};

(function($) {
"use strict";

// Load parameters
$.parameters = PluginManager.parameters("TP_StarPassability") || {};
$.Star_Passability = Number($.parameters['Star_Passability'] || 19);


var old_Game_Map_checkPassage = Game_Map.prototype.checkPassage;
Game_Map.prototype.checkPassage = function(x, y, bit) {
var rid = this.regionId(x, y);
if (rid == $.Star_Passability)
return true;
return old_Game_Map_checkPassage.call(this, x, y, bit);
}


ShaderTilemap.prototype._paintTiles = function(startX, startY, x, y)

{
var mx = startX + x;
var my = startY + y;
var dx = x * this._tileWidth, dy = y * this._tileHeight;
var tileId0 = this._readMapData(mx, my, 0);
var tileId1 = this._readMapData(mx, my, 1);
var tileId2 = this._readMapData(mx, my, 2);
var tileId3 = this._readMapData(mx, my, 3);
var shadowBits = this._readMapData(mx, my, 4);
var lowerLayer = this.lowerLayer.children[0];
var upperLayer = this.upperLayer.children[0];



if (this._isHigherTile(tileId0) || $gameMap.regionId(mx, my) ==

$.Star_Passability) {
this._drawTile(upperLayer, tileId0, dx, dy);


} else {
this._drawTile(lowerLayer, tileId0, dx, dy);
}

if (this._isHigherTile(tileId1) || $gameMap.regionId(mx, my) ==

$.Star_Passability) {
this._drawTile(upperLayer, tileId1, dx, dy);

} else {
this._drawTile(lowerLayer, tileId1, dx, dy);
}


if (this._isOverpassPosition(mx, my)) {
this._drawTile(upperLayer, tileId2, dx, dy);
this._drawTile(upperLayer, tileId3, dx, dy);
}



else {

if ((this._isHigherTile(tileId2) || $gameMap.regionId(mx, my)

== $.Star_Passability) || (this._isHigherTile(tileId3) ||

$gameMap.regionId(mx, my) == $.Star_Passability)) {


if ($gameMap.regionId(mx, my) == $.Star_Passability){
this._drawShadow(upperLayer, shadowBits, dx, dy);}
else{this._drawShadow(lowerLayer, shadowBits, dx, dy);}



this._drawTile(lowerLayer, tileId2, dx, dy);
this._drawTile(upperLayer, tileId3, dx, dy);

}

else {
this._drawTile(lowerLayer, tileId2, dx, dy);

this._drawTile(lowerLayer, tileId3, dx, dy);
}


}

};

})(TP_StarPassability);
 

Attachments

  • TP_StarPassability.js
    3.6 KB · Views: 14

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,951
Reaction score
4,870
First Language
EN, FR
Primarily Uses
RMMZ
You should put all that code inside a code tag and inside a spoiler tag.
 

Latest Threads

Latest Profile Posts

Finds notes for an old side project... Oh, that's right, the two tracks that sounded really cool and gave inspiration for the big bad in that game... Spends day working on cutscene from old notes, looks okay, now lets slot in the first track... um... I did have those tracks??? It was a year or so ago but I did buy them didn't I?
CA9mtHJ.gif

Everything is really confusing for me
Well, I'm quickly recovering from Covid, but I'm still broke and injured lol. I miss working on my game! I think I've figured out a lore-friendly way to do a tutorial section separate from the main gameplay, but it'll take some scripting know-how. Which I don't have. And can't afford. :p

Forum statistics

Threads
118,582
Messages
1,117,126
Members
155,650
Latest member
RPyro64
Top