Page 1 of 1

Is it poosible to...

Posted: Tue Jun 29, 2004 1:16 pm
by Patroclus
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

Posted: Tue Jun 29, 2004 2:58 pm
by Krane
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

Posted: Tue Jun 29, 2004 3:34 pm
by Patroclus
Thanks, now, how do i get a switch that looks like a light switch? All I can find is that little round silver thing tht would be used in elevators and stuff...

Posted: Tue Jun 29, 2004 4:41 pm
by Krane
The other one I know it's the static/equipment/alarmswitch...mohaa don't have nice switches...

switch

Posted: Tue Jun 29, 2004 5:03 pm
by tltrude
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.

Posted: Tue Jun 29, 2004 6:18 pm
by lizardkid
or jsut make the brushes around it and have a rotatingdoor for the switch without sound and a setthtread value....