Simple switch

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Simple switch

Post by Barttje »

hi all, i'm trying to make an simple triggeralbe switch i want only that it can turn on and off...

what i have is:

Code: Select all

local.Cswitch = spawn script_triggerable
local.Cswitch model "animate/alarmswitch.tik" 
local.Cswitch.origin = ( -2025 -2870 -55 ) 
local.Cswitch.angles = ( 0 180 0 )  
local.Cswitch setthread Crswitch
local.Cswitch solid 
local.Cswitch targetname switch1
and under waittill spawn:

Code: Select all

CRswitch:
  $switch1 turnon
  $switch1 turnoff
end
but it doesn't work... can someone help me...
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

Here is a lightswitch i put in Bahnhof. it is in the center house with a switch below and one above.

Code: Select all

shedlight:
	local.lite = spawn script_model model "fx/dummy.tik" "targetname" "hello"
	local.lite.origin = ( -2785 1900 -170 ) // coordinates 
	local.lite light 1 1 1 300 // last number is how big it is, ( 1 1 1 is white light). 
	$hello hide

	local.ltsw1 = spawn trigger_use
	local.ltsw1.origin = ( -2644 1502 -333 )
	local.ltsw1 setsize ( -10 -10 -20 ) ( 10 10 20 )
	local.ltsw1 targetname litsw

	local.static1 = spawn script_model
	local.static1 model "static/switch1.tik"
	local.static1.origin = ( -2644 1502 -333 ) 
	local.static1.angles = ( 0 -90 0 )

	local.ltsw2 = spawn trigger_use
	local.ltsw2.origin = ( -3135 1972 -61 )
	local.ltsw2 setsize ( -10 -10 -20 ) ( 10 10 20 )
	local.ltsw2 targetname litsw2

	local.static2 = spawn script_model
	local.static2 model "static/switch1.tik"
	local.static2.origin = ( -3135 1972 -61 ) 
	local.static2.angles = ( 0 0 0 )

	thread togglelights
	thread togglelights2

end

togglelights:
while(1) 
{ 
$litsw waittill trigger 
thread lighton
}
end

togglelights2:
while(1) 
{ 
$litsw2 waittill trigger 
thread lighton
}
end

lighton:
	$hello show
	wait 15
	$hello hide
end
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

can you make it that i had only the switch that can turn on and off...?
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

Code: Select all

shedlight: 
   local.lite = spawn script_model model "fx/dummy.tik" "targetname" "hello" 
   local.lite.origin = ( -2785 1900 -170 ) // coordinates 
   local.lite light 1 1 1 300 // last number is how big it is, ( 1 1 1 is white light). 
   $hello hide 

   local.ltsw1 = spawn trigger_use 
   local.ltsw1.origin = ( -2644 1502 -333 ) 
   local.ltsw1 setsize ( -10 -10 -20 ) ( 10 10 20 ) 
   local.ltsw1 targetname litsw 

   local.static1 = spawn script_model 
   local.static1 model "static/switch1.tik" 
   local.static1.origin = ( -2644 1502 -333 ) 
   local.static1.angles = ( 0 -90 0 ) 

   thread togglelights 
end 

togglelights: 
level.litsw = 1

while(1) 
{ 
$litsw waittill trigger 
  if(level.litsw == 1)
    {
    $hello show 
    level.litsw = 0
    }
  else
    {
    $hello hide
    level.litsw = 1
    }
} 
end 

Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

but this is a normale switch, i want a alarmswitch... :(
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

replace the

Code: Select all

"static/switch1.tik"
with the .tik of the alarmswitch.

Code: Select all

"miscobj/alarmswitch.tik"
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

oh never mind i had it... :D
Post Reply