Page 1 of 1

Locking a door

Posted: Sat May 24, 2003 1:19 pm
by TechZimmy
I am making a map with TONS of secret passages, and in the "passage control room" i want to have a switch that will lock them all. I have the switch, its called rd_swichlock (i forgot the t on purpose). The triggger is called rd_triggerlock, and the door (there is only 1 right now) is rd_doorlock. Here is my script:

Code: Select all

lockdoors:

	$rd_triggerlock waittill trigger
	if (level.passlock == 0)
	{
		$rd_swichlock playsound alarm_switch
		$rd_swichlock anim turn
		$rd_doorlock lock
		level.passlock = 1
		goto lockdoors
	}
	if (level.passlock == 1)
	{
		$rd_swichlock playsound alarm_switch
		$rd_swichlock anim idle
		$rd_doorlock unlock
		level.passlock = 0
		goto lockdoors
	}
end
for some reason, this does not work at all. Whenever i press use at the trigger, nothing happens at all. Any suggestions?
Zimmy

Posted: Sat May 24, 2003 1:46 pm
by jv_map
Either set level.passlock = 0 at level start up or use if(level.passlock != 1) instead of if(level.passlock == 0).

You may use 'else' for the other compound_statement 8)

Thread

Posted: Sat May 24, 2003 3:29 pm
by tltrude
You must also arm the trigger (thread) under prespawn with this line:

level waittill prespawn

level.passlock = 0
thread lockdoors


It is not a good idea to arm it with a setthread in the trigger in this case. I hope jv-map agrees.

Posted: Sat May 24, 2003 3:39 pm
by jv_map
I couldn't agree more :wink:

Posted: Sat May 24, 2003 5:59 pm
by TechZimmy
ok it worked, but now it messes up the first part of my script. It is called remote_door1 (yes, copied from explodingdoor). It uses a switch to open and close a door. Here is my new script

Code: Select all

level waittill prespawn
level.rdoorpos = 0
level.passlock = 0
thread remote_door1
thread lockdoors

remote_door1:

	$rd_trigger1 waittill trigger
	if (level.rdoorpos == 0)
	{
		$rd_switch1 playsound alarm_switch
		$rd_switch1 anim turn
		$remote_door open
		level.rdoorpos = 1
		goto remote_door1
	}
	if (level.rdoorpos == 1)
	{
		$rd_switch1 playsound alarm_switch
		$rd_switch1 anim idle
		$rd_switch2 anim idle
		$remote_door close
		level.rdoorpos = 0
		goto remote_door1
	}
end

lockdoors:

	$rd_triggerlock waittill trigger
	if (level.passlock == 0)
	{
		$rd_swichlock playsound alarm_switch
		$rd_swichlock anim turn
		$rd_doorlock lock
		level.passlock = 1
		goto lockdoors
	}
	if (level.passlock == 1)
	{
		$rd_swichlock playsound alarm_switch
		$rd_swichlock anim idle
		$rd_doorlock unlock
		level.passlock = 0
		goto lockdoors
	}
end
When i go to use the switch in remote_door1 all i hear is the "door closed" sound, the switch dosent move, and the door does nothing. Any suggestions?
Zimmy

yes

Posted: Sat May 24, 2003 6:14 pm
by tltrude
yes