Mapper2 - Lighting (indoor/outdoor)

Discussion in 'Fallout General Modding' started by notdefix, Aug 15, 2016.

  1. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    Hi,

    I'm trying to figure out how to make sure an underground location does not have outdoor lighting. In other words, I'm trying to disbale the 'dark at night and bright sunlight at noon' setting.

    I've toyed around with the D key [Switch light level look of map (day, night et al)] in mapper, but that does not seem to do the trick.

    Is there a setting in some other file where I can switch this setting?

    Cheers
     
  2. Darek

    Darek is currently unavailable

    Jan 7, 2008
    You need a map script for that, or in case you do have one you need to change light settings in it.
    The light is decided in two places in the script. First in "procedure map_enter_p_proc" (sets the light level of the map depending on the time you enter it), and second is "procedure map_update_p_proc" (changes the light level depending on time meanwhile you are on the map).
    I'm guessing you are after cavern lightning (50).
    The best way to make the script is probably to look at another one (like arcaves.ssl) and take the bits you need from there.

    If your underground map is on level 2 and you have a ground map on level 1 it gets a bit more complicated, so ask if that's the case.
     
  3. Jotisz

    Jotisz Mildly Dipped

    557
    Aug 28, 2007
    I think NAVARO.sll could be helpful if the both ground and underground levels are on the same map.
    Code:
       if (elevation(dude_obj) == 1) then begin
          Full_Light;
       end
       else begin
          Lighting;
       end
    
    Basically this means if you on level 2 then you have lights always.
     
  4. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    Ok, I'm at a loss :-)

    I decompiled klatoxcv.ssl and found that it mostly seems to match the script that comes with BIS Mapper (only flattened and with variable names missing, but that's as expected).

    However, the script already says:

    Code:
    procedure map_update_p_proc begin
       Cavern_Lighting;
    end
    
    Where the Cavern_Lighting; procedure simply does a set_light_level(50);

    The map_update_p_proc procedure is called from start procedure (which I assume is entry point for a script). Yet, the lighting of the map (in the game, not in the mapper) is definitely affected by the time of day.

    So I guess I'm doing something wrong, but I have no idea what?

    (I made sure I set the map script for toxic caves to the correct script and saved the map, just to be double sure the script has been selected)
     
    Last edited: Aug 18, 2016
  5. Darek

    Darek is currently unavailable

    Jan 7, 2008
    Is that by your doing or some modded script? That is not necessary as the game will look for certain procedures on it's own such as map enter and map update (all those procedures are described on the last two pages of the Fallout_Editor.pdf).

    Anyway, I have two questions for you.
    Did you set the map script in the mapper and did you enter your map for the first time (after setting the new map script)?
    If it's not the first time you enter the map, you will be using an old copy (from your save) of th4e map without that new map script.
     
  6. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    The script is (for now) the default script that lives in master.dat*.

    I've set the map script in the mapper and saved the map afterwards. I then loaded up my savegame and travelled from Klamath to the Toxic Caves, and the caves lighting is affected by the day/night time. The save is used was made before I visited the toxic caves map. In other words, I've not visited the Toxic Caves, according to the save game. (but I did not start a new game after changing the map).



    *) I decompiled the script found inside master.dat and compared the decompiled results with the .ssl file that comes with BIS Mapper. The two files seem to be the same version (only the decompiled file is, off course, missing variable names and all macros are flattened out).
     
  7. Darek

    Darek is currently unavailable

    Jan 7, 2008
    If all of the above is correct I don't really know what it could be, sorry. If you upload the map I'm willing to take a look at it though.
     
  8. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    If you could take a look, that would be great. I've included the unmodified script file (the one from master.dat) and the unmodified source file (as bundled with BIS mapper).

    Cheers
     

    Attached Files:

  9. Darek

    Darek is currently unavailable

    Jan 7, 2008
    So I found the problem. It's a weird map bug that I have seen a few times before but have no idea how it happens.
    Possibly a Mapper bug that corrupts the map.
    Basically you have some hidden scripts embedded in your map that don't belong there. Supposedly attached to some non-existing scenery. You can't see them in the Mapper to remove them, nor do they get removed when you clear the map levels. If you save the map to a text file (setting in mapper2.cfg) you can see them in there, and you can also see them in the Fallout 2 savegame editor.
    The script causing you trouble with the lightning is sfchina.int (map script for San Fran). You can test that by renaming the KLATOXCV.int to sfchina.int and it will work.

    I don't have time to explain how to remove the scripts now so will have to get back to you on that.
     
    • [Like] [Like] x 1
  10. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    Thanks, I really appreciate the help.

    I'm happy to learn that a: it is solvable and b: I'm not completely stupid in not figuring out the issue myself.
     
  11. Darek

    Darek is currently unavailable

    Jan 7, 2008
    Yeah don't worry about that, this isn't exactly regular modding stuff.
    Do you have any idea how this mess could have happened? Maybe had the San Fran map open in the Mapper before going to your map, and also doing some play testing (F8 mode) as the player script was one of those embedded scripts?

    Anyway, here's a small step by step to fix the map:

    Set "save_text_maps=1" in mapper2.cfg.
    Backup your map!
    Start Mapper and load your map. Now you want to create an almost empty version of your map, so from the drop down menu "clear map level" on all levels and "delete ALL spatial scripts" (not sure if it deletes all or if you have to do it on each level).
    Save the map and exit. Go to your map folder and open the text version of the map.
    Scroll down to the script section (scr_num: ) and you should see 8 scripts there. These are the ones you want to remove later so keep that file open or move it to another folder so it don't get overwritten.

    Now copy your backup of the map back in the map folder and start the Mapper. Load your map and just save it again and exit.
    Open the text file map you just created and search for "scr_num: 10" and change it to "scr_num: 2". Then remove 8 of the scripts (the ones from your first text map). Basically, you only want to keep scripts with scr_script_idx: 1200 and 1201 in that part of the script section.
    Save and go back into the Mapper to recreate the map. "Open from text" is broken and will crash the Mapper, so you will have to use "rebuild all maps" instead. Make sure your map is the only map text file in your folder so you don't create others unnecessarily.

    Now that the map is back to normal again you'll have to fix a few things, as saving a map into a text file doesn't save everything correctly. It breaks the green exit grids and ladder data, and those will have to be reset. Inventory items also gets screwed (the amounts of items and their weight) so they will need to be replaced in containers and on critters too.

    If you are good with a hex editor you can of course skip the whole map to text thing and remove it directly.
    I did it once and well, lets just say that I'll never try that again...

    Hope that helps.

    Or you can just skip the above and take the map I fixed while writing this stuff. I think everything is good but you better check it just in case.
     
    Last edited: Aug 19, 2016
    • [Like] [Like] x 1
  12. notdefix

    notdefix First time out of the vault

    58
    Jul 28, 2016
    I've no idea how the mess was created. I did quite some play testing (using F8) so maybe that could cause the player script to somehow end up in the map. However, I did not (to my knowledge) ever even open any of the San Fran maps.
    I didn't start a new map though, I made changes to the original toxic caves map, so maybe the San Fran scripts are already in there, I don't know.


    Then, onto the issue at hand: thanks! With your help I've managed to remove all scripts and I've got the map back in working order: the lighting is now working as intended.
     
    Last edited: Aug 20, 2016