CEP Light Fixtures
Moderator: Event DM
CEP Light Fixtures
Several of the CEP light fixtures have a heartbeat script called zep_torch that tells it to turn on the light emitter for the placeable. When I remove these scripts, although the placeables animation is activated, it no longer emits light.
Supposedly there is a Bioware script that will simply add a light emitter to a placeable and is not a heartbeat script, but for the life of me I can't find the name of it. Does anyone have any ideas what this might be? Or how I can do this?
Thanks
Supposedly there is a Bioware script that will simply add a light emitter to a placeable and is not a heartbeat script, but for the life of me I can't find the name of it. Does anyone have any ideas what this might be? Or how I can do this?
Thanks
Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
That would work if I wanted the lamps to turn on when a character used them, but I just want them lit - and not just lit, but giving off light, without the heartbeat.
Thanks for the idea though
Thanks for the idea though

Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
- PlasmaJohn
- CCC / Release Admin
- Posts: 9010
- Joined: Fri Dec 26, 2003 10:37 pm
- Timezone: US/Eastern
- Location: Negaria
- Contact:
I just read thru CEP's script... and I feel soiled. What most Bioware placeables (now) do is provide a version that has an ambient light source as part of its model, no scripting needed. Unfortunately the placeable you want to use does not have the emitter so you need some method of adding a VFX effect to each placeable.
Maybe this will work. Add a creature to the area and set its appearance to Null Human and its portrait to something blank. Write an onspawn script that iterates through all objects in the area with the lamp's tag and apply a lighting effect to them. The final thing the script should do is destroy the creature.
The following script should be assigned to the creature's OnSpawn event. On the Advanced tab, click Variables and add a string LAMP_TAG with a value equal to the tag of the placeable(s) you want affected, in your case ZEP_LAMPPOST001.
Maybe this will work. Add a creature to the area and set its appearance to Null Human and its portrait to something blank. Write an onspawn script that iterates through all objects in the area with the lamp's tag and apply a lighting effect to them. The final thing the script should do is destroy the creature.
The following script should be assigned to the creature's OnSpawn event. On the Advanced tab, click Variables and add a string LAMP_TAG with a value equal to the tag of the placeable(s) you want affected, in your case ZEP_LAMPPOST001.
Code: Select all
//: lightemup.nss
#include "zep_main_inc"
void main()
{
string sTag = GetLocalString(OBJECT_SELF,"LAMP_TAG");
if(sTag!="")
{
int index=0;
object oLamp = GetNearestObjectByTag(sTag);
while(GetIsObjectValid(oLamp))
{
string sLightConst = GetLocalString(oLamp,"CEP_L_LIGHTCONST");
if(sLightConst == "")
sLightConst="WHITE_5";
int iLightVFX = ColorInit(sLightConst);
effect eLight = EffectVisualEffect(iLightVFX);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eLight,oLamp);
++index;
oLamp = GetNearestObjectByTag(sTag,OBJECT_SELF,index);
}
}
// our work here is done
DestroyObject(OBJECT_SELF);
}
Calvin: This is so cool!
Hobbes: This is so stupid.
Hobbes: This is so stupid.
Thanks PJ!
But for all that, *sighs* I think I'll just use the bioware lamppost.

