Page 1 of 1

Turning torches from off to on...

Posted: Thu Apr 17, 2003 8:41 pm
by Aralee
Here's a question I have.

I'm trying to get it so when I walk into my house, I have to walk around and "light" the torches.. so far it's not working, I've set it to disabled, activated, default.. and nothing. They all start with a glow about them already and when I "use" them, that's when the flame shows up.

Any suggestions would be appreciated.

Re: Turning torches from off to on...

Posted: Thu Apr 17, 2003 8:48 pm
by Nightface
Aralee wrote:Here's a question I have.

I'm trying to get it so when I walk into my house, I have to walk around and "light" the torches.. so far it's not working, I've set it to disabled, activated, default.. and nothing. They all start with a glow about them already and when I "use" them, that's when the flame shows up.

Any suggestions would be appreciated.
There's a script you have to place in the OnUsed event, nw_02_onoff. I've never tried it for a torch, but I know for a fact it works on candelabra and street lamps. Aslo be sure to set the Initial State to Deactivated, so they'll be off after a server restart.

Tanmar Stronghammer

Posted: Thu Apr 17, 2003 9:06 pm
by Actually
Hrrmm...

Off the top of my head, are the torches marked "Usable" and NOT marked "Static"?

Other than that, I know for a fact that there is a script in the OC that is used for turning braziers on and off. It's named something like "nw_02a_OnOff" or some such.

Hope that helps.

Bye Now,
Jerry Cornelius - Script Monkey

Posted: Thu Apr 17, 2003 9:12 pm
by Nightface
Actually wrote:Off the top of my head, are the torches marked "Usable" and NOT marked "Static"?
DOH! I forgot to mention that!

Tanmar

Posted: Fri Apr 18, 2003 3:35 pm
by Aralee
Thanks for your help guys, but no luck. Upon entering the house, the torches are in a semi-state of being on. If you "use" it once, the fire becomes visible, if "used" twice, the torches go completely out. I want them out to begin with. Urgh it's frustrating when you don't know enough about scripting like this.

Posted: Fri Apr 18, 2003 5:29 pm
by Nightface
Heck, I see your point. I just tried the Initial State Deactivated on a candelabra. It was off, but still emitting light. I don't think this is a scripting issue. I'll look into it, and get back to you, unless somebody else answers first.

Tanmar Stronghammer

Posted: Thu May 08, 2003 3:05 am
by astoroth
I use Candelabras.

Mark them usuable, and set the area to DARK under the visual tab.

You can then walk in and turn the candleabras on and off, and they DO EMIT Light, its very cool, and I use it all the time.

Doesn't work on the tileset torches though.

Posted: Thu May 08, 2003 4:54 am
by Themicles
Torch brackets are broken and you wont
see the fire. Only in the toolset will the fire
be visible.

Be warned, recalculating static lighting (as
I believe the default Bio script does) is not
noticable in small areas... but in large areas,
you're looking at a decent second or two
freeze.

-Themicles

Posted: Thu May 08, 2003 5:02 am
by jadeia
Nightface wrote:Heck, I see your point. I just tried the Initial State Deactivated on a candelabra. It was off, but still emitting light. I don't think this is a scripting issue. I'll look into it, and get back to you, unless somebody else answers first.

Tanmar Stronghammer
Leave it on by default in the toolset. Then turn it off when playing, the area WILL go dark (if the area IS dark naturally) and when you use it again to turn it back on, the area will light up again.

This works is an area as small as a 2x2 room.

Posted: Thu May 22, 2003 9:11 am
by JollyOrc
quick question from a newbie builder:

I managed to set a candelabra in "off" state into the module, and it's usable too, but:

what's the command to activate / deactivate an object (ie the candelabra) ?

Posted: Sun May 25, 2003 10:38 am
by JollyOrc
ok, with this as onUsed:

Code: Select all

void main()
{
    if (GetLocalInt(OBJECT_SELF,"NW_L_AMION") == 0)
    {
        PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
        DelayCommand(0.4,SetPlaceableIllumination(OBJECT_SELF, TRUE));
        SetLocalInt(OBJECT_SELF,"NW_L_AMION",1);
        DelayCommand(0.5,RecomputeStaticLighting(GetArea(OBJECT_SELF)));
    }
    else
    {
        PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
        DelayCommand(0.4,SetPlaceableIllumination(OBJECT_SELF, FALSE));
        SetLocalInt(OBJECT_SELF,"NW_L_AMION",0);
        DelayCommand(0.9,RecomputeStaticLighting(GetArea(OBJECT_SELF)));
    }
}
I can walk up to a candelabra, and turn it on /off. If it is on at module load, everythings fine.

Now: I want to turn a number of candelabras *off* at once. I manage that somehow, but the flames do not disappear.

Is it possible to "call" the onUse script of an object from a script ?

as in

Code: Select all

command1;
Candelabra1.onUse();
command2;

Posted: Sun May 25, 2003 10:41 am
by JollyOrc
think I found the reason for the "flames stay" problem

Code: Select all

PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
affects the object_Self. I need it to affect another object. How to do that ?

Posted: Thu Jun 05, 2003 5:21 am
by JollyOrc
okay, I made it. Here's for your viewing pleasure, in case someone else wants to do the same thing:

Code: Select all

