Server Totals
Elysia - (1)
Deglos - (0)
Le'Or - (0)
Ferrell - (0)
M'Chek - (0)
Mikona - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 1
Gallery
  • Search for the Spiritkin Thistle
    Album name: DM Events
    Uploaded by: Ronan
    Uploaded: Wed Aug 20, 2014 12:07 am

Links Menu

Trying to turn illumination off...

Moderators: Nighthawk4, Dungeon Masters

Trying to turn illumination off...

PostAuthor: A Wanderer » Mon Aug 14, 2006 6:57 am

I'm having an issue with the illumination of my placables not being in line with thier emitters, so I want to turn off all illumninations onentry into the area.

Do I reference each placable by tag name?

This code works on the actual placable:

Code: Select all

void main()
{
void SetPlaceableIllumination(object oFire=OBJECT_SELF,int bIllum=FALSE);
RecomputeStaticLighting(GetArea(OBJECT_SELF));
}



but I can't seem to reference the placable from the area events to shut off each placable's illumination, like so:

Code: Select all

void main()
{
void SetPlaceableIllumination(object oFire=wild_wander_campfire,int bIllum=FALSE);
RecomputeStaticLighting(OBJECT_SELF);
}



Where wild_wander_campfire is the tag of the campfire for which I want illumination shut off.

Also, I've got a few screenshots of what I'm talking about, located in this Bioware thread:

http://nwn.bioware.com/forums/viewtopic ... 6&forum=46

Also, this is for part of my player house here on Avlis, so I hope this script is ok for use. If not, a work around would be much appreciated.
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: p0m » Mon Aug 14, 2006 7:06 am

If this is for your player house, unfortunately you can't have any kind of custom scripts. If you're having issues with CEP lighting placeables, I'd make sure you check they have no onheartbeat scripts.

If it's a lighting issue, sometimes 'erasing' the terrain tile a few times will get it lined up right.

Also, a handy tip. Changing the lighting settings in the area properties will make it recalculate all lighting in the mod, so try to get the base lighting mood set before modifying the individual tiles' lighting.
Player of: Dannar Sunrise/Blighte
Gennor Visson
Jert Vilodel
User avatar
p0m
Scholar
 
Posts: 1366
Joined: Tue May 10, 2005 12:02 am
Location: Brisbane, Australia
Timezone: +10
DM Avatar: Wintermute

PostAuthor: Krator » Mon Aug 14, 2006 9:25 am

Try changing the "Initial State" on the placeable to "Deactivated."

This custom script will not be allowed in your player house.
Playing as: Sir Douglas Hope of Gorethar, old school paladin | Krator Blackfist, gold mage | Warren, half nymph barbarian
User avatar
Krator
Elder Sage
 
Posts: 4947
Joined: Thu Jun 10, 2004 6:44 pm
Location: Amsterdam
Timezone: GMT

PostAuthor: A Wanderer » Mon Aug 14, 2006 2:38 pm

Krator wrote:Try changing the "Initial State" on the placeable to "Deactivated."

This custom script will not be allowed in your player house.


I've tried this, and it only turns the flame off. The illumination is still active, which I'm fairly certain can only be turned off by script.

I'll try the terrain erase 'reset', and see if that works. I've already tried changing the area lighting settings multiple times.

If none of that works, I guess I'll have to live with a bit of imperfection. lol
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: A Wanderer » Mon Aug 14, 2006 2:40 pm

So lastly, how do I reference a placable or other object like an NPC? Is it just by tag name, or is there some prefixing?
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: Marleh » Mon Aug 14, 2006 5:16 pm

Even if you can't deal with the lightsource directly, you can always try to rotate the placeable to make it less noticeable. Also, there are several sizes of fire placeables that are available. Perhaps see if one can be positioned in such a way that it blends the lights together?

CEP has a few different placeables that don't use the same lightsource, you could try those as well.
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: A Wanderer » Mon Aug 14, 2006 6:36 pm

Thanks, Marleh.

Someone on the Bioware boards also suggested making a makeshift campsite out of other placables.

Turning it is a good idea.

I wonder if the in-game creatable campfire has the same illumination issue? I never stopped long enough to check.
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: Marleh » Mon Aug 14, 2006 6:39 pm

It does. :) I've noticed it, but never really taken the time to examine the placeable to see why.
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: CPU » Mon Aug 14, 2006 9:21 pm

Sindol's your Daddy!

There is already scripting available in NWN / Avlis to accomplish what you would like to do. It stops a light sources from emiting that most foul light when turned off. It does NOT work for most CEP lighting sources. Make sure to follow the directions exactly. I accept this script in player housing since it is already in Avlis:

ply_light_onoff Script
// John Janssen (Sindol)
// Name: ply_light_onoff.nss
// last modified: 23-03-2004, by Sindol

// Description: This script will turn a lightsource on or off when used.
// Instructions (with the tab on which to find the change):
// 1. Make sure the lightsource placable is "Usable" (Basic)
// 2. Turn the placable appearance to placable with "No Ambient" (Basic)
// 3. Put this script in the OnUsed handler for the lightsource placable (Scripts).
// 4. Set the default state of the placable to "Deactivated" (Advanced)

