Locking a door

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
MasterMind
Major
Posts: 316
Joined: Thu Jul 15, 2004 12:10 am

Locking a door

Post by MasterMind »

I was wondering, how do i make a door that can be locked and unlocked from a single switch? Also I'd like the swicth to be animated and the door to make a locked sound when its locked :)

thx
Jesus built us a bridge, with 2 boards and 3 nails.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

This is from a scripters perspective:

Make a regular func_rotatingdoor
Give it a key/value of

$targetname/door

Make a switch model, and put a trigger-use around it

give the trigger key/values of

wait/5
setthread/doDoor

Give the switch key/values of

$targetname/switch

Open script, make a new thread.

Code: Select all

doDoor:

//switch anim code, don't know it right offhand
if(level.doorLock == 0)
{
$door unlock
$switch anim alarm_turnon
$switch playsound alarm_switch
}
if(level.doorLock == 1)
{
$door lock
$switch anim alarm_turnoff
$switch playsound alarm_switch
}

end
in your main thread after level waittill spawn:

Code: Select all

$door lock
level.doorLock = 0
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

lock

Post by tltrude »

Here is a tutorial map that has lockable doors. The zip file contains the .map file, a playable pk3, and a text version of the script.

http://pages.sbcglobal.net/tltrude/Temp ... e_test.zip

Image
Tom Trude,

Image
User avatar
MasterMind
Major
Posts: 316
Joined: Thu Jul 15, 2004 12:10 am

Post by MasterMind »

thanks guys

i got my lockable door up and running :D

if i know that you could just say "$door lock" to lock the door i wouldnt have asked the question, lol

thx for the code lizardkid, there were a few bugs in it but i fixed em
Jesus built us a bridge, with 2 boards and 3 nails.
User avatar
MasterMind
Major
Posts: 316
Joined: Thu Jul 15, 2004 12:10 am

Post by MasterMind »

one more question, is there any way i could put something on the scoreboard(the tab thing) that shows if the door is locked or unlocked?
Jesus built us a bridge, with 2 boards and 3 nails.
User avatar
MasterMind
Major
Posts: 316
Joined: Thu Jul 15, 2004 12:10 am

Post by MasterMind »

nevermind i found what i was looking for :)
Jesus built us a bridge, with 2 boards and 3 nails.
Post Reply