MV - Community Lighting MV & MZ

● ARCHIVED · READ-ONLY
Started by ImaginaryVillain 1279 posts Page 9 of 64 View original ↗
  1. I was taking a look at the code, and there is something I don't understand. In order to calculate the circle positions, you make your own coordinates calculations, even adding comments about the changes of coordinates with "parallax" which are rather looped maps.

    Why aren't you directly using the screenX() and screenY() functions of Game_CharacterBase? It is calculating the jumps and so on directly.

    Or at least, if you prefer the raw positions of events, you can use the functions scrolledX() and scrolledY(). My own lighting code uses this:

    Code:
    const real_coords = this.getPixelCoordinates(evt.scrolledX(), evt.scrolledY());
    this._maskBitmap.fillGradientCircle(real_coords.x, real_coords.y, circle_radius, colorString1, colorString2);

    Code:
    LightingMask.prototype.getPixelCoordinates = function(x,y) {
       const tile_width = $gameMap.tileWidth();
       const tile_height = $gameMap.tileHeight();
    
       const rx = tile_width * (x + 0.5) + 20;
       const ry = tile_height * (y + 0.5) + 20;
    
       return new Point(rx,ry);
    }

    I have +20 in x and Y to accommodate shakes in both directions
  2. Oh there's a lot of WTFs in the code if you look deep enough. One of my favorites was using eval to parse a number. Yeah I have no idea either.
  3. I'm really thinking that in order to organize the work well, as a guy said a few pages ago, you should really think about uploading the two scripts to github and working on them from there. You would find yourselves much better, in my opinion ...
  4. GitHub

    Honestly I've just been so busy with work, and my own game I haven't bothered learning Github. But I do plan on starting some other Community Projects (at some point) so I'll start by making one. And as I get time I'll figure the rest out. :kaoswt:

    edit: Removed the audio and graphics from the demo, updated the version packaged with it, and added instructions to copy it over a new MV project. Then put it up on the GitHub along with the two versions of the script.

    @Schlangan Terrax the plugin's original progenitor had a lot of interesting quirks in his programming style. Thought the beauty of this particular plugin we have here is anybody can edit (that's the point of this whole experiment), so if you want to add your changes we'd welcome them. :LZSexcite:
  5. Always easier to stay organised with a VCS.
    I have made the first pull request with the following changes:

    -Added a conditional lights tutorial in the demo (it seems not everyone understood well how to deal with them).
    -Modified the plugin help to make clearer what the 'Reset Lights' parameter and the 'Light switch reset' plugin command actually do.
    -Reworked the 'Light color id c' plugin command to make it more flexible.

    Note that I had no idea how to access my old github student account, so I had to create a new one.

    A little comment about the license: shouldn't Terrax be mentioned in it?
    Also, a readme would be nice (I should probably have made one myself)

    I will be looking for the MZ stuff when I have access to my main computer.
  6. I must be doing something horribly wrong. I downloaded the sample project and opened it. It opened in MV (I have both MZ and MV, thanks to the launch week sale). I tried to playtest it, but NONE of the lighting effects showed up. I didn't touch anything before I plastered - just went straight in. What gives?
  7. I have no idea how to use github as an actual collaboration tool, so this should be an interesting learning experience.
  8. GammaVector said:
    I must be doing something horribly wrong. I downloaded the sample project and opened it. It opened in MV (I have both MZ and MV, thanks to the launch week sale). I tried to playtest it, but NONE of the lighting effects showed up. I didn't touch anything before I plastered - just went straight in. What gives?

    If you pasted the demo from github to a new blank project, you shouldn't have trouble (I just tried right now).
    My best bet would be that the Lighting Effects are disabled in your game's options.
  9. Yeah, I'm slowly learning stuff about GitHub... It's kind of neat, I'll have to look into how to do pull requests, etc. I managed to figure out how to approve and merge them. Probably not that hard to figure out how to make one, though I'm not currently working on the main script anyway. So I likely won't be making any personal changes to the code any time soon.

    I'm a lot more interested in the mini version I use for my game at the moment. Which I should add now that I think about it.

    Oh I've also added all of us to the copyright. Honestly, it's supposed to be a Community owned plugin anyway. So I'm happy with adding everybody who works on it to the copyright. As for the read me, I copied the help file from the plugin into it. If someone would like to write a better one, just let me know. :LZSwink:
  10. Alexandre said:
    If you pasted the demo from github to a new blank project, you shouldn't have trouble (I just tried right now).
    My best bet would be that the Lighting Effects are disabled in your game's options.

    Alright, looks like I had the wrong files before. There was a demo attached to the first post that DID NOT work - but grabbing the one of github and pasting it into a new project works perfectly. Thanks for the help, and sorry for the confusion.
  11. Alexandre said:
    Why not, more useful features is rarely a bad thing.
    I personally have a big preference for the current id system who is more flexible and isn't affected by events' ids changes, although I will easily admit there is room for improvements, notably about how light ids are named inside the notetags (name your id d1, and it will be interpreted as a light direction for example), but I didn't found yet a way to do it without messing up with already existing notetags.
    Do you have a sample note tag handy that actually works with the current wonky AF light ID system?

    Edit: For those wondering, I have just about every plugin command set up and working for MZ now except the light id stuff and the battle tinting commands which I swear got removed, but shouldn't be hard to add back in. Doing those right now. :)
  12. Aesica said:
    Do you have a sample note tag handy that actually works with the current wonky AF light ID system?

    I added a whole room in the demo about conditional lighting.
    For example, the light notetag of the yellow cristal is the following: <cl: light 150 #e4e809 1>.
    '1' is the ID. As it stands, ids can only be positive numbers, because of the '<' operation.
    (in JS, when comparing a string with a number, the program will try to convert the string to a number. A non-number string becomes NaN which will make the comparaison always false.)

    JavaScript:
                                        // conditional lighting
                                        let lightid = 0;
                                        if (typeof next_arg != 'undefined') {
                                            lightid = next_arg;
                                        }
    
                                        let state = true;
                                        if (lightid > 0) {

    Now that I review this one, I will agree this code is confusing (casting it to a number would have made more sense) and more importantly, that the help file doesn't precise that detail.

    As I said before, the way the light IDs are annoted right now isn't perfect,
    I can see it evolving to make it more logical with the rest.
    The biggest problem being that old ids should still work.

    Aesica said:
    Edit: For those wondering, I have just about every plugin command set up and working for MZ now except the light id stuff and the battle tinting commands which I swear got removed, but shouldn't be hard to add back in. Doing those right now. :)

    For the MZ version, I still have to check for the light id stuff and the battle tinting commands,
    I will do it as soon as I have the time.
  13. Aah, I admit I haven't looked at the latest demo, but I went ahead and proceeded under the assumption that light IDs do in fact work, and have actually expanded them to (maaaaybe!) include any non-spaced group of characters, not just numbers. So now they can be given more meaningful names.

    Also, I've added a bit of an optimization this time around. As it turns out, the note tags on events are parse-spammed relentlessly, which might account for some of the lag when lots of lighted events are present. I set it up so that they're only parsed once, then cached. It currently breaks on cycling lights but fixing those (and expanding them to take more than 4 parameters) shouldn't be too difficult.

    Finally, since this is the MZ version, I don't think we need to try too hard to ensure backward compatibility with the old (and frankly, ing awful optional parameter messiness) note tag syntax. If you want, its quite doable (and probably ideal) to have an id preceeded by something, like the letter i. So: <cl: light 250 #f00 b15 d4 ib25> That'd let you assign b25 as the id without causing any conflicts with anything else. This is noteworthy because I've set it up so that the order is a lot less important than it used to be. <cl: light d4 b15 250 ib25 #f00> should yield the exact same result.

    Edit2: Actually if you want, i can just leave the battle tint commands to you. Since you made them, you're probably a lot more familiar with them than I am.
  14. I seem to have discovered an issue where moving an event using "Set Event Location" will cause a crash.

    Disabling Community Lighting fixes the issue.

    Code:
    rmmz_managers.js:2030 TypeError: Cannot read property '0' of undefined
        at Game_Interpreter.command203 (rmmz_objects.js:10483)
        at Game_Interpreter.command203 (Community_Lighting.js:1939)
        at Game_Interpreter.executeCommand (rmmz_objects.js:9621)
        at Game_Interpreter.<computed> [as executeCommand] (VisuMZ_1_EventsMoveCore.js:5306)
        at Game_Interpreter.update (rmmz_objects.js:9526)
        at Game_Map.updateInterpreter (rmmz_objects.js:6757)
        at Game_Map.update (rmmz_objects.js:6661)
        at Game_Map.<computed>.<computed> [as update] (VisuMZ_1_EventsMoveCore.js:5306)
        at Scene_Map.updateMain (rmmz_scenes.js:733)
        at Scene_Map.updateMainMultiply (rmmz_scenes.js:729)
  15. @AsuranFish Good catch. I've got it fixed in the version I'm working on. :)

    Edit: Tried my luck with a pull request that adds all the things. Except light cycling, but that's coming too. Oh and battle tinting via plugin command. send help with that one please.
  16. Can I try to propose a new feature? If in your opinion it is possible: Would it be nice, in your opinion, to have the possibility to create lights with a command, supplying X and Y of the map? Without necessarily needing to create an event and place the note tag inside it.
  17. Originally there was an effect on XY option. The others would know better about it being in the main script.

    On a different note I approved the latest pull request... I guess I didn't have email notifications on about pull requests, so I didn't think to look till today. GitHub's very strange, and definitely going to take some getting used to. At some point I also need to "pretty" stuff up.
    I do like that it compares code... Though honestly I usually just approve the pull requests since I don't often have the extra time to commit to evaluating all the code changes. Half the point was letting other community members test it first. It might actually be better to also post any test scripts here before putting up pull requests.

    Then again I'm not sure how many people actually grab the latest script to test it. Perhaps I should make an experimental section. Though I suppose if a broken script is put up as the main we'll know quickly enough when people complain. So I guess "trial by fire" is an option too. :LZSwink:
  18. Hopefully it works. It should work since I tried to test it as thoroughly as possible, but I've been known to space out before. :)

    Also yeah, there was an effect_on_xy, but it was part of the weird quasiABS thing or mog plugin stuff or something. At some point, it was removed so the plugin command described in the help wasn't ever actually called and the function that was supposed to be called was just changing some variables that only existed within that function's scope, so it was, in a word, useless.
  19. Just reviewed the thing and indeed the battletint plugin
    command seems to have disappear at some point in the MV version.

    Currently putting it back, and adapting it to MZ.
  20. "Today I propose an experiment..."

    What a cool idea! I wish I had an ounce of knowledge to contribute. I hope you all have fun and I look forward to see how this turns out.