Hello RPG Makers,
so I'm having fun with plugins last few weeks on RPG Maker MV 1.5.1, and I stumbled on the Khas Ultra Lighting plugin, which looks amazing. (quick link to his work here : http://arcthunder.blogspot.ca/p/rpg-maker-mv-plugins.html )
So the lighting plugin uses the R tileset numbers to tag walls and their height. To do so, it takes the number used, divide it by 10, and assume it's the wall height. I think the idea is interesting, but here comes my problem :
The plugin also consider that any number used is eligible for the above process, as it round down the result after dividing by 10. So every number from 10 to 19 does the same thing, resulting in a wall height tagging of 1. The thing is, such system takes 246 tiles of 255, only letting the 9 first numbers to use for other purposes.
Some screenshots to illustrate :
I want a hiding area with the tag 13 using Yanfly script :
But the light system is breaking :
So here is my question : is there a way to fix this ?
I am pretty sure I won't have walls higher than 9 tiles...
I made some digging by myself, and found this function :
As far as I understand, there could be 2 ways to solve the problem :
1 - Making any number which is not a multiple of 10 considered as 0, or ignored by the script
2 - Getting rid off the "divide by 10" portion, only tagging tiles from 1 to 9. But it would also mean to make the script ignore numbers higher than 9.
My Javascript knowledge is sadly very limited, so that's why I'm posting here, searching clues, better ways to achieve my goal, or even learn how to efficiently modify the code to fit my needs.
Thanks for your attention, I hope I will read your answers soon 😉
PS : Sorry if my english is a little clunky
so I'm having fun with plugins last few weeks on RPG Maker MV 1.5.1, and I stumbled on the Khas Ultra Lighting plugin, which looks amazing. (quick link to his work here : http://arcthunder.blogspot.ca/p/rpg-maker-mv-plugins.html )
So the lighting plugin uses the R tileset numbers to tag walls and their height. To do so, it takes the number used, divide it by 10, and assume it's the wall height. I think the idea is interesting, but here comes my problem :
The plugin also consider that any number used is eligible for the above process, as it round down the result after dividing by 10. So every number from 10 to 19 does the same thing, resulting in a wall height tagging of 1. The thing is, such system takes 246 tiles of 255, only letting the 9 first numbers to use for other purposes.
Some screenshots to illustrate :
I want a hiding area with the tag 13 using Yanfly script :
But the light system is breaking :
So here is my question : is there a way to fix this ?
I am pretty sure I won't have walls higher than 9 tiles...
I made some digging by myself, and found this function :
Game_Map.prototype.genHeightMap = function() {
this._heightMap = [];
for (var x = 0; x < this.width(); x++) {
this._heightMap.push([]);
for (var y = 0; y < this.height(); y++) {
var h = Math.floor(this.regionId(x, y) / 10) * 2;
this._heightMap[x].push(h);
};
};
for (var x = 0; x < this.width(); x++) {
for (var y = 0; y < this.height(); y++) {
var h = this._heightMap[x][y];
var nh = this.getHeight(x, y + 1);
if (h > 0 && this.isFloor(x, y) && h > nh) {
h -= 1;
var dy = 1;
while (h > 0 && (nh == 0 || h - 1 > nh) && this.isValid(x, y + dy)) {
this.setHeight(x, y + dy, h);
h -= 2;
dy += 1;
if (this.isValid(x, y + dy)) nh = this.getHeight(x, y + dy);
};
};
};
};
};
this._heightMap = [];
for (var x = 0; x < this.width(); x++) {
this._heightMap.push([]);
for (var y = 0; y < this.height(); y++) {
var h = Math.floor(this.regionId(x, y) / 10) * 2;
this._heightMap[x].push(h);
};
};
for (var x = 0; x < this.width(); x++) {
for (var y = 0; y < this.height(); y++) {
var h = this._heightMap[x][y];
var nh = this.getHeight(x, y + 1);
if (h > 0 && this.isFloor(x, y) && h > nh) {
h -= 1;
var dy = 1;
while (h > 0 && (nh == 0 || h - 1 > nh) && this.isValid(x, y + dy)) {
this.setHeight(x, y + dy, h);
h -= 2;
dy += 1;
if (this.isValid(x, y + dy)) nh = this.getHeight(x, y + dy);
};
};
};
};
};
As far as I understand, there could be 2 ways to solve the problem :
1 - Making any number which is not a multiple of 10 considered as 0, or ignored by the script
2 - Getting rid off the "divide by 10" portion, only tagging tiles from 1 to 9. But it would also mean to make the script ignore numbers higher than 9.
My Javascript knowledge is sadly very limited, so that's why I'm posting here, searching clues, better ways to achieve my goal, or even learn how to efficiently modify the code to fit my needs.
Thanks for your attention, I hope I will read your answers soon 😉
PS : Sorry if my english is a little clunky