Terrax Lighting system

● ARCHIVED · READ-ONLY
Started by Terrax 1467 posts Page 14 of 74 View original ↗
  1. EternalShadow said:
    This is great.

    When I'm using the flashlight though, it seems the radius around the player has to be at least 1 for the flashlight to work. However, if a game is being made where the player's only line of sight is actually within the flashlight, this is a bit of a downer given that they can see 1/2 of a tile around them with the light radius of 1!

    Could it be set so that if the radius around the player is 0, they cannot see anything around them except what is in the flashlight?

    Thanks.

    EDIT: And also some sort of feature to prevent light passing through or onto ceilings (use a notetag for this perhaps) and events without (or with, depending on config, as some games may have more items to tag one way or another) a certain notetag?

    EDIT 2: And also, what about a way to change a certain event's light radius, not just the player's?

    And also a way to increase the severity of fire flickering, independently by event?

    XD
    The flashlight has a default lightradius of 60, if you don't want that you can alter the script at line 999

    just put // before this line 'context.fillRect(x1-r2, y1-r2, r2*2, r2*2);'

    I can't let walls block light.. yet, unless somebody can tell me how the data in the game-map is build up.

    Shrinking event lightglobes might come later :)

    keeno79 said:
    Hi there, sorry to be so late in the game here - but i've downloaded the demo's and ran through everything in the help file but I can not seem to activate it

    Basically what I need is a constant flashlight in the game projecting from the player - the minute the game starts it should set the map to black and activate the flashlight ... could somebody describe the steps as if they were speaking to an idiot (cos clearly I am one!)

    Thank you in advance!
    You need to place at least one light event in an area to active the script (if you don't want a light, place an event with lightradius 0)

    Activate the flashlight with plugin command 'Flashlight on 8 12 #FFFFFF'

    TheWhiteRose000 said:
    Is it possible this would be compatible with this.

    https://atelierrgss.wordpress.com/rmv-time-system/

    I want to be able to create a lanturn on my characters in dark area's at night.

    So the area around them is lit up.
    There are a lot of time-scripts around, it's not hard to make them compatible by replacing the Tint function in those scripts

    with the Tint function from this script.

    lillunatik said:
    I must be doing something wrong to get a SaveVariable Lighting error...after loading a game from a save point with lighting around.
    Could you be a little more  specific about the error, what's the exact error message?

    goldenhades said:
    i really love that awesome plugin Terrax thanks a lot

    i have an idea of a new feature that would be nice

    if we could make either event or stuff to be able to stop the light of the torch.

    Like in my image we saw that the fire on the wall light everything in his radius even the top of the wall , or a little of the other room where it did not connect.

    http://www.mediafire.com/view/s2da1awty93ge6x/Sans%20titre.png#

    Maybe i just miss something and we could already do that or its a new idea.
    Its not a new idea, in fact there a lot of nice things i could do if i could figure out how to get the map data. I can't figure out how to get

    the tile-data (passage and terrain tags ) from the script.
  2. Brilliant, thank you!

    Can the player use the flashlight too, or does it only apply to events?
  3. keeno79 said:
    Brilliant, thank you!


    Can the player use the flashlight too, or does it only apply to events?
    CVfaWfDXIAAs3pI.png

    The flashlight has a default lightradius of 60, if you don't want that you can alter the script at line 999


    just put // before this line 'context.fillRect(x1-r2, y1-r2, r2*2, r2*2);'
    Will this affect the actual radius of the light directly around the player, as seen in the above screenshot?
  4. Oh man, how did you get this to work ... if I place Flashlight on 8 12 #FFFFFF in the map notes, I get nothing.

    Also, can the flashlight area be shrunk - the same way you can for a normal Light?
  5. keeno79 said:
    Oh man, how did you get this to work ... if I place Flashlight on 8 12 #FFFFFF in the map notes, I get nothing.


    Also, can the flashlight area be shrunk - the same way you can for a normal Light?
    nuqe5Xo.png


    I have to add light radius 1 as well to get the flashlight to show up.
  6. OK i see you're running it in an event, does it have to be enclosed within an event or could it be run on the map load? For example ...

    Screen Shot 2015-12-07 at 20.29.15.png
  7. Has to be in an event, as far as I am aware.
  8. keeno79 said:
    OK i see you're running it in an event, does it have to be enclosed within an event or could it be run on the map load? For example ...
    Each map that needs to be dark, needs at least one lightsource (this is what makes the script run)

    So place and event and put in 'Light radius 1 #FFFFFF'

    Then at the start of your game, put another event that has the plugin call : Flashlight on 8 12 #FFFFFF

    You can erase the event after that, just need to give it once.

    The 8 is the lenght of the flashlight, the 12 is the width.. you can experiment a bit with the settings.
  9. a little scripting question.

    is there a way to move  pixi layer you use in ur plugin  blow other layers ? (like  below cherecter,  or below any custom layers)
  10. Kirika said:
    a little scripting question.

    is there a way to move  pixi layer you use in ur plugin  blow other layers ? (like  below cherecter,  or below any custom layers)
    The function below (line 1211 in the script) has the placement of the layers, my layer is the 'createLightmask()' function. Currently only the weather effect is above my lighting effect, the rest is under it. You can try and move it to other positions yourself.

        Spriteset_Map.prototype.createLowerLayer = function() {

            Spriteset_Base.prototype.createLowerLayer.call(this);

            this.createParallax();

            this.createTilemap();

            this.createCharacters();

            this.createShadow();

            this.createDestination();

            this.createLightmask();

            this.createWeather();

        }
  11. 1) did you see the link for the docs I gave you? (Just checking)

    2) is there a way to have no lights on the map, if you want the player's flashlight to be the only light source?
  12. EternalShadow said:
    Is there a way to have no lights on the map, if you want the player's flashlight to be the only light source?
    Yup. Just set an event with a huge radius to cast the darkness layer using a hex value of #000000 (or something lighter if you want) and set the player light radius to 0. You could also technically have the radius of the event be 0 if you want a pitch-black effect. The event will only be used to activate the script on the current map.
  13. EternalShadow said:
    1) did you see the link for the docs I gave you? (Just checking)

    2) is there a way to have no lights on the map, if you want the player's flashlight to be the only light source?
    1) Yes, not exactly what i had in mind, but its usefull and i started on a way to disable lighting on rooftiles ect based on a tile-tag.

    2) Put in an event with a lightsource with radius 1 and a black color, that will give no light, but it will activate the script.
  14. another script question

    Bitmap.prototype.FillRect = function(x1, y1, x2, y2, color1) {
    var context = this._context;
    context.save();
    context.fillStyle = color1;
    context.fillRect(x1, y1, x2, y2);
    context.restore();
    this._setDirty();

    }

    is there a way to fill it with image - not with color mask ?
  15. I can't seem to get events to use flashlights properly - it just appears like a normal round light on the event.


    This is in the notetag:


    Flashlight 8 20 #888888


    I've tried various combinations like 30 5, 10 5, etc but it never appears like an actual flashlight, just a sphere.
  16. I'm currently working on a new function that gives the ability to block light on certain tiles (like roofs) based on tile-flags and/or regions. It will also be possible to create lights based on tile-tags and/or regions.

    Kirika said:
    another script question

    is there a way to fill it with image - not with color mask ?
    What did you have in mind ?

    EternalShadow said:
    I can't seem to get events to use flashlights properly - it just appears like a normal round light on the event.

    This is in the notetag:
    Flashlight 8 20 #888888

    I've tried various combinations like 30 5, 10 5, etc but it never appears like an actual flashlight, just a sphere.
    Indeed. the short version seems to be bugged at the moment.. if you use Flashlight 8 20 #888888 0 2 it still works

    (the last 2 numbers were added for events that don't move, but it seems currently they are required for moving events as well)

    ill fix it next update so the short version works as well.
  17. I can't make it works there is nothing showing on the map. I use bind pictures to map for parallaxing maybe that's the reason why it is not working?
  18. Alright, using long version for now :)


    Sorry if this was already addressed, but could this extra light circled in red be taken out (via a toggle, as I am sure some people will want it to remain) when using the flashlight feature?


    M7QLP4p.png


    Thanks :)
  19. Terrax is trying to work out the roof and wall tag idea I originally posted about on a previous page. If he pulls it off, then the next update should probably provide a way for you to solve your light issue Eternal. :)