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

Veno

Veteran
Veteran
Joined
Sep 8, 2017
Messages
61
Reaction score
120
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
61
Reaction score
120
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

Veteran
Veteran
Joined
Oct 3, 2019
Messages
65
Reaction score
79
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
60
Reaction score
64
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
17
Reaction score
3
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:

RoxaDragonheart

Villager
Member
Joined
Nov 5, 2017
Messages
28
Reaction score
5
First Language
German
Primarily Uses
RMMV
Hi,
is there a possibility to give a party member/ a follower a light?

When I did use RPG Maker VX, there was also a Khas Lighting plug in and I was able to make a party member have a torch by adding a command in the comment section of the party member in the database.

Now I am useing RPG Maker Mv and the Khas Ultra lighting plug in, but I can't find the command for party member lights.
Maybe I am just blind, or search for the wrong command.

Can someone help me please?
 

GraySorrow

Veteran
Veteran
Joined
Feb 18, 2016
Messages
32
Reaction score
5
First Language
English
Primarily Uses
Hey doods. Great plugin. Found a weird issue i was hoping someone could help with. After i deploy my game the Lighting from Khas are EXTREMELY tiny. Shown Below.

Any idea how i could fix this? or do you think this is just a compatibility bug with [Ultra Mode 7] which im using as a base for my entire game?\
Ultra Mode 7 - https://forums.rpgmakerweb.com/index.php?threads/ultra-mode-7.94100/

Also, the shadows dont work AT ALL. not even in testing. they stay REALLY tiny as if Ultra Mode 7 isnt active and im all the way zoomed out. Might just be a compat issue. Im not worried about the RT shadows though so dont worry yourself about that. The lighting is whats important to me first and foremost\

Heres what it looks like in the editor (how its supposed to look like.) but it ends up being a REALLY tiny light instead.
 

Attachments

Last edited:

RoxaDragonheart

Villager
Member
Joined
Nov 5, 2017
Messages
28
Reaction score
5
First Language
German
Primarily Uses
RMMV
Any idea how i could fix this? or do you think this is just a compatibility bug with [Ultra Mode 7] which im using as a base for my entire game?\
Ultra
I don't know if you tested that yet, but you can change the size of the event lights by useing [light_size x] (in a comment) where x must be a number betwenn 0 and 1000. Number 100 is the default size of the light. So everything above 100 is a bigger light and everything below is a smaler light.

For the flashlight that you use to be offset or bigger, I didn't find a solution to change it via a event or skript, but you can add a new costume light with a bigger size and more space on the upper side to make your charakter hold it lower. You can find a tutorial for costume lights here: http://arcthunder.blogspot.com/p/tutorial-advanced-lighting.html

(Eventually if you only want to use the flashlight in this way, you can also simply change the flashlight image files. Open them in gimp or what ever you use and change the size of the image and place the light lower on the bottom.)


Edit:

sorry I think I first missunderstood your problem.
But you can try the costume lights and changeing lights thing maybe to see if it has an effect. I hope someone else can help you more ^^"
 
Last edited:

ddblue

新人
Veteran
Joined
Apr 9, 2013
Messages
132
Reaction score
16
First Language
English
Primarily Uses
it's unfortunate, how to pay for the rights of the plugin, I also use the Fog.
I think marketing anyway by making a message, I pay him when I have an answer.
Out of curiosity, wouldn't your best bet be to just send him the money, screenshot the receipt and the current terms, and hold onto those just in case?
 

GraySorrow

Veteran
Veteran
Joined
Feb 18, 2016
Messages
32
Reaction score
5
First Language
English
Primarily Uses
I don't know if you tested that yet, but you can change the size of the event lights by useing [light_size x] (in a comment) where x must be a number betwenn 0 and 1000. Number 100 is the default size of the light. So everything above 100 is a bigger light and everything below is a smaler light.

For the flashlight that you use to be offset or bigger, I didn't find a solution to change it via a event or skript, but you can add a new costume light with a bigger size and more space on the upper side to make your charakter hold it lower. You can find a tutorial for costume lights here: http://arcthunder.blogspot.com/p/tutorial-advanced-lighting.html

(Eventually if you only want to use the flashlight in this way, you can also simply change the flashlight image files. Open them in gimp or what ever you use and change the size of the image and place the light lower on the bottom.)


Edit:

sorry I think I first missunderstood your problem.
But you can try the costume lights and changeing lights thing maybe to see if it has an effect. I hope someone else can help you more ^^"
Hey yeah you kinda misunderstood but its all cool. Changing the light sizes does nothing at all. its like in the editor everything registers normally but when i deploy it, it doesnt register the same way it did in the editor. Also i know/can change the size of the flashlight. i just gotta take the flashlight pngs into photoshop and shape them how i like there. But yeah i even posted about this on Ultra mode 7 forum but no response yet. i really hope theres a way i can fix this because i have been going insane trying to fix this myself so i can make a alpha for my game for others to playtest.
 

GraySorrow