// Note: if your chosen lightsource placable does not have a "No Ambient"
// mode this will not work. Those lightsources do still emit light, even when
// their status is "deactivated". Use the default NWN script in that case.

void main()
{
if (GetLocalInt(OBJECT_SELF,"LightsOn") == 0) //light is off
{
effect eLight = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_10));
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLight, OBJECT_SELF);
SetLocalInt(OBJECT_SELF,"LightsOn",1);
}
else //light is on
{
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
effect eLight = GetFirstEffect(OBJECT_SELF);
while (GetIsEffectValid(eLight))
{
if (GetEffectSubType(eLight) == SUBTYPE_EXTRAORDINARY)
{
RemoveEffect(OBJECT_SELF, eLight);
}
eLight = GetNextEffect(OBJECT_SELF);
}
SetLocalInt(OBJECT_SELF,"LightsOn",0);
}
}
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 » Mon Aug 14, 2006 9:29 pm

Sweet! So a character can light a fire in a campfire ring? Is the campfire placeable considered a lightsource for this script?

// Note: if your chosen lightsource placable does not have a "No Ambient"
// mode this will not work. Those lightsources do still emit light, even when
// their status is "deactivated". Use the default NWN script in that case.


Can't wait to get home and check this.

*sighs* if I'd only known, ah well.
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: A Wanderer » Mon Aug 14, 2006 10:00 pm

=D Awesome!

Also, I'm pretty sure this will not work as a light source with ambient turned off. The flame emits no light, iirc when I was turning ambient off last night.

I'll jump back in it tonight, and see how it works. Thanks CPU and Sindol!

This little cave/house has a sweet feel to it (torch lit only), and it's pretty small (3x2), so this little light fix is really a noticable issue. Hope this is the fix!

I'll probably also end up turning the campfire so the ambient light is behind the flame... Or maybe I'll turn the campfire to off, and use a flame visual effect. The alignment on it is better.

Damn you work! I should be home building! lol
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: Marleh » Mon Aug 14, 2006 10:38 pm

Pfft, 3x2 is huge for a washed out cave under a tree. Its almost as big as Moira's house in Mikona, if she hadn't added her rooftop garden.

And no peeking from the Adventurer's Guild Hall, Fifty!! *shakes fist*
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: Moredo » Mon Aug 14, 2006 11:54 pm

LOL, so *that's* why Kered wanted a penthouse! :lol:

Kered Rose, lasts seen in Derome Delen buying Gnomish Binoculars.
Always consider alignment as a tool, not a straitjacket that restricts the character.
— AD&D, 2nd Edition Player's Handbook
User avatar
Moredo
CCC
CCC
 
Posts: 7391
Joined: Mon May 26, 2003 3:47 pm
Location: Norway (GMT +2)
Timezone: +2

PostAuthor: A Wanderer » Tue Aug 15, 2006 1:08 am

Marleh wrote:Pfft, 3x2 is huge for a washed out cave under a tree. Its almost as big as Moira's house in Mikona, if she hadn't added her rooftop garden.

And no peeking from the Adventurer's Guild Hall, Fifty!! *shakes fist*


To be fair, it's really a 2x2 since two of the tiles are water. =D
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: A Wanderer » Tue Aug 15, 2006 1:24 am

Just tested that script, and the illumination does not fade. The flames go out, but the illumination is still there. In order to turn both the flame AND illumination off, you would have to add:

Code: Select all

void SetPlaceableIllumination(object oFire=OBJECT_SELF,int bIllum=FALSE);
RecomputeStaticLighting(GetArea(OBJECT_SELF));



To turn it off, and the reverse (TRUE) to turn it back on.
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: jaythespacehound » Tue Aug 15, 2006 8:21 am

Note you can't do:
Code: Select all
object oFire=object_tag


You have to do it this way:
Code: Select all
object oFire = GetObjectByTag("object_tag")


Note that this can go badly if two or more things have the same tag,
In that case you may wish to use the second variable in that function:
Code: Select all
object oName = GetObjectByTag("object_tag", int nNth = 0);

where nNth is the Nth object with this tag. (Default: 0)

Directly from the lexicon:
The nNth parameter has been determined to return the nNth object with the specified sTag starting at position 0. Outside of the current area, the scan will begin starting with the last (most recent) area added to the module following this hierarchy:

OBJECT_TYPE_STORE (128)
OBJECT_TYPE_PLACEABLE (64)
OBJECT_TYPE_WAYPOINT (32)
OBJECT_TYPE_AREA_OF_EFFECT (16) (spell effects, like web)
OBJECT_TYPE_DOOR (8)
OBJECT_TYPE_TRIGGER (4)
OBJECT_TYPE_ITEM (2)
OBJECT_TYPE_CREATURE (1)

A safer way to do it may be:

Code: Select all
object oFire = GetNearestObjectByTag(
"object_tag", object oTarget = OBJECT_SELF,
    int nNth = 1
);



Which returns the nNth nearest object to object oTarget (OBJECT_SELF) in this case.

