[BUG]Disabling Height Data

First off I want to say that I've been waiting quite some time for this and it is better than expected! Amazing job! Can't wait to see what add-ons you come up with!

After purchasing and downloading, I installed into my project and everything works great so far except one thing. I'm trying to disable the Height Data because in my current project I already have MANY areas set up with the lower numbered region tags for multiple different reasons. (Off topic but if you could let me specify a certain range to use for this besides a hard coded 0 through whatever number I plug into the Core Library, that would be one fix to my problem here) When I set line 56 of the Core Library to false, when I hit enter to start a new game I'm greeting with this error message:

Script 'Khas Ultra Lighting' line 1720: NoMethodError occurred.

undefined method '[]' for nil:NilClass

Has something to do with the fact that the height_map isn't defined since I'm setting it to false. I've tried to add in a boolean return but it looks like there are multiple places throughout all the scripts that rely on height_map being defined.

This bug is present on the demo as well.
Thanks for the compliments! 

Well, Ultra Lighting is based on heightmaps, which are needed to generate shadows. Thus, if you disable height data and don't disable shadows (by setting Enable_Shadows = false), the game will crash. So it's not a bug, it's expected. 

On Khas Core Library the maximum region tag is defined (Max_Region_Height). I will add a Region_Height_Offset, so users can specify a range of regions to work with. Currently, as you said, my script works with 0 to Max_Region_Height. Adding an offset will allow you to select a range and you won't need to disable the height data. Is that alright?

I will wait for a reply before updating the Khas Core Library. Please let me know if you have any more questions/issues/suggestions 😀

Edit:

It's important to say that I choose regions to generate shadows because they are easy to work with and they speed things up!
Ahh that does make sense. It was like 2 AM when I was going through all that and I didn't even think to disable shadows!

But yes, I do want shadows but I have so many region tags already used it would have been easier just to disable shadows altogether instead of redoing all the tags. So that fix would be perfect. Thank you!
If you have multiple scripts using region tags it's pretty hard though as you can only tag each tile with one region tag right? So the other script ur using with region tags might make it hard to use the region tags for the lighting too.


Would it be possible to have an alternative method of setting up the height map? Something specific to this script preferably so that it won't possibly cause any incompatibilities or something. I know there might not be an easy to use alternative.
Since you only need to tag the tiles that are above the current floor level, you only have trouble with multiple floors maps with lots of tags (a very specific case).

I could make another algorithm for generating height data, but it won't be nearly as fast as using tags.
I have a bunch of different custom scripts that I wrote that use region tags for multiple different reasons. For example I wrote a custom jump script that uses region tags for a height map in much the same manner as this light script. I have written them all myself so while it wouldn't be difficult to make them compatible with the shadows portion of this script, it would be VERY time consuming. So I'd rather just disable shadows altogether or specify the range I want to use for the height map instead of going through every single one of my map I've created so far to change the region tags to make sure they don't conflict and cast shadows when they aren't supposed to. The specifying of region tags for use with the shadow height map is a very good alternative since I DO want shadows. 🙂 Thanks again Khas!
I'm back 😀

The requested feature was added to KCL 1.01.

You can find a link to it on the main thread!
You, sir, are a gentleman and a scholar.

Original thread: https://forums.rpgmakerweb.com/threads/bug-disabling-height-data.43945/