Is it possible to create a light which ca be switch on and off?
What I rigged up is a switch that opens a door in the ceiling with light in the cavity behind the door, but is tere an easier, better looking way?
Thanks
Is it poosible to...
Moderator: Moderators
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Yeah, it's possible. Just keep in mind that this light will "go through" walls, so don't put it too close to walls, ceilings, etc...
Create a script model and give the key/values:
key:targetname
value:mylight
key:model
value:fx/dummy.tik
put a switch in your map and give:
key:targetname
value:myswitch
and put a trigger use around the switch:
key: setthread
value:switchthread
Now, in your script file, put this above level waittill spawn:
//light off
$mylight light(1 1 1)
$mylight lightRadius 150
$mylight notsolid
level.lightswitch1=0
$mylight lightoff
and this, at the bottom:
//light thread
switchthread:
$myswitch anim turn
$myswitch anim waittill animdone
$myswitch anim on
$myswitch playsound click
$myswitch anim waittill animdone
if (level.lightswitch1==0 )
{
$mylight lighton
level.lightswitch1=1
}
else
{
$mylight lightoff
level.lightswitch1=0
}
wait .5
$myswitch anim off
end
Create a script model and give the key/values:
key:targetname
value:mylight
key:model
value:fx/dummy.tik
put a switch in your map and give:
key:targetname
value:myswitch
and put a trigger use around the switch:
key: setthread
value:switchthread
Now, in your script file, put this above level waittill spawn:
//light off
$mylight light(1 1 1)
$mylight lightRadius 150
$mylight notsolid
level.lightswitch1=0
$mylight lightoff
and this, at the bottom:
//light thread
switchthread:
$myswitch anim turn
$myswitch anim waittill animdone
$myswitch anim on
$myswitch playsound click
$myswitch anim waittill animdone
if (level.lightswitch1==0 )
{
$mylight lighton
level.lightswitch1=1
}
else
{
$mylight lightoff
level.lightswitch1=0
}
wait .5
$myswitch anim off
end
switch
You can make a script_object switch out of brushes. The little arm can then be made to rotate up and down in the script--kind of like a floor or ceiling hatch.

