OcRam - Lights plugin (MZ/MV)

There seems to be a bug in the IsPlayerInLightRadius function: Change Math.ceil to Math.floor.
I posted about this previously: https://forums.rpgmakerweb.com/index.php?threads/ocram-lights-plugin-for-mv.108614/post-1186342

Also if you move the light source using a "light-ex" comment, that doesn't appear to be taken into account when running IsPlayerInLightRadius. That could also be triggering an alert when in darkness or conversely not triggering when lit since the light radius is different to the visible light.
i tried that, changed every case of Math.ceil to Math.floor when in relation to IsPlayerInLightRadius and its still broken
hi, your plugin is awesome, but when I open your website https://ocram-codes.net/ to download it, the web can't be opened.

Edit: It can be opened now, thx. Already opened the demo and I can say, the scenery is very beautifull!
i tried that, changed every case of Math.ceil to Math.floor when in relation to IsPlayerInLightRadius and its still broken
Thank you for the message,

I have floored light radius in link below (instead of Math.ceil).

Here's result: https://ocram-codes.net/vids/InLightRadius.mp4

Is that close enough? (I will add it to next update if it is and give you credits). (But it doesn't yet support "light-ex" rotation and angle - since all checks are character direction based)
Hello Ocram!
I have a short memory, but did I write you about my wish of getting your lights plugin to work with mv3d since at the moment the light source moves all around the screen when moving the player.
Also the event lights moves around as your turn or move your player.
Is it possible to make the lights in one place and also to be hidden behind various 3d models when they are in the way?

My hopes are up <3
Thank you for the message,

I have floored light radius in link below (instead of Math.ceil).

Here's result: https://ocram-codes.net/vids/InLightRadius.mp4

Is that close enough? (I will add it to next update if it is and give you credits). (But it doesn't yet support "light-ex" rotation and angle - since all checks are character direction based)
thanks for replying, yeah looks exactly like what i want for my game! will you release the update soon?
thanks for replying, yeah looks exactly like what i want for my game! will you release the update soon?
I hope to release it next week otherwise it will go to august :/

Hello Ocram!
I have a short memory, but did I write you about my wish of getting your lights plugin to work with mv3d since at the moment the light source moves all around the screen when moving the player.
Also the event lights moves around as your turn or move your player.
Is it possible to make the lights in one place and also to be hidden behind various 3d models when they are in the way?

My hopes are up <3
We were talking about player light fixing center of screen always, but had no talk about events nor lights behind 3d models.

Fixing player light to center would be easy one, but events (and not to mention about ray tracing (3d models before light source) is something I'm not doing anywhere in near future.
Hi OcRam, thanks for your plugin.
Just trying it out and sorry if my question already got answered, I didn't read all 13 pages here...
I have just one question, since you need to use light_bg [color] plugin command to use your plugin.
How do I "translate" the maker command to your plugin command?
E.g. I tint the screen with -50, -50, 0, 0 (1 frame), what do I write in light_bg [color] to achieve the same color?
Thank you for the message,

Tint uses multiply (if I remember correctly) and Light layer is basically copy pasted solid layer of certain color with light sources as "holes".

Also Tint has parameters RGBG while lights uses RGBA.

light_bg command wants color as hex and fade time as seconds (or frames - don't have access to computer to check it atm).

Close as possible for "Tint -50, -50, 0, 0 (1 frame)" would be something like: light_bg #8888ffff 0

88 = red, 88 = green, ff = blue, ff = opacity, over 0 seconds.

But like I said result isn't EXACTLY same because they don't work same way. Only "trial and error" will give the exact color you like to have.

And another example would be: (very dark night blueish color over 4 seconds): light_bg #404080ff 4
Thank you for the message,

Tint uses multiply (if I remember correctly) and Light layer is basically copy pasted solid layer of certain color with light sources as "holes".

Also Tint has parameters RGBG while lights uses RGBA.

light_bg command wants color as hex and fade time as seconds (or frames - don't have access to computer to check it atm).

Close as possible for "Tint -50, -50, 0, 0 (1 frame)" would be something like: light_bg #8888ffff 0

88 = red, 88 = green, ff = blue, ff = opacity, over 0 seconds.

But like I said result isn't EXACTLY same because they don't work same way. Only "trial and error" will give the exact color you like to have.

And another example would be: (very dark night blueish color over 4 seconds): light_bg #404080ff 4
Alright, I see.
Thanks for the fast reply!
I will play around with the numbers to see what they do 🙂
Sorry for double post. I have some problems with your documentation.

For example:
<light:[type:0-9]:[radius:1-1000]:[color:#rrggbbaa]>
This is the comment for light, it has 3 parameters: type, radius and color.

Next you provide an example:

Example for 'fire' put following comment to active page:
*Comment* <light:5:300:#ffdd00ff:360>

This has 4 parameters, I think 5 is the type, 300 the radius, next one the color (of course), but what is 360?

Same with light-ex.
<light-ex:x,y:degrees:angle:rotation:startAt>
Here we have 6 parameters (x, y, degrees, angle, rotation, startAt).

Your example:
Example light source with 60 degree cone, offset 2 tiles up, start angle
45deg and is rotating slowly: *Comment* <light-ex:0,-96:60:45:1>

It has 5 parameters, missing one. Why?

And one more question, besides of my lack of understanding your documentation: What value can opacity be?

You said:
88 = red, 88 = green, ff = blue, ff = opacity, over 0 seconds.
What means ff opacity, how much is that, 255? What other values can it have?
Sorry for double post. I have some problems with your documentation.

For example:
<light:[type:0-9]:[radius:1-1000]:[color:#rrggbbaa]>
This is the comment for light, it has 3 parameters: type, radius and color.

Next you provide an example:

Example for 'fire' put following comment to active page:
*Comment* <light:5:300:#ffdd00ff:360>

This has 4 parameters, I think 5 is the type, 300 the radius, next one the color (of course), but what is 360?

Same with light-ex.
<light-ex:x,y:degrees:angle:rotation:startAt>
Here we have 6 parameters (x, y, degrees, angle, rotation, startAt).

Your example:
Example light source with 60 degree cone, offset 2 tiles up, start angle
45deg and is rotating slowly: *Comment* <light-ex:0,-96:60:45:1>

It has 5 parameters, missing one. Why?

And one more question, besides of my lack of understanding your documentation: What value can opacity be?

You said:

What means ff opacity, how much is that, 255? What other values can it have?
Thank you for pointing out those errors in documentation!

360 in that example does nothing (instead of that you can give color cycle array described later on that documentation). I will add also that "startAt" parameter in "light-ex" example. I will also check that other instructions are up-to-date.

In hex format 0 is minimum and 255 is maximum what you can get with 2 characters (possible characters there are 0-9 and A-F).

Below are some examples:
Hex = Decimal = Bits
00 = 0 = 0000 0000
0A = 10 = 0000 1010
0F = 15 = 0000 1111
10 = 16 = 0001 0000
80 = 128 = 1000 000
FF = 255 = 1111 1111

Hex color coding is an easy way to have over 16,5 million (255 x 255 x 255) different colors!
Thank you! And sorry for being such a noob with hex.
Your plugin is working fine 🙂
I am used to Khas' plugin, because it's really simple. But in my current project it isn't compatible with other plugins, so I needed a substitute and found your plugin. It isn't AS easy as Khas, but easy enough. And it's working with my other plugins 🙂
Last question, my game will be on itch for free, but open for donations. I guess this is considered commercial with your plugin? So I will buy your license soon.
Thanks again for this cool plugin! Glad I found one whose developer is still active.
Thank you! And sorry for being such a noob with hex.
Your plugin is working fine 🙂
I am used to Khas' plugin, because it's really simple. But in my current project it isn't compatible with other plugins, so I needed a substitute and found your plugin. It isn't AS easy as Khas, but easy enough. And it's working with my other plugins 🙂
Last question, my game will be on itch for free, but open for donations. I guess this is considered commercial with your plugin? So I will buy your license soon.
Thanks again for this cool plugin! Glad I found one whose developer is still active.
Hex format is pretty much standard for the colors in HTML/CSS world so I decided to go with it.

Yep, donations are considered as commercial use of OcRam -plugins.

It's always good to hear that OcRam -plugins have helped someone in their projects!
Introduction
This plugin will add 1 layer for light sources. You may use event comments or plugin commands to control different type of light sources. Event comments are processed PER page so you can easily control different types of light sources on same event. You may have multiple different light sources declared in 1 event page!

Light sources for player, followers and events are carried over save/load. Example if you change light source via plugin command it will be saved on game save - and when game is loaded - saved light data will persist!

NOTE: If you use OcRam_Local_Coop/OcRam_Time_System make sure they are up-to-date and imported BEFORE OcRam_Lights -plugin.

Here's what you need:
1. This plugin
2. Configure plugin parameters as you like
3. Add event comments/plugin commands

Spoiler: Tutorial and demo video


Spoiler: Tutorial and demo video for v2.01 extensions


Multiple lights per event (Credits to EthanFox)
NOTE: Officially available only via EVENT comments!
(or advanced JS - need to know basics at least)

Spoiler: Event page setup for multiple lights and cycling colors
Create some crazy looking stuff with kill switch on it!
View attachment 145906
On page 2:
Trigger: Action Button
Condition: "Self Switch D"
* Comment * <light:0>
Control Selft Switch : D = OFF

Use JS conditional check to check in parallel event page if player is in radius.
View attachment 144594

When player is not in event light radius.
View attachment 144596

When player is in event light radius.
View attachment 144595

Spoiler: Vibrant colors and new notation (light-ex)
Vibrant colors + dynamic light cones with angle and possibility to rotate x degrees per frame!
View attachment 122835

New notation technique will give you possibility to combine new parameters with existing light types!
View attachment 122834

All OcRam -plugins now available at ocram-codes.net

Please read:
Terms of Use

Latest version: Download from here

All my plugins: Check 'em out!

Hi!
I used your plugin , but there is a red light around my character that I can't change. Do you have any advice?

Screenshot (41).png


Screenshot (42).png
Hi!
I used your plugin , but there is a red light around my character that I can't change. Do you have any advice?

View attachment 249265

View attachment 249266
Thank you for the message,

Have you tried to change player light to 'none'? And what is your setting for player default light in plugin parameters?
Thank you for the message,

Have you tried to change player light to 'none'? And what is your setting for player default light in plugin parameters?
Thank you for replying! I actually misread the instructions.

Thank you!
So I tried your plugin and it works but I have some questions:
1. for a light comment whats the "360" mean? <light:5:300:#ffdd00ff:360>
2. how do i increase the brightness of the fire? I want it to be as bright as the flashlight
3. "light-ex" changes offset, degrees, angle and rotation. but its not necessary to use "light-ex", right?
1. Nothing, it is a mistake in the documentation. The accepted format is <light:type:radius:color>
2. color is rgba so use FF for the last ones. Also you can try a brighter color or darker environment
3. It is necessary to focus the light (portion of circle) instead of being circular
1. Nothing, it is a mistake in the documentation. The accepted format is <light:type:radius:color>
2. color is rgba so use FF for the last ones. Also you can try a brighter color or darker environment
3. It is necessary to focus the light (portion of circle) instead of being circular
1. oh ok 🙂
2. i had tried that already, i guess this type of light is not meant to be as bright
3. for the fire i dont need it then since circular light is good for it, not a portion
2. i had tried that already, i guess this type of light is not meant to be as bright
Can you post a screenshot and you code? maybe there is a way

Original thread: https://forums.rpgmakerweb.com/threads/ocram-lights-plugin-mz-mv.108614/