OcRam - Lights plugin

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
Thank you for the message @DesVerides ,

I think that's "Elements" tab - I need information on "Console" tab :)

Also I have released new version, below more information.

Latest version - v2.06 (released 2020/05/21)
  • New plugin command light_player_ex and same for followers
    Now you may change player and follower light-ex parameters via plugin commands!

  • New light-ex param: startAt (starts light gradient at %)
    I always thought that flashlight shouldn't have so pointy start. Now you may adjust cones' gradient relative start position from light source epicenter.

  • New plugin param: "Flashlight up fix value"
    Now that you may tamper with light cone startAt parameter. It's natural to have flashlight Y fix value as parameter. Find best value for your settings.

  • New JS calls for player, follower and event objects to get all objects in current light radius
    How cool this can be?! Quest: Find something in dark room only with your flashlight! -or- Escape dark dungeon without any guard can see you! Etc...

  • Game events will have additional isPlayerInLightRadius() -function
    Same as above, but algorithm is more efficient and it will return true/false instead of object array.

  • Credits to @rohzek and @PresaDePrata for ideas for this patch!

    NOTE: This is just an example and there are tons of different methods to do this differently.

    Use JS conditional check to check in parallel event page if player is in radius.
    event_page_light_radius_check.jpg


    When player is not in event light radius.
    light_radius_check_not_in_sight.jpg

    When player is in event light radius.
    light_radius_check_in_sight.jpg
 

DesVerides

Warper
Member
Joined
May 12, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thank you for the message @DesVerides ,