void main()
{
        object oCandelabra1 = GetObjectByTag("RS_IN_1");
        AssignCommand(oCandelabra1, PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
        DelayCommand(1.0,SetPlaceableIllumination(oCandelabra1, FALSE));
        SetLocalInt(oCandelabra1,"NW_L_AMION",0);
        DelayCommand(1.0,RecomputeStaticLighting(GetArea(oCandelabra1)));

}
This turns the Lights of the object RS_IN_1 effectively off, if they have been "activated" before. So change the initial state from default to activated. The delays seem to be important too. Also, always keep in mind that all tags are case sensitive, took me a while to remember.

Posted: Sat Feb 04, 2006 5:13 am
by szabot
Building an area...need some help. ;)

I want to use the torch-lit only visual scheme, but I also want to add some fires, fire basins and that sort of stuff around and I want those to give off light. I've added a script to the OnUsed event of these items: nw_02_onoff. However, I don't know what to do beyond that to actually make them light the area around them at all (and I want them lit when someone comes into the area). I think I read (here or somewhere else) about the RecomputeStaticLighting(object) script, and that I need the ~area~ itself to run that script? Is that right? If so, how do I add a script to an area?

Any help is much appreciated. I really know absolutely nothing about scripting.

Thanks.

Posted: Sat Feb 04, 2006 9:16 am
by Sindol
If you want them always lit when someone enters the area, I'd go for emitters. You only need to tie a script to the onenter event of the area that way, and not one to each placeable.

If you want to turn them all on or off, and all individually too, I'd go for some light scripts I wrote for Avlis a long time ago. They can be downloaded here: http://www.catara.org/files/Player_scripts.rar
The one you need is called something like ply_light_onoff iirc.

Posted: Sat Feb 04, 2006 9:22 am
by szabot
Sindol wrote:If you want them always lit when someone enters the area, I'd go for emitters. You only need to tie a script to the onenter event of the area that way, and not one to each placeable.
This is what I want. Are there "emitter" scripts that I can use for player housing?

edit: I can't find a script on the list that has the word "emitter" in it, and I don't know how else I'd find one. :P
edit: found one! It's "zep_torches_on" and it seemed to light some candles. Didn't light the fire basins though....
edit: since the script lights flames, I just placed some extra flames in the basins and that did the trick. :)

And this may be a silly question, but how do I place a script for the area itself? When I go to area properties, I don't see any option for scripts. :?

edit: aha! There is no script tab, but there is an "events" tab. ;)

Thanks. ;)

Posted: Sat Feb 04, 2006 9:54 am
by Marleh
dont use the ZEP_torch script, its buggy. You can turn an item on, but it then becomes a static placeable, and you cant turn it off again.

I used a different script for the bards academy, let me find it and Ill post the name.

Posted: Sat Feb 04, 2006 9:57 am
by szabot
Marleh wrote:dont use the ZEP_torch script, its buggy. You can turn an item on, but it then becomes a static placeable, and you cant turn it off again.

I used a different script for the bards academy, let me find it and Ill post the name.
I don't need to turn them off again, but if there's still something buggy about it, then I'll be happy to try other options. Thanks. :)

Posted: Sat Feb 04, 2006 11:49 am
by Marleh
by buggy, I meant that it only works once per reset. If you dont need to turn it on and off, just on, then the ZEP is good to go.

Posted: Sat Feb 04, 2006 6:49 pm
by szabot
Marleh wrote:by buggy, I meant that it only works once per reset. If you dont need to turn it on and off, just on, then the ZEP is good to go.
Ok.

I do notice, though, that I get a message in my combat window five times when entering the area: something like "ZEP_candle001." Anyway to avoid having those lines show up?

Posted: Sat Feb 04, 2006 7:15 pm
by Moredo
There is a default bioware script for turning torches on and off, one that isn't buggy. I would have listed it's name, but it seems my toolset is bugged, so I can't open it. :(

IIRC, it's x2_somethingsomething, hah, hope that helps! 8)

Posted: Sat Feb 04, 2006 7:31 pm
by szabot
Moredo wrote:There is a default bioware script for turning torches on and off, one that isn't buggy. I would have listed it's name, but it seems my toolset is bugged, so I can't open it. :(

IIRC, it's x2_somethingsomething, hah, hope that helps! 8)
Does it work on all things that can give off light, or only torches?

Thanks.

Posted: Sat Feb 04, 2006 7:36 pm
by Moredo
I've only tested it on the CEP candles and, the regular and CEP braciers. It workes perfectly on both. :) I'll see what's wrong with my toolset tomorrow, and past the script name here, unless somebody else already has. But now, I'm out! }8)

Posted: Sat Feb 04, 2006 7:41 pm
by slave_of_emotions
Some torches lights etc have a static light that will be visible even when the object is off. The CEP items have versions for being on and off , use the last one and removed the heartbeat script, then use the script mentioned in second post (nw_xxx_onoff or some like that) that turns it on and off to OnUsed.

I have being making fires by first seting up the required placables that actualy dont burn. After that create a flame on/inside (you will have to experiment abit with locations to make it look good), and add the same script as above to OnUsed.

This is a housing i have been working on, with lights turnable on and off, you can take a look at how i made it if you want: http://slaveofemotions.sl.funpic.de/e10 ... php?view.9