Er hope that makes sense and was of some help,
Jay

EDIT: Er remember if this is for custom housing you can't make your own scripts unless you get permission etc :)
User avatar
jaythespacehound
Apprentice Scholar
 
Posts: 941
Joined: Wed Sep 22, 2004 6:52 am
Location: Hobart Australia (feels like a small island sometimes...hang on it is) GMT+10

PostAuthor: Calzier » Tue Aug 15, 2006 8:49 am

Easiest solution is to use a pile of wood placeable and a flame placeable. Attach the on_off script (above) to the flame, and name the flame object 'fire' or something similar. Place the flame under the wood (adjust Z axis as required).

What then happens IG is that the pile of wood (or whatever) appears to be a fire that you can light and extinguish. This works great if you have a fireplace...

For a cave I'd suggest creating a fire-pit, using an appropriate placeable and a -ve Z axis, and place the wood/flame inside. You can always use a slight -ve z axis on the wood if it sticks up too much...
User avatar
Calzier
CCC
CCC
 
Posts: 1939
Joined: Mon May 02, 2005 10:39 am
Location: UK
Timezone: GMT/BST

PostAuthor: A Wanderer » Tue Aug 15, 2006 2:13 pm

Awesome jay. =) I had figured it would be a GetObject, but didn't know what the function was. (I'm getting back to building a mod I started a while back, and I'm sure this is going to come in really handy)

For my 'house' I went with a campfire, no illumination, set it to usable and deactivated, then added a flame visual effect. I couldn't really get it to turn on and off, because both the campfire and the flame had to be set to usable (because I can't alter one object by clicking on another - via Jay's post above). It's fine though. The main thing was getting the illum and flame anim to line up properly. The flame visual lines up really nice.

The last thing I have to do with my place now is load all the door scripts (auto close, auto lock) and my one plot chest's auto lock script. I'm assuming those are ok to use, and if so where can they be found?
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: PsiOmega » Tue Aug 15, 2006 3:06 pm

Everything you can use is found here.
User avatar
PsiOmega
CCC
CCC
 
Posts: 4901
Joined: Tue Jun 08, 2004 4:55 pm
Location: Sweden
Timezone: GMT+1/+2 (DST)

PostAuthor: A Wanderer » Tue Aug 15, 2006 3:15 pm

PsiOmega wrote:Everything you can use is found here.


Ahh I have that. I need to look closer. :oops:
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: CPU » Tue Aug 15, 2006 8:09 pm

The flames and light source should turn off IF you use the deactivated (no ambient) appearance / version of the placeable:

Turn the placable appearance to placable with "No Ambient" (Basic).


If you do not change the appearance, then the light source will stay. As I said, a number of the CEP placeables do not have a "No Ambient" version. those placeables cannot be used with this script. However, I have used this script repeated times (with non-CEP light sources) and it does work.

The chances of getting different versions or script variations into Avlis (especially for Player Housing) are near zero since there is a working version already.
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: A Wanderer » Wed Aug 16, 2006 3:55 am

Turning the no ambient version flame animation on and off worked, if you want to always keep ambient off. My cave is torch lit only, so I need the ambience.

The problem really lies in the unaligned flame and ambience on the campfire (and the campfire with cauldron). I don't think there's a way to fix it other than turn off ambience for the campfire (and turn off the flame), and add a flame visual effect object instead. The flame visual effect object has better flame/ambience alignment.

To make the turning on and off fully functional (turn off both flame animation and ambience at the same time) with the flame object, I would have to turn off and on the flame visual effect object by clicking the deactivated campfire (not allowed, which is fine - plus I would have to add the ambience switch in the code). The second problem is both objects must not be static (the campfire can't be static anyway, because you can't change a static object from active to deactive), and since both are not static, you have basically two objects superimposed on one another, which makes clicking very weird.

No matter though, because I'm happy just getting the ambient light more in line with the flame animation. Before I superimposed the flame object it was way off, as is seen in the picture. Now it's almost aligned perfectly.
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: A Wanderer » Wed Aug 16, 2006 4:24 am

Ahh I found out why I couldn't find any autoclose, etc scripts. You have to import the erf into the toolset. 'File' -> 'Import' This piece I found on the net. lol I'll put that in the FAQ.
nethervoid - Since '97 [UO|EQ|SB|SWG|PS|HZ|NWN|VG|WoW]
Playing:
Grrom Blackmane - Battlecleric of Gorethar
Wanderer - Ranger of Dru'El

Unofficial Player Housing FAQ
User avatar
A Wanderer
Apprentice Scholar
 
Posts: 510
Joined: Sun Jul 03, 2005 8:13 pm
Location: Sacramento, Ca

PostAuthor: jaythespacehound » Fri Aug 18, 2006 11:39 am

Glad to hear you'll find some use for them :)
Jay
User avatar
jaythespacehound
Apprentice Scholar
 
Posts: 941
Joined: Wed Sep 22, 2004 6:52 am
Location: Hobart Australia (feels like a small island sometimes...hang on it is) GMT+10


Return to NWN Scripting

Who is online

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