Lockable Doors :: Moal - Scripting by Moal / Wombat
This
tutorial assumes you are already familiar with SDK (MOHRadient)
or similar and know how to create a basic room with
a light, platform etc. See (Basic room tutorial &
Basic lights tutorial). Its also assumed that
you have read the documentation that was released with
the Editor.
A lockable door is a door that is locked
when the game starts.It can be unlocked or locked again
to allow/deny access to certain areas of a map. In a
SP map it can be used to keep a player from accessing
an area until they, for example, complete an objective.
In a TDM or OBJ map it could be used to "seal"
an area so that only one side has access to it - preventing
spawnkilling.
Create
a room (mine is 128 x 128) with a door in it. Select
the door and hit n to bring
up the entity properties screen.
Click
the NOT_PLAYERS and TARGETED boxes as shown in Fig 1.
Give it the key/value targetname door1. Then close the
entity properties screen and deselect the door.
Next add 2 brushes, one either side of the door (Fig
2) and texture them with the trigger_use texture. (Note
: This could be done by just using 1 trigger use across
the door but it will generate trigger_use leaks)
Select the brushes, and then hit n. Give them both
the key/value of target door1. Then select each one
in turn. To the inside brush give the key/value of targetname
dooropenerin (Fig 3) and to the outside brush give the
key/value of targetname dooropenerout.
Add another trigger_use textured brush outside the
room. Using the entity properties screen, give the brush
a key/value of targetname outsidelock. Also give it
the key/value setthread doorlock (Fig 4).
Add another trigger_use textured brush inside the room.
Using the entity properties screen, give the brush a
key/value of targetname insidelock. Also give it the
key/value setthread doorlock (Fig 5). (Note: Again this
can be done with one trigger_use but you will get a
trigger_use leak)
doorlock:
$outsidelock nottriggerable //
don't let it trigger until thread is finished
$insidelock nottriggerable
$dooropenerin triggerable //
door is now unlocked
$dooropenerout triggerable
wait 10
$dooropenerin nottriggerable //
lock it
$dooropenerout nottriggerable //
lock it
$outsidelock triggerable //
turn on unlock triggers
$insidelock triggerable
end
Obviously this is just the basics and can be expanded
on