Veteran
Veteran
Joined
Feb 18, 2016
Messages
32
Reaction score
5
First Language
English
Primarily Uses
Hey yeah you kinda misunderstood but its all cool. Changing the light sizes does nothing at all. its like in the editor everything registers normally but when i deploy it, it doesnt register the same way it did in the editor. Also i know/can change the size of the flashlight. i just gotta take the flashlight pngs into photoshop and shape them how i like there. But yeah i even posted about this on Ultra mode 7 forum but no response yet. i really hope theres a way i can fix this because i have been going insane trying to fix this myself so i can make a alpha for my game for others to playtest.
So ive been messing around the last few days trying to find a fix and i havent found anything to fix the Khas lighting bug yet. I decided to just use Terrax lighting for now until khas gets that bug fix(if it ever does) if not ill just stick with terrax. But yeah, terrax lighting lightsources work just fine when the game is deployed. The regionblocking stuff doesnt work but thats fine i think i can work around it. If anyone comes up with anything for my previous bug i posted please share anyways. I would love to use khas over terrax.
 

ddblue

新人
Veteran
Joined
Apr 9, 2013
Messages
132
Reaction score
16
First Language
English
Primarily Uses
Can anyone help with an issue I am having with this plugin?

The issue is as follows:

1. Use the plugin command Lighting ON/OFF kill switch to turn the plugin off
2. Open menu in-game
3. Close menu

Screen goes black and nothing can be done.
Issue doesn't occur if the switch is not used.

Is there an easy way to fix this?

Any help would be greatly appreciated.
 

MikaTeapot

Villager
Member
Joined
Mar 25, 2019
Messages
17
Reaction score
3
First Language
English
Primarily Uses
RMMV
Has anyone encountered an intermittent fps drop with this plugin? For some reason on maps with higher number of events such as towns, even with that map using 0 lights, I drop from 60 to 50 fps every 4-5 seconds with a noticeable stutter. It doesn't happen in the dungeons I am actually USING the lighting so... Going to try just turning lighting off and on in dungeons for now.
 

Kneeshaw

Kneeshaw Developments
Veteran
Joined
Dec 2, 2015
Messages
46
Reaction score
45
First Language
French
Primarily Uses
RMMV
Can anyone help with an issue I am having with this plugin?

The issue is as follows:

1. Use the plugin command Lighting ON/OFF kill switch to turn the plugin off
2. Open menu in-game
3. Close menu

Screen goes black and nothing can be done.
Issue doesn't occur if the switch is not used.

Is there an easy way to fix this?

Any help would be greatly appreciated.
I had this problem whenever I disabled the plugin. I just set days or off to be AmbientLight 100
 

BLKNeko

Warper
Member
Joined
Nov 2, 2019
Messages
2
Reaction score
0
First Language
Brazilian
Primarily Uses
RMMV
hey, sorry for asking, any one knows how to make lights pulse with this plugin ?
 

ddblue

新人
Veteran
Joined
Apr 9, 2013
Messages
132
Reaction score
16
First Language
English
Primarily Uses
I had this problem whenever I disabled the plugin. I just set days or off to be AmbientLight 100
This works, but when used on a map with layers (in my case, Galv's MV Layers plugin), it causes a very noticeable framedrop every so often. In console it reads:

[Violation] 'requestAnimationFrame' handler took 420ms

It happens every 5-10 seconds with a different ms value.

I actually paid a coder to fix the turning off problem, but ideally I'd like to use both a layers plugin AND this lighting plugin together at the same time.

And MikaTeapot, are you using a layers plugin with this?
 
Last edited:

MikaTeapot

Villager
Member
Joined
Mar 25, 2019
Messages
17
Reaction score
3
First Language
English
Primarily Uses
RMMV
I was yes, but it would happen even on maps without layers and in the end I just removed it ^^
 

Kong

Veteran
Veteran
Joined
Jun 19, 2016
Messages
33
Reaction score
7
First Language
German
[Violation] 'requestAnimationFrame' handler took 420ms

It happens every 5-10 seconds with a different ms value.
Dude that's the exact same problem I have.
The Plugin is awesome but the framedrop is unbearable.
If you somehow fixed it I'd really wanna know how :<
 

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

Latest Threads

Latest Posts

Latest Profile Posts

The sinking feeling when you realize your grandmother probably isn't long for this world, and the frustration when you know that this pandemic will take her away...not because she has Covid, but because no doctor is willing to see a patient to even run simple diagnostics anymore if one of her symptoms happens to be a recurring fever, even if her primary care physician gives her the test and it comes back negative.
Will be revealing my project to the forum soon.
Ohboi, I'mma learning how to mix/sing better warming up (by singing game songs) for eventually singing my team's game's main theme. (Plus singing for my Patrons XD)
For anyone using my Extended Generator, would you like a discord server where you can exchange ideas, help, suggestions and news about the development ?

Forum statistics

Threads
99,606
Messages
967,233
Members
131,281
Latest member
isabelx10
Top