Window Dressing
Window Dressing
Literally.
Made myself a nifty little useable "curtain pull" placeable today. It dangles on a cord next to the curtains. When the PC uses the curtain pull, the closed curtains destroy to reveal open curtains behind. When pulled again, the curtains 'close' again. I'd like to create a light source at the same time the curtains 'open' to simulate daylight if(GetIsDay)=TRUE) but I can't seem to make the Castle Window placed effect create. Will CreateObject not create placed effects? And if not, anybody have any ideas to shed a little light from my window when the curtains are open?
Thanks!
Made myself a nifty little useable "curtain pull" placeable today. It dangles on a cord next to the curtains. When the PC uses the curtain pull, the closed curtains destroy to reveal open curtains behind. When pulled again, the curtains 'close' again. I'd like to create a light source at the same time the curtains 'open' to simulate daylight if(GetIsDay)=TRUE) but I can't seem to make the Castle Window placed effect create. Will CreateObject not create placed effects? And if not, anybody have any ideas to shed a little light from my window when the curtains are open?
Thanks!
Enjoy the game
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Wynna, here's the code used for an erf I imported that controls lamps turning on and off. Just grab the relevant code if you like. The script is in the mod called "onuse_lamp":
Code: Select all
//
// Turn Lights On Off
// puk_lights
// By:Puket
// 01/13/07
// give me credit
//
//
// 2/28/07 modified by Lochlainn
// Turns on and off the streetlamp in the erf
// It does this by removing and replacing the "on" and "off" mdb's
//
// Place this on the OnUsed Event of a Torch/Candle/Streetlamp etc. for Light and FX
//
////////////////////////////////////////////////////////////////////////////
int iLightEffect;
object oNearest;
object oCaller=GetLastUsedBy();
object oSelf = OBJECT_SELF;
int iNumberOfFlames;
location lMyLoc;
void main()
{
iLightEffect=VFX_DUR_LIGHT_ORANGE_20;
//if not currently on
if (GetLocalInt(OBJECT_SELF,"NW_L_AMION") == 0)
{
SendMessageToPC(oCaller,"You light the flame.");
//remove the "off" placeable and put in the "on" one
lMyLoc=GetLocation(oSelf);
object oNewLamp=CreateObject(OBJECT_TYPE_PLACEABLE,"useable_lamp_post_on",lMyLoc);
DestroyObject(oSelf);
oSelf=oNewLamp;
//turn on light from the placeable and play animation if any
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
DelayCommand(0.4,SetPlaceableIllumination(oSelf, TRUE));
SetLocalInt(oSelf ,"NW_L_AMION",1);
DelayCommand(0.5,RecomputeStaticLighting(GetArea(oSelf)));
//apply lighting
effect eLight=EffectVisualEffect(iLightEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLight, oSelf);
}
else
{
SendMessageToPC(oCaller,"You extinguish the flame.");
//turn off lights
//remove the "on" placeable and put in the "off" one
lMyLoc=GetLocation(oSelf);
object oNewLamp=CreateObject(OBJECT_TYPE_PLACEABLE,"useable_lamp_post_off",lMyLoc);
DestroyObject(oSelf);
oSelf=oNewLamp;
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
//deactivate light
DelayCommand(0.2,SetPlaceableIllumination(oSelf, FALSE));
//set local variable to off
SetLocalInt(oSelf ,"NW_L_AMION",0);
DelayCommand(0.3,RecomputeStaticLighting(GetArea(oSelf)));
effect eEffect = GetFirstEffect(oSelf);
while (GetIsEffectValid(eEffect) == TRUE)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_VISUALEFFECT) RemoveEffect(oSelf, eEffect);
eEffect = GetNextEffect(oSelf);
}
}
}

It might be that RecomputeStaticLighting command or the SetPlaceableIllumination one will help. I don't have either incorporated and will tinker around with them. Just assigning a light effect to the open curtains won't work, as it's always 'there', just hidden behind the closed ones and I don't want it shining through the closed curtains.
I'll keep testing myself before posting code. I'm sure I can figure it out, just checking to see if anybody had done anything like this.
Thanks!
I'll keep testing myself before posting code. I'm sure I can figure it out, just checking to see if anybody had done anything like this.
Thanks!
Enjoy the game
Im the first to admit I know ziltch about scripting BUT this is how I would set up the lighting. The light closest to the window is range 1 and the one away from the window is range 2. Both are intensity 1 and I left the default color which is white.
When you open the curtains those two lights could appear AND perhaps any other lights in the room could be scripted to become slightly more intense?



When you open the curtains those two lights could appear AND perhaps any other lights in the room could be scripted to become slightly more intense?



That's a beautiful effect, Aelred. I'll try creating at those locations, although I was using a simpler (GetLocation(oCurtainOpen)) instead of having to (I assume) place two waypoints, one for each of your light effects. Two questions:
1) Did you create those lights with a script or place them?
2) Which window placeable is that one?
1) Did you create those lights with a script or place them?
2) Which window placeable is that one?
Enjoy the game
I dont know how to script so I placed them. If you can destroy create the curtains will the same script work for the extra lights?
There are no window placeables in the toolset. Interiors would be less claustrophobic if there were.
What you see there is the standard interior tileset, the tile is the one with three walls (like for the end of a hallway). Remember some tiles have more than one variation - you use the up and down arrows to scroll thru the versions before you place the tile. Resize your tile window a bit and you will see the ones with variations. This is the only tile I know with a window so I use it at every chance I can.

