Khas Advanced Lighting v4.2 Ultra (now with real-time shadows!)

Veno

Veteran
Veteran
Joined
Sep 8, 2017
Messages
30
Reaction score
15
First Language
English
Primarily Uses
RMMV
I know some folks who have just used it anyways commercial, waiting for him to respond to send the payment. They're going on good intentions and all. I personally don't have to worry about the situation as I'm not using it commercially, and there's not really any good advice to give on if you should or should not do it, so it's up each individual really. It is frustrating, as he has one of the best lighting systems out there.

I've messaged a couple coders trying to get the light issue fixed further (the code I posted above works on lightweight games, but not anything more in depth like busy or large maps, etc). As soon as I have a solution I'll post it here as well as the other thread I mentioned.
 

Sacrifyx

Veteran
Veteran
Joined
Oct 16, 2012
Messages
73
Reaction score
7
First Language
English
Primarily Uses
RMMV
Hey all, is anyone aware of a way to apply a lighting effect to an animation? I have a sequence where a number of lightning bolts hit, but they're no brighter than the rest of the screen (which is darkened for nighttime, I think ambient light is set to 20). I'd like to light those up if at all possible.
 

Veno

Veteran
Veteran
Joined
Sep 8, 2017
Messages
30
Reaction score
15
First Language
English
Primarily Uses
RMMV
Not in the way you're likely thinking, Sacrifyx.
What I've done is some clever trickery to accomplish this, by throwing a switch to play an animation instead.
The switch activates an event that would either play the animation itself (and have a light attached), or activates a separate event that "teleports in" (via yanfly's move core) and provides the light to the source of the animation (since you can adjust the positioning of lights, it's possible to put the light right where you want).

This is not ideal though, but it gives you an option at least.
 

AfroditeOhki

Villager
Member
Joined
Oct 3, 2019
Messages
12
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
People were asking here about making this compatible with Mog's Time System, and I was just working on this now so I thought I'd make a quick and painless guide: there's no need for compatibility.

I just tested and this method works with both shadow and shadowless versions of Khas Lighting.

-In Mog TimeSystem options, set your switches and variables (these are just mine, configure them whatever you want). For this you'll need the Dawn/Sunrise/Day/Sunset/Dusk/Night switches, and if you wanna be fancy, the Season switches as well.
upload_2019-12-10_9-52-27.png

-Configure the Tones to zero everything. This will negate the screen tints done by the TimeSystem plugin.
upload_2019-12-10_9-53-18.png

-Now just create Common Events running on parallel, that require each switch.
upload_2019-12-10_9-56-49.png

You can choose your colors - but if you wanna cheat, here's a list of mine:

-Dawn: 454a57
-Sunrise: eec789
-Day: ffffff (aka no change)
-Sunset: d59e48
-Dusk: 6c90b8
-Night: 45596f

And as you have a common event for everything, you can add whatever there, like light beams from the sun at day time.
 

EuphemiaArtoria

Veteran
Veteran
Joined
Aug 6, 2013
Messages
38
Reaction score
22
First Language
English
I had a spot of bother with this script that I've managed to get around, and I thought I'd share it in case anyone else is in a similar spot.

I found that after adding Khas Core 2.0 to my project, some scripts that I wrote myself with totally unrelated functions broke. I eventually pinned down the part of Khas Core that was giving me grief, and it's this bit at the start:

JavaScript:
  Array.prototype.remove = function(value) {
    var index = this.indexOf(value);
    if (index != -1) {
      this.splice(index, 1);
    };
  };
  Array.prototype.include = function(value) {
    return this.indexOf(value) > -1;
  };
This was blowing up my functions that looked like this:

JavaScript:
    for (x in this.members()) {
        var actor = this.members()[x];
        if (actor.getGrowthLevels() > 0) {
            return true;
        }
    }
What was happening was, "for...in" iterates through all the properties of an object. Normally, $gameParty.members() just has an array of actors in it which I'd iterate through, BUT, when all arrays have the remove and include functions added to them in Khas Core, these are considered properties, and they're iterated through as well. Eventually my code was trying to call "this.members()[include].getGrowthLevels()", which was blowing up because "this.members()[include]" is total nonsense.

After a whole load of reading and advice from friends I found I shouldn't be using "for... in" for iterate through arrays, but "for... of". This is how my code looks now, fixed:

JavaScript:
    for (var actor of $gameParty.members()) {
        if (actor.getGrowthLevels() > 0) {
            return actor;
        }
    }
So, don't use "for... in" to iterate through arrays!

However, I must say, I'm not wild about Khas Core adding methods in array.prototype, especially with generic names like "include" and "remove". This impacts every other script in a project that uses arrays, which is likely most scripts. If another script writer also decides to extend array.prototype with include & remove, it could cause major headaches.

I appreciate that array.include and array.remove are really useful (I see there's discussion a couple years ago about adding them to Ecmascript: https://esdiscuss.org/topic/array-prototype-remove-item ) but making these additions as part of a script just seems very very risky?

Well, anyway, I've shared my experience. Thank you so much for the scripts because the lighting effects are incredibly cool looking!
 

Missrathnen

Warper
Member
Joined
Jan 20, 2020
Messages
1
Reaction score
1
First Language
EN
Primarily Uses
RMMV
Quite a bit of this sort of nuisance is lurking in other authors' plugins :mad: , and I don't think any of the fixed versions of Khas's script that are wafting about address it. Should someone want to fix the issue within Khas Core, changing this:

JavaScript:
  Array.prototype.remove = function(value) {
    var index = this.indexOf(value);
    if (index != -1) {
      this.splice(index, 1);
    };
  };
  Array.prototype.include = function(value) {
    return this.indexOf(value) > -1;
  };
into:

JavaScript:
if (typeof Array.prototype.remove !== 'function') {
  Object.defineProperty(Array.prototype, 'remove', {
    enumerable: false,
    value: function(value) {
      var index = this.indexOf(value);
      if (index != -1) {
        this.splice(index, 1)
      }
    }
  });
}

if (typeof Array.prototype.include !== 'function') {
  Object.defineProperty(Array.prototype, 'include', {
    enumerable: false,
    value: function(value) {
      return this.indexOf(value) >= 0;
    }
  });
}
ought to stop Khas Core from spoiling iterability (the alternative implementation as a global function named "remove" is not super attractive).
 

MikaTeapot

Villager
Member
Joined
Mar 25, 2019
Messages
12
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hi, your bit of code simply breaks all Khas plugins for me, what did I do wrong? No errors, simply no function.

EDIT: OK downloaded Khas core again and tried it, it worked this time, many thanks o/
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Free RPG Maker Ready Charging Up Animation

Enjoy -No Credit Needed But Appreciated -
Download it at https://lvgames.itch.io/free-charging-up-pixel-animation-fx-rpg-maker-ready
:/ .... so, thought I’d go to the park to sit in the cool breeze and get out of the house a little. Nope, guess that’s quarantined too. Ok...
How do you do when you want to work on projects but the game companies make so many games available for free because of the quarantine?
Kes
I have just stepped down from being a Mod, so please don't send me any more pm's with Mod questions. Thanks
Made a brief video showcasing early game play... Got a copyright claim by BIG UP! (https://big-up.style/) for using music I bought from here (Future Steam Punk Pack). Now I wonder if I should strip any purchased music from here out of my game. :LZSskeptic:

Forum statistics

Threads
95,486
Messages
929,499
Members
125,726
Latest member
Truvirian
Top