Server Totals
Le'Or - (1)
Elysia - (0)
Deglos - (0)
Ferrell - (0)
M'Chek - (0)
Mikona - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 1
Gallery

Links Menu

CEP Light Fixtures

Moderators: Nighthawk4, Dungeon Masters

CEP Light Fixtures

PostAuthor: Marleh » Fri Apr 27, 2007 12:51 pm

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
Image Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
User avatar
Marleh
QA Resource
 
Posts: 8649
Joined: Mon Jun 07, 2004 5:34 pm
Location: GMT -7

PostAuthor: 2Legit » Sat Apr 28, 2007 12:41 am

I've used zep_onoff for CEP fixtures in past projects. I seem to recall it worked very well.


EDIT: I put the script in the OnUsed slot, just for reference.

2Legit
Newbie
 
Posts: 1
Joined: Wed Apr 18, 2007 4:36 am

PostAuthor: Marleh » Sat Apr 28, 2007 1:48 am

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 :)
Image Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
User avatar
Marleh
QA Resource
 
Posts: 8649
Joined: Mon Jun 07, 2004 5:34 pm
Location: GMT -7

PostAuthor: PlasmaJohn » Sat Apr 28, 2007 3:50 am

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.

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.
User avatar
PlasmaJohn
Team Member; Retired with Honors; Has a Tom Selleck Stache
 
Posts: 8840
Joined: Fri Dec 26, 2003 10:37 pm
Location: adrift
Timezone: US/Eastern

PostAuthor: Marleh » Sat Apr 28, 2007 4:27 am

Thanks PJ!

:?

But for all that, *sighs* I think I'll just use the bioware lamppost.
Image Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
User avatar
Marleh
QA Resource
 
Posts: 8649
Joined: Mon Jun 07, 2004 5:34 pm
Location: GMT -7

PostAuthor: Gorgon » Sat Apr 28, 2007 11:42 am

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.
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (b. 1942) --


Sprucing up ye olde NWN | Modifying nwn.ini and nwnplayer.ini | ~Rare Items Wanted~ | Stealth Modifiers
User avatar
Gorgon
QA's 2nd|CCC Mobster
QA's 2nd|CCC Mobster
 
Posts: 5989
Images: 38
Joined: Fri Oct 17, 2003 10:14 pm
Location: Vancouver, BC, Canada
Timezone: PST -8

PostAuthor: PlasmaJohn » Sat Apr 28, 2007 12:33 pm

The problem with an OnUsed script is that somebody needs to actively use it. Marleh is looking for an always on light source, not one that's switchable.
Calvin: This is so cool!
Hobbes: This is so stupid.
User avatar
PlasmaJohn
Team Member; Retired with Honors; Has a Tom Selleck Stache
 
Posts: 8840
Joined: Fri Dec 26, 2003 10:37 pm
Location: adrift
Timezone: US/Eastern

PostAuthor: Horred the Plague » Sat Apr 28, 2007 2:08 pm

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:

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);
}


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 :lol:

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;
        }
User avatar
Horred the Plague
Scholar of Fools
 
Posts: 484
Joined: Thu Sep 08, 2005 5:21 am

PostAuthor: CPU » Sat Apr 28, 2007 9:31 pm

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.
User avatar
CPU
Team Member; Retired with Honors
 
Posts: 5163
Joined: Sat Apr 05, 2003 4:27 pm
Location: NY. USA (-4GMT)

PostAuthor: Marleh » Sat Apr 28, 2007 10:46 pm

With a lot of manuevering of placeables, that does the trick. Thanks CPU! :)
Image Dame Moira Celyn (Windspar) Callindraes - Just a little bit...
User avatar
Marleh
QA Resource
 
Posts: 8649
Joined: Mon Jun 07, 2004 5:34 pm
Location: GMT -7


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]