Author Topic: Interior: Torch-Lit Only  (Read 543 times)

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Interior: Torch-Lit Only
« on: September 06, 2011, 06:48:08 am »


               Hello, forum. How are you?

I was building a cave and, without going into detail on how much panic it caused me to find my corridor tile torches (which I diligently put out yesterday) all lit again, I found the issue and fixed it. That was easy; it just seems that using Interior: Torch-Lit Only as a visual setup causes torches to appear and, in fact, some tiles cannot be torchless at all when this visual setup is chosen.

What I'm wondering is if there's a way to apply this effect on an area on the fly (without changing diffusion colors, etc.) to make spontaneously lighting halls minus the bulky placeables and supporting script. If not direcly by setting the visuals of an area by template (I have no clue which 2da file sorts those), then does anyone know what "effect" is applied to the area and if it can be applied by script?

Thank you, forum.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #1 on: September 06, 2011, 10:02:43 am »


               You can change area fog density, amount, and color, unfortunately, through vanilla scripting, there is no methods for changing the diffuse or ambient lighting.
If it were possible to do so, it would be via nwnx, and it would involve making some sort of edit to the area struct.

A work around, is to set it to torch lit only, and then use cep2.3 lightning placeables.

These placeables have a 'light' visual effect, which can be customized to be whatever color you need. (from the available constants).

For example, you could have YELLOW_20   for a well lit area, and when it is meant to be dark, you can have YELLOW_05 to make the area less lit.
Changing the YELLOW_## to be BLUE_##  Would change the light color to be blue also.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #2 on: September 06, 2011, 11:09:12 am »


               I know there are rules for applying VFXs to objects, but maybe you could create like 5 placeable objects (each with their own tagname) and apply "light" to them from an On Enter Script, all of the objects in the area with the same tagname that is, this may be a work around, not sure if this is possible though, as I have never applied Light to objects...
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #3 on: September 06, 2011, 11:19:58 am »


               CEP2.3 has interior -> lightning  placeables, which have a framework setup for this.

You can set each objects light constant variable individually, to the given color and intensity.

I would recommend using the CEP2.3 placeables, as it saves you from having to re-invent the wheel.
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #4 on: September 07, 2011, 01:19:03 am »


               Oh, I already made my own lighting script (I didn't like the fact that CEP's version was on HB). My question was merely regarding whether a certain effect could be applied to an area.

To specify what effect I mean, I'm not referring to colors or anything; I'm referring to what I noticed when setting/unsetting the title visual setup. Namely, that aside from all the parameters shown to the user in the toolset, there appears to be something switched on by using Interior: Torch-Lit Only that creates lights in a different way then when using another visual setup among the default ones.

For example, an area where I manually removed all lights from cave walls (in the [CEP] Mines and Caverns tileset) was, as intended, light-free in Interior: Dark setting. If I then switch to Interior: Torch-Lit Only, I have several wall torches in my corridors, many of which cannot be removed (at intersections most notably), which led me to suspect that whatever is controlling the application of tile-lights has an unseen setting (the same intersection that can be unlit in any other visual setup has a light applied to it that cannot be removed - a seperate "light mesh" that depends on the visual setting, maybe?). I was wondering, partly just out of curiosity and partly because it would be a cool, easy on CPU way of making halls light up, if anyone knew how to control that (whatever it is).

Thanks for taking the time to answer, though.
               
               

               


                     Modifié par Hardcore UFO, 07 septembre 2011 - 12:23 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #5 on: September 07, 2011, 02:13:23 am »


               Are you asking if you can turn on/off source light 1 or 2 in an area that is torch lit only? Or are you asking if you can alternate between the different interior modes of lighting? There are several lighting functions that you can use. I'm still just not 100% sure what you are asking.

As far as what happens when switching between different lighting types, they are each different, use different colors, etc. And it's usually pretty random, from my experience, which torches get lit and what not.
               
               

               


                     Modifié par GhostOfGod, 07 septembre 2011 - 01:15 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #6 on: September 07, 2011, 03:00:04 am »


               Actually after rereading the first post again....I've never had a problem with a "torchlit only" area and not being able to turn off all the source lights (in the toolset anyway). You just grab all tiles while in terrain mode and set sourcelight 1 and 2 to black. Then if you want to have them all turn on while in game you would use the "SetTileSourceLightColor(location, int, int)" function followed by the "RecomputeStaticLighting" function. Turning them back off is the part that you can't seem to do via scripting. At least I still havent found a way.

This script will turn on all the source lights in an area:


//Turn tile light sources on.
void main()
{
    object oArea = GetArea(OBJECT_SELF);
    float fAreaX = IntToFloat(GetAreaSize(AREA_HEIGHT, oArea));
    float fAreaY = IntToFloat(GetAreaSize(AREA_WIDTH, oArea));
    vector vTile = Vector(0.0, 0.0, 0.0);
    location lTile = Location(oArea, vTile, 0.0);
    float fX = 0.0;
    float fY = 0.0;
    while ((fX < fAreaX) && (fY < fAreaY))
    {
        vTile = Vector(fX, fY, 0.0);
        lTile = Location(oArea, vTile, 0.0);
        SetTileSourceLightColor(lTile, TILE_MAIN_LIGHT_COLOR_WHITE, TILE_MAIN_LIGHT_COLOR_WHITE);
        fX = fX + 1.0;
        if(fX >= fAreaX)
        {
            fY = fY + 1.0;
            fX = 0.0;
        }
    }
    RecomputeStaticLighting(oArea);
}
               
               

               


                     Modifié par GhostOfGod, 07 septembre 2011 - 02:01 .
                     
                  


            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #7 on: September 07, 2011, 03:13:55 am »


               I don't know whether to laugh or cry. I had never tried right-clicking a tile before.

However, I still find it odd given that the tiles cycle through some unlit options in Interior: Dark (for example) but refuse to be unlit when I was in Interior: Torch-Lit Only. I mean, I can set it manually to off (right clicking is so cool), but the tile itself, by cycling variations by clicking repeatedly, yields different light possibilities depending on the visual settings. Uh, not as useful as I thought but neat.

The script there is just what I was hoping to apply, given the parameters now elucidated. Thanks muchly.
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #8 on: September 07, 2011, 04:52:29 am »


               I have a similar, but different question.
Whenever I've made a torch-lit only room, well, it's always too bright! Even if the PC isn't carrying any light source, he can still see just fine.

Is there any way to make a torch-lit only REALLY torch-lit only? aka DARK! lol =)
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Interior: Torch-Lit Only
« Reply #9 on: September 07, 2011, 06:21:24 am »


               

Zeidae wrote...

I have a similar, but different question.
Whenever I've made a torch-lit only room, well, it's always too bright! Even if the PC isn't carrying any light source, he can still see just fine.

Is there any way to make a torch-lit only REALLY torch-lit only? aka DARK! lol =)


Are you sure you weren't playing/testing with an elf, half elf or gnome. They all have low-light vision and can see pretty well, seems bright, even when in a torch lit only area. Even your gamma setting can make it seem brighter than it is.
I think "Torch-lit only" is the darkest lighting scheme. You could increase the moon fog to 100 and keep the fog clip distance to the minimum. That will make it quite a bit darker. But then torches wont work quite as well either.
               
               

               


                     Modifié par GhostOfGod, 07 septembre 2011 - 06:58 .