Author Topic: Ilumination: Know bugs  (Read 377 times)

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
Ilumination: Know bugs
« on: September 13, 2014, 07:20:02 pm »


               

Lighting is bugged in NWN, and has been since day one. It appears that it can't be fixed. The bug is that, even turning of a placeable's illumination will still cause a glow around it when the PC is nearby.


 


Someone have fixed it?



               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Ilumination: Know bugs
« Reply #1 on: September 14, 2014, 12:51:46 pm »


               WhiteTiger,
In my current build, I played with this some.
My first attempt was to change tile lighting around a lighthouse. A sweeping light at night. Spent alot of time on the RecomputeStaticLighting. Gave up. I did however look into the Zep lighting scripts. They were huge, but in the notations it said that all you are doing is destroying one light and replacing it with another.
Long story short, Rather than using the initial state of the placeable, I found 2 lightpost in appearance that had an on and off appearance. I added them to the pallete with an area name and day/night Tag.
I placed a plot object in the area, and gave it a HB script that when the PC is in the area, sets the locked state of the lightpost. On the post I set scripts on the UnLock that made them spawn their counterpart and destroy themselves.
In testing it seems to work well. Ive never seen any glow doing this, but then again, my eyes aren't what they used to be. I also have never tried to use this in the OnUsed for a light.
Is there something here ?
Or am I just standing in the dark ?

Ed
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Ilumination: Know bugs
« Reply #2 on: September 26, 2014, 09:39:24 pm »


               

You seem to be assuming that placeables are dynamic light sources. They are not. Their light gets burned into the tiles and this information is distributed to all the clients.


 


If you change the lighting state of a placeable you need to RecomputeStaticLighting after the light change of light state on teh placeable is completed. Given the delay of animations and such I usually delay my call of RecomputeStaticLighting by up to 3 seconds. Its fiddly to get the delay just right, and so you'll need to experiment.


 


And with that comment, I am back to work on another 16 hour day - only 10 hours to go. Woot! Thankfully I don't have to work for the man this weekend.



               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Ilumination: Know bugs
« Reply #3 on: September 26, 2014, 10:19:32 pm »


               

henesua,


I  do use RecomputeStaticLighting. What botherded me most about the ZEP lighting was that each lamppost had it's own HB script.


My current build contains a city. Lots of lights. To avoid so many HBs, I use one placeable HB to controll all the lighting in an area.


 


This is the HB script on a barrel in one area.


void main()


{


 object oPC = GetFirstPC();


 object oArea = GetObjectByTag("AirimoreDocksNorth");


 object oBarrel = OBJECT_SELF;


 object oObject = GetFirstObjectInArea();


 


// if(GetArea(oPC) == oArea)


// {


  if(GetIsDawn())


  {


   while(GetIsObjectValid(oObject))


   {


    if(GetTag(oObject) == "LampNDockOn")


    {


     SetLocked(oObject,FALSE);


    }


    oObject = GetNextObjectInArea();


   }


  }


  else


  {


   if(GetIsDay())


   {


    while(GetIsObjectValid(oObject))


    {


     if(GetTag(oObject) == "LampNDockOn")


     {


      SetLocked(oObject,FALSE);


     }


     oObject = GetNextObjectInArea();


    }


   }


   else


   {


    if(GetIsDusk())


    {


     while(GetIsObjectValid(oObject))


     {


      if(GetTag(oObject) == "LampNDockOff")


      {


       SetLocked(oObject,FALSE);


      }


      oObject = GetNextObjectInArea();


     }


    }


    else


    {


     if(GetIsNight())


     {


      while(GetIsObjectValid(oObject))


      {


       if(GetTag(oObject) == "LampNDockOff")


       {


        SetLocked(oObject,FALSE);


       }


       oObject = GetNextObjectInArea();


      }


     }


    }


   }


  }


 //}


 DelayCommand(2.0,RecomputeStaticLighting(oArea));


}


 


And this is the on unlocked script for a lamp that's on in the area.


void main()

{

 object oLamp = OBJECT_SELF;

 string sLamp = "lamp_n_dock_off";

 int nType = OBJECT_TYPE_PLACEABLE;

 location lLoc = GetLocation(oLamp);

 CreateObject(nType,sLamp,lLoc,FALSE);

 DestroyObject(oLamp,0.01f);

}


 


I had to uncoment the check for the PC on the first script. for some reason it would only kill the lights in the area of the PC.


I have made 2 areas so far, with about 30 lights, and have not noticed any lag.


 


Ed.