Terrax Lighting system

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

  1. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish


    So, what should I do to make my game work fine?
     
  2. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English


    Not yet.. i can access $gameMap.events(), but its always empty ($gameMap.events.length = 0).


    Lets take this piece of code :


    for (var i = 0; i < $dataMap.events.length; i++) {
    if ($dataMap.events[i]) {
    var note = $dataMap.events[i].note;
       }
    }





    How would i change that to read the Game_events instead of the datamap?
     
    Last edited by a moderator: Dec 11, 2016
  3. Galv

    Galv Veteran Veteran

    Messages:
    1,173
    Likes Received:
    1,110
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A
    var eventList = $gameMap.events();
    for (var i = 0; i < eventList.length; i++) {
    if (eventList) var note = eventList.event().note;
    }




    Make sure you're using $gameMap.events() and not $gameMap.events as it is a function that needs to be executed () to return the array of events.


    EDIT:


    Here's your plugin modified as a quick example:


    http://www.mediafire.com/file/ku2unldbchyi5cn/TerraxLighting-_Galv_Edit.zip


    - I did a quick find/replace to change the references for $dataMap.events to $gameMap.events()


    - I changed references to $dataMap.events[x].note to $gameMap.events()[x].event().note


    - I changed references to the event's x,y to use the event's _realX,_realY


    - From the quick test in the demo it appears to work
     
    Last edited by a moderator: Dec 11, 2016
    KaYsEr likes this.
  4. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English


    That example was a big help!


    converting the script to gameMap.events(), should be an update soon!
     
    Last edited by a moderator: Dec 11, 2016
  5. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish
    Thank you two SO much ;)
     
  6. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English




    Lol.. that was fast


    Ill take a look at the changes and implement them in a new update (already had some other new features as well)
     
    Last edited by a moderator: Dec 11, 2016
    Galv and KaYsEr like this.
  7. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish
    I've tested it a little bit more, but light remains where event was spawned after unspawning :(


    Hope this exhaustive bug reporting doesn't bother.
     
  8. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    No, no.. please keep on testing, nothing is more frustrating then updating and finding out half an hour later that there is a bug that needs another update.


    I'm still working on the script, Galv realy helped a lot and i think i can remove two script overwrites.. Thats realy realy nice because it means less problems with other addons.


    I haven't looked at the event spawning script yet, but for unspawning events the 'killswitch' option was designed. You can set it in the options of the plugin. If you set the Killswitch to 'C' then throwing selfswitch 'C' on an event will turn of the lights on that event. If that fixes the probem, let me know because i worked out the other kinks and ill update the script.


    Time for bed, i will upload the new version tomorrow, if no other bugs pop up :).
     
    Last edited by a moderator: Dec 11, 2016
  9. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    New version (1.4.2) now available


    http://mvplugins.com/plugin/Terrax/Terrax%20Lighting%20System


    or


    https://github.com/Terraxz/TerraxLighting


    Due to Galv's amazing help, the plugin now is compatible with spawned events. I also managed to cut two overwritten core-scripts that could potentialy cause problems with other plugins.


    Added : Compatiblity with spawned events.


    Added: The in-game configuration menu now contains a menu item to turn off the lighting script. This was done because some low-end machines have problems with the rendering, players can now self choose to turn off the script if required. If you do not want the extra menu option you can set it in the plugins settings.


    Terrax
     
    Last edited by a moderator: Dec 11, 2016
    KaYsEr and Galv like this.
  10. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish
    For some reason, Galv's edit works fine in my computer, but your new version not :(  
     
    Verdelite likes this.
  11. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English


    Any errors? What's not working?
     
  12. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish
    The entire plugin. The dark mask doesn't appear and my dungeons are totally bright and "unmysterious" : (
     
  13. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    Hmm.. i think i slipped in a very small bug in the new options menu.. the script seems to default to 'off' when you install the script.


    Start a game.. in the menu go to options -> turn 'lighting effects' to on.
     
    Verdelite likes this.
  14. ABSTRVCT

    ABSTRVCT - Enlightened - Veteran

    Messages:
    38
    Likes Received:
    1
    Location:
    Spain
    First Language:
    Spanish
    Solved! Thank you ;)
     
  15. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    I've updated version 1.4.2 so that that the lighting option is on by default when you install it.
     
    Verdelite likes this.
  16. KaYsEr

    KaYsEr Koruldia Veteran

    Messages:
    211
    Likes Received:
    446
    Location:
    London
    First Language:
    French
    Primarily Uses:
    RMMV
    Thanks Terrax!
    When I open the archive I can see 2 plugins, I know one is for compatibility reasons (for users with outdated MV) but it's hard to tell which one.


    Both of them work for me.  :D
    One has the regular name and the other has _Pixi3 in the name, but if I remember well MV went from Pixi2 to Pixi4 directly, so it could add an extra layer of confusion.
    Just to be sure, which one is for regular "MV updated" (now 1.3.4) users? :)
     
  17. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    Ah, i didn't know MV went from pixi2 to pixi 4..


    Pixi3 will run on all version, but it will throw some errors in the console panel that some functions are deprecated.


    When you run the updated MV scripts, TerraxLighting.js will not throw those errors.


    Basicly it's easy.. install TerraxLighting.js. If your game instantly throws an error, use TerraxLighting_Pixi3 instead.


    But seeing that its confusing, ill describe it better next time.
     
    Last edited by a moderator: Dec 12, 2016
    KaYsEr likes this.
  18. luiscesjr

    luiscesjr Veteran Veteran

    Messages:
    117
    Likes Received:
    11
    First Language:
    Portuguese
    Sorry for the delay man, I don't see where I got it wrong but, here take a lok at my common event:


    ◆Se:Lanterna é LIGADO
      ◆Interruptores de controle:#0247 Lanterna = DESLIGADO
      ◆
    :Mais
      ◆Interruptores de controle:#0247 Lanterna = LIGADO
      ◆
    :Fim
    ◆Se:Lanterna é LIGADO
      ◆Comando de plug-in:Flashlight on 8 12 #FFFFFF
      ◆Texto:Nenhum, Janela, Meio
      :     :Você ligou a lanterna. 
      ◆
    :Mais
      ◆Comando de plug-in:Flashlight off
      ◆Texto:Nenhum, Janela, Meio
      :     :Você desligou a lanterna.
      ◆
    :Fim


    Sorry it's in portuguese, I'm a bit reluctant to put it in english and get some part of the project wrong,


    so if you don't undertand I will try to translate it better, but it's quite self explanatory, just as your demo but with different words


    and switches. On the If, it's the same switch 247.


    Se = If
     
  19. Zaen

    Zaen Find Me on YouTube Veteran

    Messages:
    115
    Likes Received:
    30
    Location:
    Tejas
    First Language:
    English
    Awesome, thanks for the update.
     
  20. Terrax

    Terrax Veteran Veteran

    Messages:
    304
    Likes Received:
    222
    First Language:
    English
    Question.. did you perhaps set the player-radius to 0? Because that will also disable the flashlight.


    If you only want the flashlight set the radius to 1, this will show the flashlight without showing a globe of light around the player.
     
    luiscesjr likes this.

Share This Page