I think that's "Elements" tab - I need information on "Console" tab :)
You are definitely right, my mistake! Here is the actual console tab:
Code:
rpg_managers.js:1949 TypeError: Cannot read property 'r' of null
    at Light_Data.update (js/plugins/OcRam_Lights.js:1121)
    at js/plugins/OcRam_Lights.js:1266
    at Array.forEach (<anonymous>)
    at OcRam_Light_Layer.updateMapLights (js/plugins/OcRam_Lights.js:1264)
    at Spriteset_Map.<anonymous> (js/plugins/OcRam_Lights.js:974)
    at Spriteset_Map.c.(anonymous function) [as update] (chrome-extension://odlameecjipmbmbejkplpemijjgpljce/js/plugins/OcRam_Lights.js:28:135)
    at rpg_scenes.js:262
    at Array.forEach (<anonymous>)
    at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
    at Scene_Map.Scene_Base.update (rpg_scenes.js:113)
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
You are definitely right, my mistake! Here is the actual console tab:
Code:
rpg_managers.js:1949 TypeError: Cannot read property 'r' of null
    at Light_Data.update (js/plugins/OcRam_Lights.js:1121)
    at js/plugins/OcRam_Lights.js:1266
    at Array.forEach (<anonymous>)
    at OcRam_Light_Layer.updateMapLights (js/plugins/OcRam_Lights.js:1264)
    at Spriteset_Map.<anonymous> (js/plugins/OcRam_Lights.js:974)
    at Spriteset_Map.c.(anonymous function) [as update] (chrome-extension://odlameecjipmbmbejkplpemijjgpljce/js/plugins/OcRam_Lights.js:28:135)
    at rpg_scenes.js:262
    at Array.forEach (<anonymous>)
    at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
    at Scene_Map.Scene_Base.update (rpg_scenes.js:113)
Thank you for the report,

Line numbers seems very odd... what version of Lights -plugin are we talking about?

But it is most certainly related to light source color parameter (it is missing or in invalid format).
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,177
Reaction score
246
First Language
English
Primarily Uses
N/A
Curious to try this plugin, but before I do so since my project is currently using Kha's various light plugins but I am having difficulty with events lighting, specifically torches and cycling through different colours.

I'm after assigning large sprite events like cars with lights and the ability to have said events turn them off by plugin commands or script calls, police lights are also something I would like to tamper with having them cycle through 3 colours but given the current circumstances I can't do it with common events and having multiple pages removes functionality on other things like follow commands and such.
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
Thank you for the message,
I will implement light source color cycles to next version.

light_cycles eventId fade_time [color1,color2,etc...]

If fade time is negative number fade will be curved otherwise it will be linear.

eventId:
-1 = player, -2 to -4 followers, positive numbers are corresponding eventId.

Also all objects will have setLightCycle(fade, colors) method.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,167
Reaction score
710
First Language
Dutch
Primarily Uses
RMMV
I hope for a demo for it, so I can learn from it. While Khas is nice, and region light, this one have more potentional
on the other hand khas doesn't have.

It might be a more complex to use, but it will be worth it ^^
 

dragonx777

Veteran
Veteran
Joined
Jan 25, 2015
Messages
137
Reaction score
44
First Language
English
Primarily Uses
RMMV
I hope for a demo for it, so I can learn from it. While Khas is nice, and region light, this one have more potentional
on the other hand khas doesn't have.

It might be a more complex to use, but it will be worth it ^^
This is by far the best light plugin I’ve seen. It can be a bit of work to get fancy effects, but for me, making the simple things like a campfire or light post or torch easy to implement scores high in my book. This with Ocram’s other plugins and the game immersion factor is off the scale.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,167
Reaction score
710
First Language
Dutch
Primarily Uses
RMMV
I saw a plugin (very early alpha dev) with nice torch particals, magic particals etc,
can be neat if that is or become available, it can even fire the player :p

found here (2:24 for torch), (8:30 for player on fire), but that pixi effect in this light plugin,
would be way to hard, while i require pixi, and probably pixi edit while I got the demo to play with.
but it can add some neat light to the torch once that plugin is stable.

the only thing this plugin is basicly missing is the shadow that khas has, but it might be added
in the near future or never :D. he does already a nice job creating this, and fix issues within a week
when possible or a compability issue.
 

PresaDePrata

Veteran
Veteran
Joined
Dec 4, 2014
Messages
90
Reaction score
18
First Language
Portuguese
Primarily Uses
RMMV
Thank you for the message @DesVerides ,

I think that's "Elements" tab - I need information on "Console" tab :)

Also I have released new version, below more information.

Latest version - v2.06 (released 2020/05/21)
  • New plugin command light_player_ex and same for followers
    Now you may change player and follower light-ex parameters via plugin commands!

  • New light-ex param: startAt (starts light gradient at %)
    I always thought that flashlight shouldn't have so pointy start. Now you may adjust cones' gradient relative start position from light source epicenter.

  • New plugin param: "Flashlight up fix value"
    Now that you may tamper with light cone startAt parameter. It's natural to have flashlight Y fix value as parameter. Find best value for your settings.

  • New JS calls for player, follower and event objects to get all objects in current light radius
    How cool this can be?! Quest: Find something in dark room only with your flashlight! -or- Escape dark dungeon without any guard can see you! Etc...

  • Game events will have additional isPlayerInLightRadius() -function
    Same as above, but algorithm is more efficient and it will return true/false instead of object array.

  • Credits to @rohzek and @PresaDePrata for ideas for this patch!

    NOTE: This is just an example and there are tons of different methods to do this differently.

    Use JS conditional check to check in parallel event page if player is in radius.
    event_page_light_radius_check.jpg


    When player is not in event light radius.
    light_radius_check_not_in_sight.jpg

    When player is in event light radius.
    light_radius_check_in_sight.jpg
Amazing work, OcRam! Thanks for inserting my suggestions.
 

dragonx777

Veteran
Veteran
Joined
Jan 25, 2015
Messages
137
Reaction score
44
First Language
English
Primarily Uses
RMMV
I might be completely stupid when it comes to setting up advance lights lol. I want to know if there is a way to make a light source (street lamp for example) where it doesn’t have a full 360 degree radius but gives the illusion of illuminating like a normal street lamp (beneath with arc).

another thing I thought about would be if there was a way to stop the light of it hits a wall but still look natural.

thanks much!
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
I might be completely stupid when it comes to setting up advance lights lol. I want to know if there is a way to make a light source (street lamp for example) where it doesn’t have a full 360 degree radius but gives the illusion of illuminating like a normal street lamp (beneath with arc).

another thing I thought about would be if there was a way to stop the light of it hits a wall but still look natural.

thanks much!
Hi,

There are many ways to set/edit light sources.

But if you want to set degrees and angles (or even rotation) then light-ex params are needed (comments or via plugin commands).

Comment syntax is:
*Comment* <light:[type:0-9]:[radius:1-1000]:[color:#rrggbbaa]>
*Comment* <light-ex:x,y:degrees:angle:rotation:startAt>

Easiest way to do this >> set comments to ACTIVE event page (this is just an example):
* Comment * <light:3:300:#ffeeaa88>
* Comment * <light-ex:0,0:60:-90:0:0.1>

lights-ex.jpg

EDIT: Oh and shadows are WIP (no schedule atm - but I wouldn't expect it to be ready in near future)
 

dragonx777

Veteran
Veteran
Joined
Jan 25, 2015
Messages
137
Reaction score
44
First Language
English
Primarily Uses
RMMV
Hi,

There are many ways to set/edit light sources.

But if you want to set degrees and angles (or even rotation) then light-ex params are needed (comments or via plugin commands).

Comment syntax is:
*Comment* <light:[type:0-9]:[radius:1-1000]:[color:#rrggbbaa]>
*Comment* <light-ex:x,y:degrees:angle:rotation:startAt>

Easiest way to do this >> set comments to ACTIVE event page (this is just an example):
* Comment * <light:3:300:#ffeeaa88>
* Comment * <light-ex:0,0:60:-90:0:0.1>

View attachment 145471

EDIT: Oh and shadows are WIP (no schedule atm - but I wouldn't expect it to be ready in near future)
cool. This works well. And I know that shadows can be a pain to implement. Thanks for all the hard work.
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
Latest version - v2.07 (released 2020/05/30)
  • Fixed Bug: Clears light data when exited to menu

  • Fixed bug where "Test event" crashed game
    Requires OcRam_Core v1.5 (Credits to @jjraymonds )

  • Added color cycles to all light sources!
    Use new syntax and replace color param with it. (Credits to @Skurge )

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


    Create some crazy looking stuff with kill switch on it!

    multiple_lights.jpg


    On page 2:
    Trigger: Action Button
    Condition: "Self Switch D"
    * Comment * <light:0>
    Control Selft Switch : D = OFF

EDIT: Noticed that old save files won't load in v2.07 because of multiple lights update. Released backward compatible update v2.08 where this issue is fixed.

Latest version - v2.08 (released 2020/05/31)

  • Backward compatible with save files that have been created before v2.07 (before multiple lights update)
 
Last edited:

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,167
Reaction score
710
First Language
Dutch
Primarily Uses
RMMV
would you be able to make a master package with all plugins (updated) to latest version.
so you wont need to search for each plugin?

otherwise, amazing job as always. (still hoping on a demo to playtest it with your plugins how
everything works ^^
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,177
Reaction score
246
First Language
English
Primarily Uses
N/A
Just curious since I'm using yanfly's light plugins as a general environment light source, how you would position this plugin to avoid conflicts with others? I really want to use the plugin and follow up with some examples of how they look in game :)
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
Just curious since I'm using yanfly's light plugins as a general environment light source, how you would position this plugin to avoid conflicts with others? I really want to use the plugin and follow up with some examples of how they look in game :)
Hi, can you link the plugin can't seem to find it?
 

2biim2

Warper
Member
Joined
May 19, 2019
Messages
4
Reaction score
2
First Language
French
Primarily Uses
RMMV
Hello ! I was wondering, is there a way to add your own custom lights ? For example, doing your light in a png file with the shape and color you want. This could resolve belatucadrus 's problem i believe.


Anyways , good work on this plugin !
 

OcRam

Servant of the Universe
Veteran
Joined
Aug 2, 2016
Messages
518
Reaction score
606
First Language
Finnish
Primarily Uses
RMMV
Hello ! I was wondering, is there a way to add your own custom lights ? For example, doing your light in a png file with the shape and color you want. This could resolve belatucadrus 's problem i believe.


Anyways , good work on this plugin !
Thank you for the message,

Adding pictures is way more resource intensive than gradients this plugin uses. I would have to re-write whole plugin again and use only WebGL.

This plugin uses canvas and PIXI.Container which is more backward compatible. Downside here is performance, which I have managed to overcome with some serious optimization.

For example in maps where I have not spared lights (hundreds of light sources on same screen) I still got steady 144 FPS.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,177
Reaction score
246
First Language
English
Primarily Uses
N/A
Sorry I got Yanfly and Khas mixed up, I meant Khas's light plugins.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
511
Reaction score
175
First Language
English
Primarily Uses
RMMV
Hey, quick question. Is there an algorithm that can be used to figure out what the values set by a tint screen command would be using your plugin?

Likewise, for those of you that have been working with the plugin for a while now, would you be willing to share some light codes that you have found to work well, for things such as caves, night time, and touches?

EDIT: One other question, is there any steps I have to take add light in a battle on a darkened map? Without editing the Battle Tint configuration, the whole screen is tinted the map's tint in battle.
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Yanfly told me the new earth all animations in MZ look a bit like summoning potatoes and now I can't unsee it. halp
Despite time and all the other things I am working on, I decided that I am going to start a Fire Emblem-like project. Follow your dreams! I'll just have to balance hours efficiently. I'm also not making this as complex as my Might and Magic inspired project, so it will be a much easier project to work on.
So I've taken to doing a test of the game, and making a list of everything I think of during the test to add/fix. Over the course of the night I check them off as I do them, and by the end of the night I always feel like I've accomplished something. :LZSexcite:
Eventz MZ? Events MZ!
My laptop has been restarting for around ten minutes. Not updating. I am concerned.

Forum statistics

Threads
100,586
Messages
977,520
Members
132,179
Latest member
Reich
Top