VERC: Creating A Locked Door Last edited 21 years ago2003-02-12 20:22:00 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was recovered from an archive and needs to be reviewed

  1. The formatting may be incorrect as it was automatically converted to WikiCode from HTML, it needs to be revised and reformatted
  2. Some information may be out of date as it was written before Half-Life was available on Steam
  3. After the article is re-formatted and updated for Steam HL, remove this notice
  4. Please do not remove the archive notice from the bottom of the article.
  5. Some archive articles are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.

Introduction

This article describes the process used for creating a door that can be locked and unlocked through the use of the func_button (Link: index.php?ent=func_button) , trigger_relay (Link: index.php?ent=trigger_relay) , and multisource (Link: index.php?ent=multisource) entities. This type of setup is useful for creating a situation where the player must accomplish some task (turning on a power grid, disabling a security system, etc) before proceeding to the next area of a level.

Setup

The image below shows the entity layout in the editor's 3D view.
locked_door.jpglocked_door.jpg

The Door

The first thing to do is build the door. In the example map, I've used a func_door_rotating (Link: index.php?ent=func_door_rotating) . Aside from the normal properties, I've chosen the "latch locked" Locked Sounds and given it a Master value of "door_master". This makes the door openable only when the "door_master" multisource (Link: index.php?ent=multisource) (added below) is in an On state. Trying to open the door when the "door_master" multisource (Link: index.php?ent=multisource) is in an Off state will play the "latch locked" sound.

The Button

The button is a simple func_button (Link: index.php?ent=func_button) . The Target of the button is a trigger_relay (Link: index.php?ent=trigger_relay) named "door_master_r" (added below). In the flag properties of the func_button (Link: index.php?ent=func_button) , the "Don't Move" and "Toggle" flags are both enabled. It is not entirely necessary to enabled the "Toggle" flag, as it won't effect the operation of the door, but it does allow for the correct texture to be displayed on the button, since a togglable texture is being used.

The Relay

Due to the behavior of a toggled func_button (Link: index.php?ent=func_button) , it is necessary to put a trigger_relay (Link: index.php?ent=trigger_relay) between the func_button (Link: index.php?ent=func_button) and multisource (Link: index.php?ent=multisource) entities. Set the Name to "door_master_r". Set the Target to the name of the multisource (Link: index.php?ent=multisource) -- "door_master" in this example. Also, set the Trigger State property to "Toggle". When the relay is activated, it will set the multisource (Link: index.php?ent=multisource) entity's state to the opposite of it's current state, ie: On -> Off, or Off -> On.

The Master

Last and most important is the multisource (Link: index.php?ent=multisource) entity. Although it's the most important entity in this equation, it's also the easiest to setup. Simply give it a Name. This example uses a name of "door_master". The multisource acts as the door's locking mechanism.

Why It Works

When you start the level, the multisource (Link: index.php?ent=multisource) is in it's default Off state. Since the door uses the multisource (Link: index.php?ent=multisource) as a master, the door is also in an Off state. When you attempt to use the door, you will get some type of locked sound (if you've set the Locked Sound property of the door). Pressing the button will make the trigger_relay (Link: index.php?ent=trigger_relay) activate the multisource (Link: index.php?ent=multisource) , toggling it (and the door) to an On state. Pressing the button again will toggle it back off. And so on and so forth.

Notes

This example used a trigger_relay (Link: index.php?ent=trigger_relay) activated by a func_button (Link: index.php?ent=func_button) to toggle the multisource (Link: index.php?ent=multisource) entity. In practice, though, any entity that is capable of activating an event can be used to activate the multisource (Link: index.php?ent=multisource) . Things like trigger_multiple (Link: index.php?ent=trigger_multiple) , trigger_once (Link: index.php?ent=trigger_once) , picking up items or weapons - these are all possible triggers for the multisource (Link: index.php?ent=multisource) . Note that in these cases, it is not necessary to use the trigger_relay (Link: index.php?ent=trigger_relay) -- you can target the multisource (Link: index.php?ent=multisource) directly.

This technique can be used with any entity that takes a multisource (Link: index.php?ent=multisource) entity for a Master. Try modifying the example map - give the func_button (Link: index.php?ent=func_button) a Master value of "button_master". Create a multisource (Link: index.php?ent=multisource) with a name of "button_master", and create an item_security (Link: index.php?ent=item_security) somewhere in the same room as the starting player. In the item_security (Link: index.php?ent=item_security) properties, set the Target to "button_master"

Example Map

An example map and map source file is available for this tutorial.

download example map and source (Link: locked_door.zip)
This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.