OcRam - Lights plugin (MZ/MV)

Can you confirm it's working on your environment?
Yes, everything works in this project. To reproduce the bug you need to change the tileset of the starting map to any other than the tileset on which the light is declared.
Yes, everything works in this project. To reproduce the bug you need to change the tileset of the starting map to any other than the tileset on which the light is declared.
Thanks for the clarification!
I will try to fix it later today.
Latest version of OcRam_Lights is now available!

v2.11 Terrain lights are now properly initialized (Credits to @Warpholomey )
First: Thanks for the great plugin.

My request is that it would be nice to be able to set the Z axis for Lighting. Because sometimes I want a light in the background of the actor.
If you already have that feature, please let me know how.

Also, I'm setting Layer to Highest in the YEP_GridFreeDoodads plugin, but this Lighting plugin comes up higher.
@OcRam, hi again!
Is it possible to make background light is not applied to parallax?
I'm working on a night map (which itself is quite dark and illuminated by lanterns), but I use a city panorama as a parallax — I wish the background light didn't affect it (didn't make it darker), so that I can manually draw bright lights on it.
Is it possible to achieve this somehow?
First: Thanks for the great plugin.

My request is that it would be nice to be able to set the Z axis for Lighting. Because sometimes I want a light in the background of the actor.
If you already have that feature, please let me know how.

Also, I'm setting Layer to Highest in the YEP_GridFreeDoodads plugin, but this Lighting plugin comes up higher.
@OcRam, hi again!
Is it possible to make background light is not applied to parallax?
I'm working on a night map (which itself is quite dark and illuminated by lanterns), but I use a city panorama as a parallax — I wish the background light didn't affect it (didn't make it darker), so that I can manually draw bright lights on it.
Is it possible to achieve this somehow?
Thank you for the messages,

Light layer is indeed highest of 'em all and there's little I can do about it with out breaking things up. This is also the case with parallax backgrounds. I have solved this issue (too dark backgrounds) with editing backgrounds brightness to brighter.
Thank you for the messages,

Light layer is indeed highest of 'em all and there's little I can do about it with out breaking things up. This is also the case with parallax backgrounds. I have solved this issue (too dark backgrounds) with editing backgrounds brightness to brighter.

I was able to achieve the effect I wanted by adding a custom mask to the darkening code.
Something like this:

JavaScript:
    OcRam_Light_Layer.prototype.updateMapLights = function () {

        this.clearLightLayer(); // Remove old sprites (light sources)
        if (_tintBG === '') return; // No lights...

        // Draw light layer background
        var c = this._bg.canvas; var ctx = c.getContext("2d");
        ctx.globalCompositeOperation = 'copy';
        this._bg.fillRect(0, 0, this._width, this._height, _tintBG);

        // ===============
        // Applying masks:
        // ===============
        ctx.globalCompositeOperation = "source-over";
        $gameMap._events.forEach(ev => {
            if (ev !== null) {
                if (ev._lightningMaskBitmap === undefined) {
                    const e = ev.event();
                    if (e.note.match(/<(?:MASK):(.*)>/i)) {
                        ev._lightningMaskBitmap = ImageManager.loadPicture(RegExp.$1);
                    } else {
                        ev._lightningMaskBitmap = "";
                    }
                }

                if (ev._lightningMaskBitmap !== undefined && ev._lightningMaskBitmap !== "") {
                    this._bg.bltImage(
                        ev._lightningMaskBitmap,
                        0,
                        0,
                        ev._lightningMaskBitmap.width,
                        ev._lightningMaskBitmap.height,
                        _margin + Math.round($gameMap.adjustX_OC(ev._realX) * OcRam.twh[0]),
                        _margin + Math.round($gameMap.adjustY_OC(ev._realY) * OcRam.twh[1]));
                }
            }
        });

This allows to put an event on the map, which will apply the specified mask to the darkened area, so that some part remains light.

I don't think that should be added to the plugin itself — it's still a very specific task, but if it seems like a good idea to you, it would be great if you make it a built-in feature.
Hi! OcRam.
I use the plugin command light_followers 5 150 #ffeeaa88
The follower’s lighting control is processed in parallel through public events, but there is a bug,
I changed the maximum battle member and follower member to 5 through YEP_PartySystem (to be precise, or change the Max Battle Members to more than 4 through any code or plugin)
When you save the file when the lighting system is started, and then read the file, an error will occur. It seems that the follower’s lights cannot be updated correctly. This is also true in your demo. Can you fix it? Or can you add the control of the follower's light in the plug-in parameters?

·Error screenshot
QQ截图20200921210424.png
I'm not sure if anyone has pointed it out yet, but Light option number 4 doesn't seem to be flickering at all. I've tried it out on the demo, a new project, and a current project I'm working on. 4 just seems to work the same as option 1.
Hi! OcRam.
I use the plugin command light_followers 5 150 #ffeeaa88
The follower’s lighting control is processed in parallel through public events, but there is a bug,
I changed the maximum battle member and follower member to 5 through YEP_PartySystem (to be precise, or change the Max Battle Members to more than 4 through any code or plugin)
When you save the file when the lighting system is started, and then read the file, an error will occur. It seems that the follower’s lights cannot be updated correctly. This is also true in your demo. Can you fix it? Or can you add the control of the follower's light in the plug-in parameters?

·Error screenshot
View attachment 161396
I'm not sure if anyone has pointed it out yet, but Light option number 4 doesn't seem to be flickering at all. I've tried it out on the demo, a new project, and a current project I'm working on. 4 just seems to work the same as option 1.
First of all thank you for your messages!

And sorry for the late answer - I have been busy with my RMMZ demo project, but now that it's done I can focus to MV again.

I need download links to plugins which needs compatibility patch. Then I take look at it. Usually compatibility patches ain't that hard to do, but if it takes longer than 4-6 hours I prefer to use that time on my MZ -plugins.

@Flanxei I'll take look at this bug ASAP
EDIT: And it's now updated to v2.12 ;p
It is not related to any plug-ins, I just made a simple code. Make the fighting members more than 4.
JavaScript:
Game_Party.prototype.maxBattleMembers = function() {
return 5;
};

Then turn on the lights of all followers, and after saving, an error will occur when reading.
It does not seem to support follower lights with more than 4 people
Hello @OcRam

I just tried your plugin in a new project and I got this error when I tried the command to darken my map.

Bbs7Rnc.png

2gLaJzQ.png

.
i2iy7W0.png
Have the same Problem. Plugin is on, did the Plugin Command with light_bg and then on a event <light...> but nothing happen 🙁
It is not related to any plug-ins, I just made a simple code. Make the fighting members more than 4.
JavaScript:
Game_Party.prototype.maxBattleMembers = function() {
return 5;
};

Then turn on the lights of all followers, and after saving, an error will occur when reading.
It does not seem to support follower lights with more than 4 people
Hello @OcRam

I just tried your plugin in a new project and I got this error when I tried the command to darken my map.

Bbs7Rnc.png

2gLaJzQ.png

.
i2iy7W0.png
Have the same Problem. Plugin is on, did the Plugin Command with light_bg and then on a event <light...> but nothing happen 🙁
Thank you for the messages,

I have tried this plugin in new project without any of mentioned problems. What is the version of rpg_core.js in it?
1.6.2 - its the newest one.
1.6.2 - its the newest one.
Can you send screen shot of light_bg event and the light source event where <light...> tag is?
It is not related to any plug-ins, I just made a simple code. Make the fighting members more than 4.
JavaScript:
Game_Party.prototype.maxBattleMembers = function() {
return 5;
};

Then turn on the lights of all followers, and after saving, an error will occur when reading.
It does not seem to support follower lights with more than 4 people
I am using 1.6.1
And it's experimented in your demo. As long as maxBattleMembers exceeds 4
At night, use the plug-in command light_followers 5 150 #ffeeaa88 to turn on the lights of all followers. And save the game at this time. Then read this archive, an error will occur.
In addition, I did not have the problem mentioned by the above friends, I used the plug-in command light_bg #303040ff 1 to change the light background without any errors. But after using the plug-in command to replace the background light, the background light no longer automatically switches according to the time system😳
I am using 1.6.1
And it's experimented in your demo. As long as maxBattleMembers exceeds 4
At night, use the plug-in command light_followers 5 150 #ffeeaa88 to turn on the lights of all followers. And save the game at this time. Then read this archive, an error will occur.
In addition, I did not have the problem mentioned by the above friends, I used the plug-in command light_bg #303040ff 1 to change the light background without any errors. But after using the plug-in command to replace the background light, the background light no longer automatically switches according to the time system😳
Thank you for the additional info. I will re-check maxBattleMembers case.

And if light_bg is used it will override any tints made by time system (until player is transfered to another map).
Ok now I managed to replicate "maxBattleMembers" issue and its now fixed in OcRam_Lights v2.13!

I actually had to add 1 extra member 🙄

Thank you @41728280 for reporting this!
Thanks for your fix, the archive can now be read correctly👍

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