Author Topic: Trouble with NPC Turning on/off Placable light  (Read 309 times)

Legacy_Arawan

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Trouble with NPC Turning on/off Placable light
« on: September 30, 2010, 05:06:34 pm »


               Hi all,

I am doing a sentry NPC who spawns at 7 and 19 (dawn is 6 and dusk is 18), and using the NESS Spawn and patrol system I am trying to get him to turn on / off the placed lights. But for some reason it wont work? 

The script (partial) I use is : 

 if (nPatrolScript == 0)
    {
         object oLight = GetNearestObjectByTag("Light", oStop);
        if ((GetIsDay() == TRUE && GetPlaceableIllumination(oLight) == TRUE)
         || (GetIsNight() == TRUE && GetPlaceableIllumination(oLight) == FALSE))
        {
            ActionDoCommand(DoPlaceableObjectAction(oLight, PLACEABLE_ACTION_USE));
        }

       ActionDoCommand(SpeakString("Lights Off!"));
    }

I added the speakstring just to check that the script fires, which it does, so it must be a problem with the other lines of code, but I cant see what is wrong, and the script is supposed to be standard?  The placeable is a standard torch bracket, I have it Tagged "Light" (Without the  "") , and it is set as useable and plot.

Any idea what is wrong?

Oh and a thought, is there any way to remove the "glare / glow" from the torch when it is actually off? The flames disappear but a glow remains and emits the same light as when it is on? Seems a bug to me, but not sure..

Cheers
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Trouble with NPC Turning on/off Placable light
« Reply #1 on: September 30, 2010, 05:10:55 pm »


               It is a bug and has been since NWN was released. You can attempt a RecomuteStaticLighting command but from what I recall, this will result in the same problem - the glow remains.

// All clients in oArea will recompute the static lighting.
// This can be used to update the lighting after changing any tile lights or if
// placeables with lights have been added/deleted.
void RecomputeStaticLighting(object oArea)


Another solution is to destroy the placeable and spawn in one that is deactivated, so there is no glow or illumination at all. Then when night comes along, spawn in a placeable that is activated and has the illumination already on the placeable.

FP!
               
               

               


                     Modifié par Fester Pot, 30 septembre 2010 - 04:11 .
                     
                  


            

Legacy_Arawan

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Trouble with NPC Turning on/off Placable light
« Reply #2 on: October 03, 2010, 04:25:24 pm »


               Thx FP, I got so annoyed with it all, I just dropped the switching and left them all permanently on..