Page 1 of 1

Simple switch

Posted: Mon Sep 05, 2005 5:39 pm
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...

Posted: Mon Sep 05, 2005 9:43 pm
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

Posted: Wed Sep 07, 2005 4:33 pm
by Barttje
can you make it that i had only the switch that can turn on and off...?

Posted: Wed Sep 07, 2005 4:54 pm
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 


Posted: Wed Sep 07, 2005 5:10 pm
by Barttje
but this is a normale switch, i want a alarmswitch... :(

Posted: Wed Sep 07, 2005 6:30 pm
by lizardkid
replace the

Code: Select all

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

Code: Select all

"miscobj/alarmswitch.tik"

Posted: Wed Sep 07, 2005 6:42 pm
by Barttje
oh never mind i had it... :D