Terrax Lighting system

● ARCHIVED · READ-ONLY
Started by Terrax 1467 posts Page 44 of 74 View original ↗
  1. Galv said:
    $gameMap.events() is a default function in rpgmaker to return an array of events for the current map. You should be able to access it.


    Also when wanting to access $dataMap.events, you can access from the event object returned from that $gameMap.events() array with the event() function.


     


    eg. the function in the event is:



    Game_Event.prototype.event = function() {
    return $dataMap.events[this._eventId];
    };


    So you can reference the events that have been created in the $gameMap object and still get the $dataMap.events info (as my spawn plugin changes this function to be able to access the correct map for this data).


     


    Hope this makes sense and helps.


     



    So, what should I do to make my game work fine?
  2. Galv said:
    $gameMap.events() is a default function in rpgmaker to return an array of events for the current map. You should be able to access it.


    Also when wanting to access $dataMap.events, you can access from the event object returned from that $gameMap.events() array with the event() function.


     


    eg. the function in the event is:



    Game_Event.prototype.event = function() {
    return $dataMap.events[this._eventId];
    };


    So you can reference the events that have been created in the $gameMap object and still get the $dataMap.events info (as my spawn plugin changes this function to be able to access the correct map for this data).


     


    Hope this makes sense and helps.


     



    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?
  3. 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
  4. Galv said:
    var eventList = $gameMap.events();
    for (var i = 1; i < eventList.length; i++) {
    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.



    That example was a big help!


    converting the script to gameMap.events(), should be an update soon!
  5. Thank you two SO much ;)
  6. Galv said:
    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





    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)
  7. 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. ABSTRVCT said:
    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.

    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 :).
  9. 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
  10. For some reason, Galv's edit works fine in my computer, but your new version not :(  
  11. ABSTRVCT said:
    For some reason, Galv's edit works fine in my computer, but your new version not :(  



    Any errors? What's not working?
  12. Terrax said:
    Any errors? What's not working?

    The entire plugin. The dark mask doesn't appear and my dungeons are totally bright and "unmysterious" : (
  13. ABSTRVCT said:
    The entire plugin. The dark mask doesn't appear and my dungeons are totally bright and "unmysterious" : (

    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.
  14. Solved! Thank you ;)
  15. I've updated version 1.4.2 so that that the lighting option is on by default when you install it.
  16. 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. KaYsEr said:
    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? :)

    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.
  18. Terrax said:
    All i can think of is that you made an error with the switches, can you link the common event your using?

    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. Awesome, thanks for the update.
  20. luiscesjr said:
    Sorry for the delay man, I don't see where I got it wrong but, here take a lok at my common event:

    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.