If your interior is stone the building blocks placeables do have walls with open windows. The building block set comes with a window piece that is meant to place inside but it is really dark/opaque. Try placing a gate piece inside or even a portcullis door.

There are no window placeables in the toolset. Interiors would be less claustrophobic if there were.
What you see there is the standard interior tileset, the tile is the one with three walls (like for the end of a hallway). Remember some tiles have more than one variation - you use the up and down arrows to scroll thru the versions before you place the tile. Resize your tile window a bit and you will see the ones with variations. This is the only tile I know with a window so I use it at every chance I can.

If your interior is stone the building blocks placeables do have walls with open windows. The building block set comes with a window piece that is meant to place inside but it is really dark/opaque. Try placing a gate piece inside or even a portcullis door.

- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Well, I ended up trying a whole bunch of things without being able to figure out how to create a light source through scripts. I could destroy a placeable light source but CreateObject wouldn't work. In the end, I threw a patch on it and just applied a light effect to the window while open. I'll wait for 1.07 to give me on/off for light sources. Here's two shots of the curtains closed and open. The curtain pull that runs the script is that little dangling thing on the cord. The window in the center of the opened curtains looks better in game. Not so dark and obviously a diamond paned window. But what I wouldn't give for a decent placeable window. Who did the round stained glass placeables?




Enjoy the game
I've actually been tinkering a bit more with this. OnUse, the curtains now send a message to oUser telling her the time of day and the direction she's looking, and the light coming through the window changes if they're open through the dawn/day/dusk cycle. After ten minutes of no PC inside the room the curtain resets to end this cycling script. I've been contemplating adding a message about the weather outside, but don't know enough about how weather works to do so.
1. Is weather global now?
2. Will our seasons advance persistently?
3. Can I call a "weathervane" object's area if that area has no PCs in it? (For instance, if I use the Moonbridge as a 'weathervane' to mark the Silvy Exterior, can I call GetWeather(GetArea(oMoonbridge))?
After playing around a bit, I suspect the answers are yes, in a perfect world and no, but I'm not positive.
1. Is weather global now?
2. Will our seasons advance persistently?
3. Can I call a "weathervane" object's area if that area has no PCs in it? (For instance, if I use the Moonbridge as a 'weathervane' to mark the Silvy Exterior, can I call GetWeather(GetArea(oMoonbridge))?
After playing around a bit, I suspect the answers are yes, in a perfect world and no, but I'm not positive.
Enjoy the game
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
We've not worked on a weather system for NWN2 so I can't say for certain, but:
1. Do you mean across servers? Ideally, yes. Within a server, it can be defined for an area or the module.
2. Ideally, yes.
3. Yes. Objects in areas don't disappear when PCs leave, unless you destroy them.
I hope that's helpful.
1. Do you mean across servers? Ideally, yes. Within a server, it can be defined for an area or the module.
2. Ideally, yes.
3. Yes. Objects in areas don't disappear when PCs leave, unless you destroy them.
I hope that's helpful.

OK, so I've been able to call the area of an object without an active PC in it. The integer I keep getting in response, though, is 0, which if I read my toolset right means that weather is turned off. Taking into account that you've not built an ALFA weather system, Cipher, can somebody help me decipher (no pun intended) how weather does work in NWN2?
1. Have I interpreted the 0 right?
2. Does weather run in an otherwise inactive area? (If a tree gets struck by lightning and nobody's there...?)
3. Does that mean it's off for the whole module or just that PCless area?
4. With weather off will it always be clear and sunny across the area/module?
5. How would it be turned on?
It's not that these curtains are that important to me, but I'm using these little scripts I'm building as refresher/teaching courses and I'm interested now in how weather will work.
Thanks!
1. Have I interpreted the 0 right?
2. Does weather run in an otherwise inactive area? (If a tree gets struck by lightning and nobody's there...?)
3. Does that mean it's off for the whole module or just that PCless area?
4. With weather off will it always be clear and sunny across the area/module?
5. How would it be turned on?
It's not that these curtains are that important to me, but I'm using these little scripts I'm building as refresher/teaching courses and I'm interested now in how weather will work.
Thanks!
Enjoy the game
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
As far as I know, we've not done any work on scripting any kind of weather system so far. Ronan had some references to weather in his spawning system (for spawns that depend on weather conditions) - but we're likely going to have to adapt or rewrite the scripts we used in NWN1, with some testing as to how the weather controls behave in NWN2.
Whether this means it will be clear and sunny every day in the meantime- Perhaps yes? Has anyone spotted anything analagous to the % weather settings by area we had in NWN1? They may be in Area Properties somewhere that I hadn't noticed, I've never looked for them.
We're pretty shorthanded in the core scripting department (as it's just Cipher and I), so if you've got an interest in the weather system, I'd be glad to help you look into adapting something to benefit all the servers. So far it's an issue that hadn't shown up on the doppler radar yet, for me at least.
Whether this means it will be clear and sunny every day in the meantime- Perhaps yes? Has anyone spotted anything analagous to the % weather settings by area we had in NWN1? They may be in Area Properties somewhere that I hadn't noticed, I've never looked for them.
We're pretty shorthanded in the core scripting department (as it's just Cipher and I), so if you've got an interest in the weather system, I'd be glad to help you look into adapting something to benefit all the servers. So far it's an issue that hadn't shown up on the doppler radar yet, for me at least.