OcRam - Lights plugin (MZ/MV)

● ARCHIVED · READ-ONLY
Started by OcRam 300 posts Page 15 of 15 View original ↗
  1. woootbm said:
    After a bit of testing it looks like it can be reproduced using Yanfly Save Core, and I can't seem to get the repro when that is disabled. I thought Autosave was the culprit but I guess it's just the base Save Core.

    EDIT: I've been trying to reconstruct the conditions in a fresh project, adding plugins one by one. So far, no luck at all. Sorry this is a bit of a tangled mess for me.
    Ok. Let me know if you can repeat this in fresh project.

    You mentioned something about parallel event I have seen many lags caused by these. Even if it runs every 5 frames it can cause severe lag (depending on what it does).
  2. @OcRam The parallel event I mentioned was something I made to try to fix the symptoms of the issue, since the issue seemed to go away on loading a new level with different lighting. If there's a smarter way to refresh whatever thing is getting stuck before/after a fight I can do that easily since all my fights are from events.

    I really wish I had some clue as to why this only happens after a save>load.
  3. woootbm said:
    @OcRam The parallel event I mentioned was something I made to try to fix the symptoms of the issue, since the issue seemed to go away on loading a new level with different lighting. If there's a smarter way to refresh whatever thing is getting stuck before/after a fight I can do that easily since all my fights are from events.

    I really wish I had some clue as to why this only happens after a save>load.
    So if you turn off OcRam_Lights -plugin it doesn't happen?
  4. @OcRam I cannot seem to get a repro while OcRam_Lights is turned off, no. I should mention that it doesn't always happen. But once it starts happening it happens in every fight until I do something like load into another level.

    EDIT: A lot of info here but avoiding a double post. I forgot had this made a while ago with help from the forums.

    JavaScript:
    for (let i = 1; i <= DataManager.maxSavefiles(); i++) {
        if (!DataManager.isThisGameFile(i)) {
            $gameSwitches.setValue(41, true);
            $gameSystem.onBeforeSave();
    if (DataManager.saveGame(i)) { StorageManager.cleanBackup(i);
    if (DataManager.loadGame(i)) {$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);$gamePlayer.requestMapReload();SceneManager.goto(Scene_Map);}}
            break;}
        if (i === DataManager.maxSavefiles()) {
            $gameMessage.setPositionType(1);
            $gameMessage.add("No save slots available! Please delete a save and try again.");
            this.setWaitMode("message");
            $gameTemp.pickSlot = true;}}
    
    if ($gameTemp.pickSlot) {
        $gameTemp.pickSlot = false;
        SceneManager.push(Scene_Save);
    }

    Once I started using Ocram Light, suddenly I started getting this error (crash) on running this save script:

    JavaScript:
    YEP_CoreEngine.js:1098 TypeError: $gamePlayer._lightData.update is not a function
        at OcRam_Light_Layer.updateMapLights (OcRam_Lights.js:1411)
        at Spriteset_Map.<anonymous> (OcRam_Lights.js:1077)
        at Spriteset_Map.c.(anonymous function) [as update] (chrome-extension://odlameecjipmbmbejkplpemijjgpljce/js/plugins/OcRam_Lights.js:28:135)
        at rpg_scenes.js:262
        at Array.forEach (<anonymous>)
        at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
        at Scene_Map.Scene_Base.update (rpg_scenes.js:113)
        at Scene_Map.update (rpg_scenes.js:596)
        at Scene_Map.update (YEP_CoreEngine.js:1425)
        at Scene_Map.update (ReloadWindow2.js:76)

    The point of this save script is that it automatically creates a save for the player, since Yanfly autosave requires the player to make a save themselves before the autosave can ever work. The way I've been getting around the crash is that this script gets run on a map that has no lighting on it. But I guess there's something about this save that doesn't always save properly?

    Anyway, this hasn't helped me figure out a repro but I wondered it was a useful clue.
  5. woootbm said:
    @OcRam I cannot seem to get a repro while OcRam_Lights is turned off, no. I should mention that it doesn't always happen. But once it starts happening it happens in every fight until I do something like load into another level.

    EDIT: A lot of info here but avoiding a double post. I forgot had this made a while ago with help from the forums.

    JavaScript:
    for (let i = 1; i <= DataManager.maxSavefiles(); i++) {
        if (!DataManager.isThisGameFile(i)) {
            $gameSwitches.setValue(41, true);
            $gameSystem.onBeforeSave();
    if (DataManager.saveGame(i)) { StorageManager.cleanBackup(i);
    if (DataManager.loadGame(i)) {$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);$gamePlayer.requestMapReload();SceneManager.goto(Scene_Map);}}
            break;}
        if (i === DataManager.maxSavefiles()) {
            $gameMessage.setPositionType(1);
            $gameMessage.add("No save slots available! Please delete a save and try again.");
            this.setWaitMode("message");
            $gameTemp.pickSlot = true;}}
    
    if ($gameTemp.pickSlot) {
        $gameTemp.pickSlot = false;
        SceneManager.push(Scene_Save);
    }

    Once I started using Ocram Light, suddenly I started getting this error (crash) on running this save script:

    JavaScript:
    YEP_CoreEngine.js:1098 TypeError: $gamePlayer._lightData.update is not a function
        at OcRam_Light_Layer.updateMapLights (OcRam_Lights.js:1411)
        at Spriteset_Map.<anonymous> (OcRam_Lights.js:1077)
        at Spriteset_Map.c.(anonymous function) [as update] (chrome-extension://odlameecjipmbmbejkplpemijjgpljce/js/plugins/OcRam_Lights.js:28:135)
        at rpg_scenes.js:262
        at Array.forEach (<anonymous>)
        at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
        at Scene_Map.Scene_Base.update (rpg_scenes.js:113)
        at Scene_Map.update (rpg_scenes.js:596)
        at Scene_Map.update (YEP_CoreEngine.js:1425)
        at Scene_Map.update (ReloadWindow2.js:76)

    The point of this save script is that it automatically creates a save for the player, since Yanfly autosave requires the player to make a save themselves before the autosave can ever work. The way I've been getting around the crash is that this script gets run on a map that has no lighting on it. But I guess there's something about this save that doesn't always save properly?

    Anyway, this hasn't helped me figure out a repro but I wondered it was a useful clue.
    Hi,

    Apparently that script preserves $gamePlayer._lightData, but deletes (or somehow invalidates) update method of that light class. Solution to this would be to re-create all light data after successful save.

    EDIT: If I remember correctly you can call $gameSystem.loadLightData(); // to re-create all lights
  6. OcRam said:
    Hi,

    Apparently that script preserves $gamePlayer._lightData, but deletes (or somehow invalidates) update method of that light class. Solution to this would be to re-create all light data after successful save.

    EDIT: If I remember correctly you can call $gameSystem.loadLightData(); // to re-create all lights
    I can't seem to find a place where this eliminates the issue. I put it in my script, and I also put it in Yanfly's Autosave in both the StorageManager.performAutosave = function() and DataManager.loadGameWithoutRescue = function(savefileId). I even put it in the map as a parallel event that runs every 10 frames to make sure it happens. I can still get hit with 20fps combat after a load.

    A couple new tidbits that might be important:

    1. In my repro, I always reload the whole game with F5 (this also works with alt-f4) first. I don't think this happens if I load a save without refreshing the app first.
    2. I was able to repro this with orange overlay fully off on a map with basic tiling so that plugin is out of the picture.
  7. woootbm said:
    I can't seem to find a place where this eliminates the issue. I put it in my script, and I also put it in Yanfly's Autosave in both the StorageManager.performAutosave = function() and DataManager.loadGameWithoutRescue = function(savefileId). I even put it in the map as a parallel event that runs every 10 frames to make sure it happens. I can still get hit with 20fps combat after a load.

    A couple new tidbits that might be important:

    1. In my repro, I always reload the whole game with F5 (this also works with alt-f4) first. I don't think this happens if I load a save without refreshing the app first.
    2. I was able to repro this with orange overlay fully off on a map with basic tiling so that plugin is out of the picture.
    I would put it here:
    JavaScript:
    for (let i = 1; i <= DataManager.maxSavefiles(); i++) {
        if (!DataManager.isThisGameFile(i)) {
            $gameSwitches.setValue(41, true);
            $gameSystem.onBeforeSave();
    if (DataManager.saveGame(i)) { StorageManager.cleanBackup(i);
    if (DataManager.loadGame(i)) { $gameSystem.loadLightData(); // <== HERE // I'd also check that this actually happens after auto save
        $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);$gamePlayer.requestMapReload();SceneManager.goto(Scene_Map);}}
            break;}
        if (i === DataManager.maxSavefiles()) {
            $gameMessage.setPositionType(1);
            $gameMessage.add("No save slots available! Please delete a save and try again.");
            this.setWaitMode("message");
            $gameTemp.pickSlot = true;}}
    
    if ($gameTemp.pickSlot) {
        $gameTemp.pickSlot = false;
        SceneManager.push(Scene_Save);
    }
  8. Well, it seems to be harder to repro but it is still happening maybe 25% of the time. I also tried running $gameSystem.loadLightData(); on turn 0 of a fight but I'm still able to get it to happen.

    I don't know if there's somewhere during the loading of a fight that there could be something injected to make sure it loads correctly.
  9. woootbm said:
    Well, it seems to be harder to repro but it is still happening maybe 25% of the time. I also tried running $gameSystem.loadLightData(); on turn 0 of a fight but I'm still able to get it to happen.

    I don't know if there's somewhere during the loading of a fight that there could be something injected to make sure it loads correctly.
    Bummers.

    Plugin itself hooks up to "onAfterLoad" core event - so if it doesn't happen then lights needs to be manually created... What if you inject $gameSystem.loadLightData(); to "Scene_Base.onAutosaveSuccess"?

    Yet again dunno how your project calls that one with custom scripts and other than OcRam -plugins...
  10. Sorry, I'm not really sure where that is? I see a Scene_Base.prototype.performAutosave = function() {}; in the autosave plugin but not that specific call. Unless you just mean for me to find something similar.
  11. woootbm said:
    Sorry, I'm not really sure where that is? I see a Scene_Base.prototype.performAutosave = function() {}; in the autosave plugin but not that specific call. Unless you just mean for me to find something similar.
    You must be using MV then, "onAutosaveSuccess" is a MZ function...

    Best advice I can give: call $gameSystem.loadLightData(); after any saving. RPG Makers save method/function will destroy any methods/functions (and self referring objects) that are attached to game objects, thus light data needs to be re-created.
  12. Character Maker This plugin is not supported
    I mean, mz version
  13. Hey OcRam, I have a couple questions, Did anything ever come of OcRam shadows? sounds really cool.

    I'm having problems with battle lighting, the battle screen has my night tint but the lighting isn't showing up, it should light it automatically from the plugin settings if the screen is tinted right?.

    Lastly I was wondering if it was possible to have weathers that won't show during the night for example I have sunshine and rain in my spring weather pool, I definitely don't want sunshine at night. Is there a way to do this?. It would be awesome if when setting up your weathers you could add a time restriction like available or not available from 06:00 to 18:00.

    Edit: I'm using MV
  14. LinkToFuture said:
    Hey OcRam, I have a couple questions, Did anything ever come of OcRam shadows? sounds really cool.

    I'm having problems with battle lighting, the battle screen has my night tint but the lighting isn't showing up, it should light it automatically from the plugin settings if the screen is tinted right?.

    Lastly I was wondering if it was possible to have weathers that won't show during the night for example I have sunshine and rain in my spring weather pool, I definitely don't want sunshine at night. Is there a way to do this?. It would be awesome if when setting up your weathers you could add a time restriction like available or not available from 06:00 to 18:00.

    Edit: I'm using MV
    OcRam_Shadows is still WIP. Already done auto floor plans (ray casting points), roof masking (and custom roof bitmap masks) and ray casting. TODO: Light mask clipping, custom floor plans and sprite shadows. It will be MZ only release (don't yet know how it will be RETRO'able (shouldn't be a problem), but one step at the time).

    NOTE: In-game tint is not same as OcRam Lights BG.

    OcRam Lights BG is where all the light sources are drawn and in-game tint is a layer below Lights BG.

    There was "Weather conditions" parameter in MZ, but in MV you need to do it manually via parallel common event or similar. I'd probably do it in MV with "OcRam_Parallels_EX" -plugin - more specifically via <trigger_var:N> in common parallel event where N would be you weather variable id.

    In that event you could just check if weather is "sunshine" and day phase variable is "night" IF TRUE set weather to "clear" or would draw another weather from pool until weather != "sunshine".
  15. OcRam said:
    There was "Weather conditions" parameter in MZ, but in MV you need to do it manually via parallel common event or similar. I'd probably do it in MV with "OcRam_Parallels_EX" -plugin - more specifically via <trigger_var:N> in common parallel event where N would be you weather variable id.

    In that event you could just check if weather is "sunshine" and day phase variable is "night" IF TRUE set weather to "clear" or would draw another weather from pool until weather != "sunshine".
    If I use the "<trigger_var:3>" 3 being day phase variable, It should only run one time when the variable changes right?, it seems to keep repeating itself over and over and the weather gets stuck in the top left corner.

    Edit: So I'm testing with a text box that says "Hi" I've tried to make it appear when day phase changes and when hour changes, both don't work but the text will show up if I A: start a new game and B: re-enter the map. with out the <trigger_var: #> comment the text box would just appear over and over again.

    With weather it's the opposite It seems like the common event is calling it over and over instead of just when the day phase changes. Any clue what I'm doing wrong? there doesn't seem to be any errors.

    Edit 2: I've tried the text box showing up every hour on a fresh install of your RMMV Demo project and it doesn't work there either.

    Edit 3: Turns out if using one variable or switch you need to write it like <trigger_var:3:> instead of <trigger_var:3>. but now I've run into another problem. I got the text box to appear once every hour but it also appears whenever I re-enter the map how would I fix that?
  16. LinkToFuture said:
    If I use the "<trigger_var:3>" 3 being day phase variable, It should only run one time when the variable changes right?, it seems to keep repeating itself over and over and the weather gets stuck in the top left corner.

    Edit: So I'm testing with a text box that says "Hi" I've tried to make it appear when day phase changes and when hour changes, both don't work but the text will show up if I A: start a new game and B: re-enter the map. with out the <trigger_var: #> comment the text box would just appear over and over again.

    With weather it's the opposite It seems like the common event is calling it over and over instead of just when the day phase changes. Any clue what I'm doing wrong? there doesn't seem to be any errors.

    Edit 2: I've tried the text box showing up every hour on a fresh install of your RMMV Demo project and it doesn't work there either.

    Edit 3: Turns out if using one variable or switch you need to write it like <trigger_var:3:> instead of <trigger_var:3>. but now I've run into another problem. I got the text box to appear once every hour but it also appears whenever I re-enter the map how would I fix that?
    Indeed you need to add last : for it to work as intended example <trigger_var:#:>

    If you wish to not run event on map start, you could add "previous weather id" variable and just exit event processing if current weather id = previous one.
  17. Can anyone in the form help me understand how region lighting works? and colours as it's something I still don't fully get...

    I have this at present

    <light1:1:48:#ffffff>

    <light2:9:48:#00eeff>

    but unsure how to get other colours as the help tab doesn't really help.. (used terrax forever ago and it would just be saying cyan for example...

    Same as diffrent types of lights direction wise.
  18. @dragon1up In Google use the Hex Color Picker tool to get a 6 digit colour value preceded by a hash (#). Use that in the "light" comment (sometimes there's an "ff" at the beginning making it 8 digits, that's the transparency (alpha) value but I don't think it's used).
    For rotation use the "light-ex" comment after your normal light comment, one of the values between the colons ( : ) is degrees (0 to 360) and the another is rotation (also 0 to 360). I can't remember which value is which or where to find out, experiment with different values.
    Eg.
    <light:1:288:#ffeeaa88>
    <light-ex:0,0:45:0:0:0.2>
  19. OpenTangent said:
    @dragon1up In Google use the Hex Color Picker tool to get a 6 digit colour value preceded by a hash (#). Use that in the "light" comment (sometimes there's an "ff" at the beginning making it 8 digits, that's the transparency (alpha) value but I don't think it's used).
    For rotation use the "light-ex" comment after your normal light comment, one of the values between the colons ( : ) is degrees (0 to 360) and the another is rotation (also 0 to 360). I can't remember which value is which or where to find out, experiment with different values.
    Eg.
    <light:1:288:#ffeeaa88>
    <light-ex:0,0:45:0:0:0.2>
    Oh this should help then, any other light advice ? I.e lights not being too big or clipping over tilesets
  20. That helps, does region tag work the same as terrin tag ?

    As I'd like certain regions to have lights and some not have lights? , as it seems to partially work but not fully work as intented.

    1768527550590.png

    <light1:1:48:#bd2e1e> is for tile and light is the following

    Light 50 #bd2e1e naturally I don't want the lights going over tiles unless that's just part of it, I remember reading that's a non issue in the MZ version though.