Lighting and Time Editor - Continued!

Discussion in 'JS Plugin Releases (RMMV)' started by Feelzor, Oct 30, 2017.

    Tags:
  1. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Lighting and Time Editor v1.7.4
    FeelZoR - Originally created by Level No Matter

    Free to Use for both Commercial and Non-Commercial projects.
    Credits not required but highly appreciated: do not hesitate to also credit Level No Matter (aka Sebastián Cámara).

    You can find a more in-depth version of the TOS here.


    Introduction
    Seeing from the old post that the plugin had some bugs that needed to be solved and the original author seems to have abandoned it, I decided to continue it and share it with you.

    This is a plugin that implements a Time System and a Lighting Editor (in game or with events).
    You can make a lot of incredible light places with this plugin, and it can give a new dimension to your game!

    Features
    • Possibility to enable or disable the Time System.
    • Possibility to change time whenever you want with simple commands.
    • Possibility to set a specific Tint into a map by putting a single line in the Notes: the Time System will be ignored.
    • Possibility to add lights by using the editor in game or with events.

    Screenshots
    This video has not been updated: it is the same than the one on the original post:


    How to Use
    To install the plugin:
    • Download the plugin on the given link and click the "Clone or Download" button, then simply click "Download ZIP".
    • Extract the contents of the img folder into the img folder of your project.
    • Extract the contents of the js folder into the js folder of your project.
    • The file ".gitattributes" is not useful for you, you can delete it.
    • Enable the plugins using this order:
      • LNM_GameEditorCore.js
      • LNM_GameTime.js
      • LNM_LightingTool.js
    To add a light, you have two ways of doing so:
    Using the In Game Editor:
    Press TAB and then press over the lamp icon. Then select the type of light you want to add. You can drag and edit your properties at any time.​
    Adding default lights from events:
    You can create default lights by simply typing Torch, Bonfire or Ambient in the field “Note”.​

    Adding custom lights from events:
    Simply create an event and then in the field “Note” add the following line:
    Light(filename, scale, hue, alpha).addPulse(pulseMin, pulseMax, pulseSpeed).addFlick(flickIntensity, flickSpeed)
    • Filename: (string) Sprite used for the light, located in img/lights/
    • Scale: (float) Scales the sprite. (1.0 = 100%, 0.5 = 50%, ...)
    • Hue: (integer) Tint scale for colors from 0 to 359. For more information visit https://en.wikipedia.org/wiki/File:HueScale.svg
    • Alpha: (float) Transparency of the light, from 0.1 to 1.0
    • pulseMin: (float) Minimum scaling for pulse animation
    • pulseMax: (float) Maximum scaling for pulse animation
    • pulseSpeed: (integer) Speed for pulse animation
    • flickIntensity: (integer) Intensity for flick animation
    • flickSpeed: (integer) Speed for flick animation
    You can set the default power status to off by simply adding .turnOff() at the end of the line.

    Examples:
    Light(default, 5.0, 28, 1.0) - These are the settings used for Ambient lights.
    Light(default, 1.0,15, 1.0).addPulse(0.98, 1.02, 7).addFlick(1, 3) - These are the settings used for Torch lights.
    Light(default, 1.3, 28, 1.0).addPulse(1.1, 1.3, 15).addFlick(1, 3) - These are the settings used for Bonfire lights.​

    Adding custom lights to enemies:
    For battles, you may want enemies to hold a light. Simply do so by writing in the notes part <Light:yourLight>. Just replace yourLight with the same pattern than for event lights.

    Examples:
    <Light:Bonfire>
    <Light:Light(default, 5.0, 28, 1.0).addFlick(1, 3)>​

    Using the Player Torch:
    You can activate or deactivate it using the switch set in the Plugin Manager. Default switch is #0001.

    You can also change it to use 4 different directions, like so:
    • From the Plugin Manager, set the "Player Torch 4 Directions" parameter to true.
    • Note the value of the "Player Torch Filename" parameter.
    • Create 4 different files, all starting with the name set in the "Player Torch Filename" parameter, each followed by either "_2", "_4", "_6" or "_8". These will be for respectively Down, Left, Right and Up directions (same as the arrows on a numpad, if it can help).
    • All these files must have the .png extension and should be located in the img/lights/ folder.
    For example, if you want to use the default image files provided with the plugin, set the "Player Torch 4 Directions" parameter to true and the "Player Torch Filename" parameter to "player_torch" (without the quotes). Run the game and see what it does!
    Light System commands:
    For the following commands, light_id is the id of the light. It can be found in the In-Game editor on the top right corner of the screen. For event lights, the id starts with an e and is followed by the id of the event (without the first 0). For example, the light for event 0042 will have id e42.
    You can also select multiple ids. Specifying a-b as an id with a and b being integers will select all lights from a to b, inclusive. To select a range of event lights, just specify ea-b, with a and b being integers. Non-existing lights ids will be ignored without any warning.
    You can specify a list of ids with [id1, id2, id3], and you can use ranges in that list.
    For example, you can select 1-5 for lights from 1 to 5, e4-9 for event lights from 4 to 9 and [1, 4, e6, 9-13, e8-10] to select lights with id 1, 4, 9 to 13 and event lights with id 6 and 8 to 10.​

    Light ON light_id
    Turns on the specified light. The id can be found while creating or editing a light with the editor, on the top of the screen.
    eg: Light ON 1 will turn on the light with id number 1.

    Light OFF light_id
    Turns off the specified light. The id can be found while creating or editing a light with the editor, on the top of the screen.
    eg: Light OFF 10 will turn off the light with id number 10.

    Light LIMIT time_begin time_end light_id
    Turns on the specified light automatically during the set time.
    eg: Light LIMIT 22:30 5:30 1 will turn on the light with id number 1 between 10:30pm and 5:30am. May be useful for city lights, for example.

    Light HUE hue_value light_id
    Changes the color of the light with the corresponding id temporarily (just in the current save) to the one specified by the hue.
    eg: Light HUE 120 4 will make the light with id 4 green

    Light HUE RESET light_id
    Removes the temporary color of the light with the corresponding id and use the default light color again.
    N.B.: REMOVE can be used instead of RESET.
    eg: Light HUE RESET 2 will remove the temporary color of the light with id 2

    Time System commands:
    Time PAUSE
    Stops the time. Useful for cutscenes, for example.

    Time PLAY
    Reactivates the time.

    Time SET time
    Sets the game's time to a specific time.
    eg: Time SET 15:00 will set the time to 3pm.
    For retro-compatibility, Time SET 15 0 still works.

    Time ADD hours minutes
    Advances time.
    eg: Time ADD 2 15 will advance the time by 2 hours 15 minutes.

    Time SAVE hour_var minutes_var
    Saves the current time in the specified variables.
    eg: Time SAVE 2 3 will save the hours in the variable #0002 and the minutes in the variable #0003.

    Time LIMIT time_begin time_end self_switch
    Activates the specified switch only between time_begin and time_end.
    eg: Time LIMIT 6:00 13:40 A will activate the self switch A of the event calling the plugin command between 6am and 1:40pm.
    eg: Time LIMIT 22:30 5:15 C will activate the self switch C of the event calling the plugin command between 10:30pm and 5:15am.

    Tint SET red green blue
    Sets the tint of the map to the specified colour.
    eg: Tint SET 255 0 0 will set the tint red.

    Tint SET tint_number
    Sets the tint of the map with a tint from the configuration.
    eg: Tint SET 3 will set the tint with the 3rd tint in config.

    Tint REMOVE
    Resets the tint to the time tint, or removes the tint if the time plugin is disabled.

    Clock MOVE x y
    Moves the clock window to coordinates (x,y).
    A negative coordinate will keep the window at the same position on the axis.
    eg: Clock MOVE 0 700 will move the clock window to (0,700)
    Clock MOVE 200 -1 will change the horizontal position of the clock window to x=200

    Clock REL_MOVE x y
    Adds x and y values to the current position.
    eg : Clock REL_MOVE 50 0 will move the clock window from 50px to the right.

    Clock SHOW [map/menu]
    Shows the clock window in the menu or the map.
    If you don't specify which window to show, it will show the map window by default.

    Clock HIDE [map/menu]
    Hides the clock window of the menu or the map.
    If you don't specify which window to hide, it will hide the map window by default.

    Clock TOGGLE [map/menu]
    Toggles the visibility of the clock window in the menu or the map.
    If you don't specify which window to toggle, it will toggle the map window by default.
    Time System Notetags:
    Your must use these tags in the Note part of the map you want to change.

    <Tint: Red, Green, Blue>
    Ignores the time and sets the map's tint to the specified RGB color (Red, Green Blue). This is useful for darker dungeons where light is not time dependent, or houses, for example.
    eg: <Tint: 0, 0, 0> will set the tone totally black, ignoring the time.

    <Tint: CustomTintID>
    Ignores the time and sets the map's tint to the specified custom tint, defined in the Plugin Manager.
    eg: <Tint: 7> will set the screen tone with the Custom Tone 7's value.
    Setting Default Time:
    To set a default time when the player starts a new game, change the "Default Time" parameter in the Plugin Manager to the time you want.
    eg: Setting the parameter "Default Time" to 15:30 will make the game start at 3:30pm.​

    Demo
    Demo made with RMMV 1.5.2 with plugin v.1.4.1

    Script
    You can download all the files here.

    FAQ
    No FAQ yet.
    Changelog
    Credits and Thanks
    - FeelZoR for continuing the plugin.
    - Level No Matter for making the plugin.
    - Xelion for helping Level No Matter translating everything.

    Author's Notes
    This plugin wasn't created by me: I only continue it after seeing such a beauty wasn't used because of some bugs. I'll try to make it better and correct all the bugs I find, implement new features and so on. Though I'll need some time to understand all the parts of the code written by Level No Matter.

    Do not hesitate to report to me any bug you find!

    Incompatibilities
    • This plugin may work with TDDP Bind Pictures To Map if, and only if you put the Lighting Tool below TDDP's plugin and you set the "Incompatibility Mode" to true. To do so, open the plugin manager, double click on LNM_LightingTool and change the parameter "Incompatibility Mode" to true.
     
    Last edited: Aug 3, 2018
    #1
  2. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    Awesome thanks
     
    #2
  3. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Glad to see you like it! :D

    EDIT: I've seen a bug where the screen would be black if you disable the time. I don't know if you have it too, but as a temporary fix, use the <Tint: R, G, B> tag into the maps so they won't be fully black. (though it may be nice with the need to use player's torch, or just map lights.)
    I won't be able to fix it for a few days.
     
    Last edited: Oct 31, 2017
    #3
  4. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    I was trying to understand exactly how to do the torch effect for when my character is in a cave or something. I tried to add torch on the NOTE field on the map as the demo has didnt seem to work.... Can you help with this
     
    #4
  5. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    Nvm i figured it out. For anyone else a little confused create and event to turn the switch on lol. Sorry been out of rpgmaker for awhile should have guessed that
     
    Last edited: Oct 31, 2017
    #5
  6. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Version 1.3.0 is out!

     
    #6
    cjewell77 likes this.
  7. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    Awesome
     
    #7
  8. microck

    microck Veteran Veteran

    Messages:
    45
    Likes Received:
    10
    I will try this one. :o

    EDIT: Got little freeze (0,5 secondes) every 10 secs. My game resolution: 1080p.
    (I3, geforce 750ti, 8gbram).
     
    Last edited: Nov 2, 2017
    #8
  9. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    This one does everything you could want. He bug fixes very quickly
     
    #9
  10. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Buy a GTX 1080 Ti :v

    I'm joking, I may ask you, do you have other plugins installed? If so, what are they?
    Also, did you notice anything particular? For example, freezes only appearing after a certain amount of lights set, freezes only appearing after a particular amount of time, ...
    I'll try to see what may causes these freezes, but I cannot guarantee anything right now ^^'

    Also, does these freezes appear only during playtest or also on a distributed version (it would be perfect if you could test that for me)? It may help me determine what causes these freezes.

    Thanks for reporting it, though!

    @cjewell77 thanks for all your support :D it means a lot to see people enjoying your work ^^
     
    #10
  11. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    After installing this plugin and doing some random weather eventing it is really working out. The torch effect works awesome when tied to a torch item with a time limit and setting the tint of a cave to pitch black.
     
    #11
  12. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    I was wondering if there was a way to put the time on the main screen instead of the menu? I have a basic understanding of java. I have been pouring through the code I cant seem to find where to change what screen the clock is on
     
    #12
  13. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Yep there is a way to do so ^^ (if I understood you correctly)
    By the way, I'm going to tease a bit, but java isn't javascript. MV works with javascript, not java ^^ both are really different languages :D

    So, in the LNM_GameTime.js file, you have the class Window_Time at line 768. This is the window you're looking for.
    If you wish to remove the time from the menu, just comment the lines 751 to 761.

    If you wish to show this window on the map, you'll need to modify the Scene_Map as follows:

    Code:
    //-----------------------------------------------------------------------------
    // Scene_Map
    //
    // The scene class of the map screen.
    var FLZ_GameTime_Scene_Map_create = Scene_Map.prototype.create;
    Scene_Map.prototype.create = function() {
     FLZ_GameTime_Scene_Map_create.call(this);
     this._timeWindowShown = null;
    }
    var FLZ_GameTime_Scene_Map_callMenu = Scene_Map.prototype.callMenu;
    Scene_Map.prototype.callMenu = function() {
     FLZ_GameTime_Scene_Map_callMenu.call(this);
     this._timeWindow.hide();
     this._timeWindowShown = false;
    }
    var FLZ_GameTime_Scene_Map_update = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function() {
     FLZ_GameTime_Scene_Map_update.call(this);
     if (this._timeWindowShown != null) {
      if (this.isActive() && !this._timeWindowShown) {
       this._timeWindow.show();
       this._timeWindowShown = true;
      }
      
      else if (!this.isActive() && this._timeWindowShown) {
       this._timeWindow.hide();
       this._timeWindowShown = false;
      }
     }
    }
    var FLZ_GameTime_Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
    Scene_Map.prototype.createAllWindows = function() {
        FLZ_GameTime_Scene_Map_createAllWindows.call(this);
        this.createTimeWindow();
    }
    Scene_Map.prototype.createTimeWindow = function() {
        this._timeWindow = new Window_Time();
        this._timeWindow.x = 0; // You can remove it, or change the 0 to change the top left position on the x axis.
        this._timeWindow.y = 0; // You can remove it, or change the 0 to change the top left position on the y axis.
        this.addWindow(this._timeWindow);
    }
    
    I recommend putting these lines under the line 761.

    EDIT: Maybe will I keep this code for a future version, so people can show the time while playing if they want.
    EDIT2: The window will still be shown while opening the menu, it may be a bit ugly, I'm looking for a way to improve that.
    EDIT3: I changed the code so now it hides while opening the menu.
     
    Last edited: Nov 3, 2017
    #13
  14. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    I was not aware it was a different language. That explains a lot lol. I appreciate your help and pointers. I will try this code out.
    What do you use to edit your javascript?
     
    #14
  15. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    Yeah, it's a different language :p even though has some similarities to Java, both actually have big differences ^^
    Though I never learnt javascript, only used my knowledge on other languages and the existing scripts in MV to learn how everything works :p

    I hope this code will be enough for you :D I've included it with Plugin Configuration so everyone will be able to use it when I'll make next version available :p

    EDIT : I just noticed that the window was sometimes acting a bit weird. It seems it's not always in sync with the in-game time, so it may go from 2:44 to 2:46 after syncing. I don't know where it comes from, and it won't always do it, so I don't know if it'll be easy to solve.
     
    #15
  16. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    I will try it when i get home tonight. Somehow my usb backup got deleted.... Not sure how lol but I have 2 backups and my laptop at home.
    Thank you again
     
    #16
  17. Feelzor

    Feelzor Veteran Veteran

    Messages:
    92
    Likes Received:
    76
    First Language:
    French
    Primarily Uses:
    RMMV
    No problem! I hope that your backup deletion won't be much of an issue for you ^^

    EDIT: I'm working on some improvements where I can, currently I have, on my computer, noticed the improvements made the script 1.35x faster on the surface update, from 100µs to 74µs on average.

    Before, I could notice best performances around 70µs for a surface update, now it sometimes goes to 50µs. It's probably nothing noticeable, but note that I'm using a computer with a GTX 1060 and an i7 4790.

    Also, knowing that you have ~60 updates per second, you go from 6000µs (= 6ms) to 4440µs just for the surface update. Know that there are other updates in the game, such as updates for the lights, for the time, ...

    EDIT2: Version 1.3.1 is out!
    Be careful if you set the parameter Show Clock to false. It has been changed, so you will have to set it to false again if you still want the clock to disappear in the menu!

     
    Last edited: Nov 3, 2017
    #17
  18. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English

    What program are you using to see the line numbers?
     
    #18
  19. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    That worked perfectly. thank you
     
    #19
  20. cjewell77

    cjewell77 Veteran Veteran

    Messages:
    65
    Likes Received:
    3
    Location:
    Shreveport LA
    First Language:
    English
    great update love it
     
    Last edited: Nov 3, 2017
    #20

Share This Page