This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Half-Life: Alyx Workshop Tools/Level Design/Keycard Readers

From Valve Developer Community
Jump to navigation Jump to search

Introduction

This tutorial will teach you to create keycard readers that unlock doors for Half Life: Alyx. These scanners are a lot more flexible than just being tied to keycards and opening doors, as you could use any physics object with any destination you wish that perform specific actions depending on the entity.

Prefab Download: [1]


Requirements

At the time of this writing this requires you to have the .fgd dump provided by Gvarados, which can be found on the repo https://github.com/gvarados1/Half-Life-Alyx-FGD


Setup

Keycard

Insert a prop_physics entity and select the keycard model and give it a name. You can change its color under object properties. For the sake of this demonstration we're using the keycard, but if you want to use a different physics prop then use that instead.

Setting up your Door

Insert a prop_door_rotating_physics entity, select a door model and give this a name. Set its Spawn Position to Closed. Under spawnflags select Starts Locked and Use closes.

Creating a Filter

Under entities create a filter_activator_name and give this a name. Ensure filter mode has "Allow entities that match criteria" selected and Filter Name has your keycard selected.

Adding Trigger

Create a mesh, under entity class give it trigger_multiple and give this a name. Under spawnflags check Physics Objects and uncheck Clients. For the example of a keycard scanner, this will be placed in the scanning area of the scanner prop.

Keycard Reader

For this demonstration we'll place a keycard reader prop_dynamic. This in theory adds nothing more than input for the player and will give feedback to them with a green light after successful scan of a keycard meeting the trigger.


Filter Outputs

Add two OnPass outputs with your filter_activator_name. On the first one select your target entity to be the door, and for target input select Unlock. For the second OnPass output, select the Keycard reader, for its target input select Skin and for Parameter select 1.

Trigger Outputs

Add an OnStartTouch output and for its target entity select your filter. For target input select TestActivator.