But for all that, *sighs* I think I'll just use the bioware lamppost.
Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
- Gorgon
- Father of Avlis EE
- Posts: 6637
- Joined: Fri Oct 17, 2003 10:14 pm
- Timezone: PST -8
- Location: Vancouver, BC, Canada
I know there are a few that don't emit light, but from the sounds of it, you just want to replace the heartbeat script on the ones that do work.
Ditch the heartbeat and try nw_02_onoff in the OnUsed. You might have to set the light to deactivated as the initial state since some of the CEP ones started dark but with the animation on, and had to be switched off and on again to work right. Worked for the CEP lights I tested, but I'm sure I missed a few like the ones PJ mentioned. I wouldn't have a clue how to script a fix like he did, but this worked fine and avoided any of the nasty CEP/zep_ scripts.
Ditch the heartbeat and try nw_02_onoff in the OnUsed. You might have to set the light to deactivated as the initial state since some of the CEP ones started dark but with the animation on, and had to be switched off and on again to work right. Worked for the CEP lights I tested, but I'm sure I missed a few like the ones PJ mentioned. I wouldn't have a clue how to script a fix like he did, but this worked fine and avoided any of the nasty CEP/zep_ scripts.
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
- PlasmaJohn
- CCC / Release Admin
- Posts: 9010
- Joined: Fri Dec 26, 2003 10:37 pm
- Timezone: US/Eastern
- Location: Negaria
- Contact:
- Horred the Plague
- Apprentice Scholar
- Posts: 500
- Joined: Thu Sep 08, 2005 5:21 am
Here is a script I wrote recently, to be plugged into the Area OnEnter slot. It only needs to fire once per a module reset:
All you really have to do, for anything special you want, is to create a unique tag, assign your specific amount of light, and add a block of script like those above in the "add light source here" section. Add it at the top, so the default blocks don't trigger first.
Note that it would be very easy with a system like this, to set up a DM Wand function (and, I plan to)...so that a DM could turn all the lights on and off in an area, with the wave of a wand (twist of a ring). The best effect with this is achieved in areas where the lighting is set to Interior, Torch-Lit Only.
There are also tile lights (static things like those torches pre-glued to walls) that can also be affected by scripting....but you have to use their [x.y] tile coordinates. Thus, this takes specific (per area) scripting.
P.S. Sorry for 20 edits in 10 minutes, if you were reading this, but I'm still waking up
EDIT: (Make that 21!) If you're working with an existing mod, that has a base OnAreaEnter script, add a block like this at the end of the script, and after the once/reset cutoff:
Code: Select all
void main()
{
object oLight = GetFirstObjectInArea(OBJECT_SELF);
effect eLight;
// This only has to be done the first time entering
// an area, so save the performance hit
if (GetLocalInt(OBJECT_SELF,"LIGHTS_ON"))
return;
while (GetIsObjectValid(oLight))
{
// Only target non-useable (static) placeables
if (GetObjectType(oLight) == OBJECT_TYPE_PLACEABLE
&& !GetUseableFlag(oLight))
{
if (GetLocalInt(oLight,"NW_L_AMION") == 0)
{
// Add other types of light sources here
if (GetTag(oLight)== "Candelabra")
{
eLight = EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_20);
SetLocalInt(oLight,"NW_L_AMION",1);
}
else if (FindSubString(GetTag(oLight),"CHANDELIER") != -1)
{
eLight = EffectVisualEffect(VFX_DUR_LIGHT_WHITE_20);
SetLocalInt(oLight,"NW_L_AMION",1);
}
else if (FindSubString(GetTag(oLight),"TORCH") != -1)
{
eLight = EffectVisualEffect(VFX_DUR_LIGHT_ORANGE_15);
SetLocalInt(oLight,"NW_L_AMION",1);
}
else if (FindSubString(GetTag(oLight),"CANDLE") != -1)
{
eLight = EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_10);
SetLocalInt(oLight,"NW_L_AMION",1);
}
if(GetLocalInt(oLight,"NW_L_AMION") == 1)
{
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
//Use ActionDoCommand, so the light comes 'after' the placeable is 'on'
ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLight, OBJECT_SELF));
}
}
}
oLight = GetNextObjectInArea(OBJECT_SELF);
}
// Set this so that the script isn't parsed again this reset
SetLocalInt(OBJECT_SELF,"LIGHTS_ON",TRUE);
}
Note that it would be very easy with a system like this, to set up a DM Wand function (and, I plan to)...so that a DM could turn all the lights on and off in an area, with the wave of a wand (twist of a ring). The best effect with this is achieved in areas where the lighting is set to Interior, Torch-Lit Only.

There are also tile lights (static things like those torches pre-glued to walls) that can also be affected by scripting....but you have to use their [x.y] tile coordinates. Thus, this takes specific (per area) scripting.
P.S. Sorry for 20 edits in 10 minutes, if you were reading this, but I'm still waking up

EDIT: (Make that 21!) If you're working with an existing mod, that has a base OnAreaEnter script, add a block like this at the end of the script, and after the once/reset cutoff:
Code: Select all
ExecuteScript("[INSERT_SCRIPT_NAME]", OBJECT_SELF);
Code: Select all
// This only has to be done the first time entering
// an area, so save the performance hit
if (GetLocalInt(OBJECT_SELF,"LIGHTS_ON"))
{
ExecuteScript("[INSERT_SCRIPT_NAME]", OBJECT_SELF);
return;
}
- CPU
- Team Member; Retired with Honors
- Posts: 5161
- Joined: Sat Apr 05, 2003 4:27 pm
- Location: NY. USA (-4GMT)
The simple solution might to remove the hearbeat script and then just mess with the lighting aspects of the area. Using the area lighting attrbutes, you could duplicate the atmosphere you hope to create?
Avlis Housing Director
PM: Avlis Player Housing
Player Housing Information - This answers most questions people have. Please read this before asking.
PM: Avlis Player Housing
Player Housing Information - This answers most questions people have. Please read this before asking.
With a lot of manuevering of placeables, that does the trick. Thanks CPU! 

Dame Moira Celyn (Windspar) Callindraes - Just a little bit...