Terrax Lighting system

Discussion in 'JS Plugin Releases (RMMV)' started by Terrax, Nov 5, 2015.

  1. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    223
    First Language:
    English
    over how many minutes would it have to change ?  1 hour, 30 minutes?

    Maybe it would be easier to make a 2nd type of day/night system where you could set the time and color and the system would work towards that color. Ill do some testing to see what i can do.
     
    Last edited by a moderator: Nov 27, 2015
  2. Kilitar

    Kilitar Veteran Veteran

    Messages:
    141
    Likes Received:
    41
    First Language:
    czech
    Primarily Uses:
    RMMV
    Terrax - it is Event Light note tag number mentioned as UNIQUE  global for game?

    I mean if i give event notetag :   Fire 120 #FFCC00 1 on MAP1

    And then call plugin command:  Light on 1

    Result is I have all Events with notetag  Fire (radius) (#color) 1 on EVERY MAPS  ON.  - I thought    plugin command:  Light on 1 will switch LIGHT exclusve for recent map, not for every map ingame. 

    It is bug or default behaviour?

    If it is behaviour I will simply rename my lights on every map to not share same number between maps, but if it is bug and will be corrected It will save me this work as I  have about 20 maps in my game atm :) .  And if it is behaviour, what is MAX number? Cos ATM I have about 200 lights with On/Of switch number  together.

    Thank you for your patience and your time. 

    //I am not native speaker, I hope its understable enough//
     
    Last edited by a moderator: Nov 27, 2015
  3. Fitcher

    Fitcher Veteran Veteran

    Messages:
    50
    Likes Received:
    7
    Location:
    Finland
    First Language:
    Finnish
    Yeah well i dont realy know how to explain what i want, english is not my main language.

    But lets say i change time from 1:00 to 12:00 i would like it to look like how it is in this video.

    look at 2:40 when he uses a time warp spell.

    https://www.youtube.com/watch?v=3H9xbVk6LN4
     
  4. Kirika

    Kirika Villager Member

    Messages:
    23
    Likes Received:
    1
    First Language:
    na
    Primarily Uses:
    N/A
    is it only for me, or when two light sources overlaps u can see darker border lines inside light reflections ?
     
  5. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    223
    First Language:
    English
    I can only switch on/off the lights on the map that is currently loaded, but once they are switched on they are saved in memory so that when you return to the map the lights are as you left them. The maximum amount of lights would be 4,294,967,295, but i doubt you will reach that ;)

    Next update there will be a new feature that can do all this.

    Its not just you, the filters used aren't perfect and some borders can show at some distances.
     
  6. Kirika

    Kirika Villager Member

    Messages:
    23
    Likes Received:
    1
    First Language:
    na
    Primarily Uses:
    N/A
    well.....

    i tinkered a little with you script and tried different ways to fix that - changing color from 'black' on 'transparent' in all radialgradientFillRect entries actually make some noticeable visual changes (like force me to increase radius on all my lights and made flickering less noticeable) but look like that fix border problem in my current project (need more tests with different colors to confirm that thought)
     
  7. Kilitar

    Kilitar Veteran Veteran

    Messages:
    141
    Likes Received:
    41
    First Language:
    czech
    Primarily Uses:
    RMMV
    "I can only switch on/off the lights on the map that is currently loaded, but once they are switched on they are saved in memory so that when you return to the map the lights are as you left them. The maximum amount of lights would be 4,294,967,295, but i doubt you will reach that  ;)"

    Terrax  -  well, it is not how it really works now :) . I have trouble to explain it with my english.. 

    MAP1  - Event33: Fire 120 #FFCC00 1

    MAP2  - Event62: Light 150 #FFFFFF 1

    MAP3  - Event11: Light 180 #CCCCFF 1

    I was on MAP1, and there I switched light ON by plugin command:  Light on 1 so Event33 on MAP1  lights ON

    I saved game.  Then I loaded it again next day and visit MAP2 and MAP3 (zones where I never been before)

    When I transit to MAP2 - Event62 on MAP2 was ON as well!

              I  transit to MAP3 - Event11 on MAP3 was ON also.  - because they are all ťagged "1" - and "1" is ON for MAP1.

    Maybe reason is, the "previous save" was made with older plugin version?  I will try do some tests on fresh test game and let you know. 
     
  8. Fitcher

    Fitcher Veteran Veteran

    Messages:
    50
    Likes Received:
    7
    Location:
    Finland
    First Language:
    Finnish
    Alright im glad to hear, then i will just have to wait.

    P.S

    I did some testing on the issue Kilitar got, and "Light on 1" does actually turn on all lights given the number 1 on other maps as well.

    I made 3 maps A, B and C.

    All 3 maps had light source with note tag "Fire 150 #FFCC00 1"

    I start on map A and i got a event on map A that does "Light on 1" when spoken too, it turns ON light on map A, B and C

    "Light off 1" does the same turning lights OFF on map A, B and C

    This was tested with the most recent version and a new game.

    I would say even if its not intended to be like this i kinda like this feature anyway so it would be nice if there is two commands.

    one to turn on/off the lights on current map with given number and one for turning on/off lights on all maps with the given number.
     
  9. gattsbr

    gattsbr Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    Hi Terrax, I have to agree with Portkey89, after exploring the plugin a little I came here searching exactly how to do that.

    Anyways, there might be a more effective way to do it, but here's some minor changes I made to your script to make this work for me. It's not exact, but it seems to work alright for 60 seconds.

    Also i'm assuming that setting a switch to 0 has no effect.

    //******************* Light radiusgrow 100 #FFFFFF ************************ if (args[0] == 'radiusgrow') { var evid = this._eventId; //Graphics.printError('test',evid); var newradius = Number(args[1]); if (newradius >= 0) { //player_radius = newradius; lightgrow_value = player_radius; lightgrow_target = newradius; if(args[4]) { if(player_radius > newradius) { //shrinking lightgrow_speed = (player_radius * 0.012) / Number(args[4]); } else { //growing lightgrow_speed = (newradius * 0.012) / Number(args[4]); } }else { lightgrow_speed = (Math.abs(newradius-player_radius))/500; } } if (args.length > 2) { playercolor = args[2]; var isValidPlayerColor = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(playercolor); if (!isValidPlayerColor) { playercolor = '#FFFFFF' } $gameVariables.setPlayerColor(playercolor); } }
    Code:
    			// ******** GROW OR SHRINK GLOBE *********						if (lightgrow_value < lightgrow_target) {							lightgrow_value = lightgrow_value + lightgrow_speed;				//console.log("(<)lightgrow_value = " + lightgrow_value);				if(lightgrow_value > lightgrow_target) {					//other wise it can keep fliping back and forth between > and <					lightgrow_value = lightgrow_target;				}				player_radius = Math.floor(lightgrow_value)				$gameVariables.setRadiusSave(player_radius);			}			if (lightgrow_value > lightgrow_target) {								lightgrow_value = lightgrow_value - lightgrow_speed;				//console.log("(>)lightgrow_value = " + lightgrow_value);				if(lightgrow_value < lightgrow_target) {					//other wise it can keep fliping back and forth between > and <					lightgrow_value = lightgrow_target;				}				player_radius = Math.floor(lightgrow_value)				$gameVariables.setRadiusSave(player_radius);			}
    edit: added spoiler tag to fold.
     
    Last edited by a moderator: Dec 1, 2015
  10. Vegnarus

    Vegnarus Veteran Veteran

    Messages:
    103
    Likes Received:
    23
    Terrax, with all these updates and bug fixes I forgot to ask a few things. For the DayNight tag, wouldn't it be better if it was in the Map's Notes?

    If only to avoid littering the maps with events; especially in busy ones. You just add the tag in the map's notes and remove it if you don't want it on that map.

    For the daynight colors, I'm wondering if it's possible to load the colors from a text file and set them as the global parameter settings for easier editing and to avoid event copy-pasta if possible. (Ask me to elaborate a little more if you want to try this) You can keep the current method too so as to allow certain areas to deviate from the global settings.

    And did you attempt the terrain tag thingy? Or was it too complicated and diabolical to bother with?  :guffaw:    
     
  11. Dallas Robinson

    Dallas Robinson Villager Member

    Messages:
    45
    Likes Received:
    1
    First Language:
    English
    Hmm, okay i got it to work but i do have a question. I put in 'Flashlight 8 12 #888888 1' into the note of the event and by default it makes the event flashlight turned off. then I used the plug in command "Light on 1" to turn it on and "Light off 1" to turn it off, and it worked. However for me the default (gameplay wise) is that the light should be on and only turns off when the player does certain things (knocks out guard from behind, defeats guard in combat, etc) . I can get around this by making a page that basically just turns the flashlight on before doing any other action but i'm not sure if that's the best way to handle this.  any ideas on how to handle this smoother?
     
  12. gattsbr

    gattsbr Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    Yeah, flashlight on events seems a little buggy to me, they seem to be off until the event moves, meaning if you want a static flash light (like at a cave entrance) you have to move the event once, or use a switch?
     
  13. Dallas Robinson

    Dallas Robinson Villager Member

    Messages:
    45
    Likes Received:
    1
    First Language:
    English
    nope, it's suppose to work that way. I asked about that earlier and they stated that it would only work on a moving event. this may change but as of now its working as intended. 
     
  14. Happy Jake

    Happy Jake Villager Member

    Messages:
    13
    Likes Received:
    4
    Location:
    Canada
    First Language:
    French
    I get an error of "Cannot read property 'addChild' of undifined". Not sure what is causing this...
     
  15. gattsbr

    gattsbr Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    What I find interesting about this, is that this doesn't work when built for Android, but running the game from a server in chrome on the same device does (is also faster). Maybe someone can explain that? XD
     
  16. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    223
    First Language:
    English
    Leave for 2 days and this is what you get .. a mailbox full of replys, oh well.. i'm back!

    Yeh, i had it wrong the first time.. its working as intended though, throw a switch on and it will switchs the lights on every event with the 1 tag.

    Always happy when someone helps out, ill include your changes next update.

    Daynight tag in map's note.. sounds good, ill take a look

    Daynight colors in file.. sure but i don't have a clue how to load save from files, so help would be needed.

    Did take a look at terrain tags, but i couldn't figure out how each tile was encoded, if you have a page that explains it, please forward it.

    Not realy, most games start with a nice animation to start up the story, i would throw it in there.
     
  17. SenpaiCZ

    SenpaiCZ Warper Member

    Messages:
    4
    Likes Received:
    0
    First Language:
    Czech
    Hi, i just LOVE this plugin, but i have one issue. When i try load saved game, it´s always tint red in maps where i use DayNight. No error just red tint

    Any idea what´s wrong?

    PS: Sorry for my english
     
  18. Vegnarus

    Vegnarus Veteran Veteran

    Messages:
    103
    Likes Received:
    23
    You need two things to setup the system as of version 1.1.7. The event with the DayNight notetag and the plugin commands that set the colors for the hours of the day.

    You either have an event that sets a red tint light or you have the hour shade event which has a plugin command with a red tint in it.
     
    Last edited by a moderator: Nov 30, 2015
  19. SenpaiCZ

    SenpaiCZ Warper Member

    Messages:
    4
    Likes Received:
    0
    First Language:
    Czech
    Thanks : ) i will look a it :)
     
  20. SuperBlaze

    SuperBlaze Veteran Veteran

    Messages:
    29
    Likes Received:
    10
    Location:
    Earth, but occasionally I take a trip to Pluto
    First Language:
    Norwegian
    Primarily Uses:
    RMMV
    I want to thank Terrax for a great plugin. Amasing work !

    I started to use this plugin in a dungeon of my game. I am currently using a  day/night system with different tint tones dependent on a variable in a paralell common event .

    I want the variable to set the tint not the clock because it gives me more control over the different events i use at certain variable numbers.

    Is it possible to use the day night tints/colors from this plugin instead of the in built tint screen in MV ?

    Can i by that also when it dark in my other village, city or forest  maps use tourch or flashlight items? 

    Sry my bad English.
     

Share This Page