Create traffic lights: Difference between revisions
(I translate. sorry for baD english! ^-^) |
Biohazard 90 (talk | contribs) (fixed translation) |
||
Line 3: | Line 3: | ||
}} | }} | ||
The [[Half-Life 2]] resources already provide a model of a signal light, this tutorial will explain how a dynamic traffic light can be set up using [[Inputs_and_outputs|inputs and outputs]]. | |||
==required Entities== | |||
* a <code><b>[[prop_dynamic]]</b></code> with the following keyvalues: | |||
:'''World Model = props_c17\Traffic_Light001a.mdl''' | |||
:'''Disable Shadows = Yes''' | |||
:'''Collide with world = Not solid''' (necessary when you want to place the lights inside the model or very close to it) | |||
* three <code><b>[[point_spotlight|point_spotlights]]</b></code> placed at roughly the right position near the model | |||
* one <code><b>[[logic_auto]]</b></code> | |||
* | * two <code><b>[[logic_relay|logic_relays]]</b></code>. | ||
Line 27: | Line 27: | ||
[[File:CBETOFOPyellow.jpg|240px|thumb|right]] | [[File:CBETOFOPyellow.jpg|240px|thumb|right]] | ||
== | ==I/O setup== | ||
The input and output logic will define how long each light will be visible, this example will use the following durations: | |||
* red and green - 30 seconds | |||
yellow - 3 | * yellow - 3 seconds | ||
== | ===Entity names=== | ||
The ''targetname'' keyvalue defines the name of the entities, the three point_spotlights should use the following names respectively: "greenLight" "redLight" "yellowLight". The first logic_relay will be named "traffLightRelay1" and the second one "traffLightRelay2". | |||
===Outputs=== | |||
The logic_auto requires the following output: | |||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[Image:Io11.png]] || OnMapSpawn || traffLightRelay1 || Trigger || || 0.00 || Yes | | [[Image:Io11.png]] || OnMapSpawn || traffLightRelay1 || Trigger || || 0.00 || Yes | ||
|} | |} | ||
Add these outputs to the ''first'' logic_relay: | |||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[Image:Io11.png]] || OnTrigger || yellowLight || LightOn || || 28.00 || No | | [[Image:Io11.png]] || OnTrigger || yellowLight || LightOn || || 28.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || redLight || LightOff || || 30.00 || No | | [[Image:Io11.png]] || OnTrigger || redLight || LightOff || || 30.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 30.00 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 30.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || yellowLight || LightOff || || 30.00 || No | | [[Image:Io11.png]] || OnTrigger || yellowLight || LightOff || || 30.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || traffLightRelay2 || Trigger || || 32.00 || No | | [[Image:Io11.png]] || OnTrigger || traffLightRelay2 || Trigger || || 32.00 || No | ||
|} | |} | ||
{{Note | {{Note|This tutorial will use both logic_relay and trigger them one after another}} | ||
Add these outputs to the ''second'' logic_relay: | |||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 28.00 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 28.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 28.50 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 28.50 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 29.00 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 29.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 29.50 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOn || || 29.50 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 30.00 || No | | [[Image:Io11.png]] || OnTrigger || greenLight || LightOff || || 30.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || yellowLight || LightOn || || 30.00 || No | | [[Image:Io11.png]] || OnTrigger || yellowLight || LightOn || || 30.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || redLight || LightOn || || 32.00 || No | | [[Image:Io11.png]] || OnTrigger || redLight || LightOn || || 32.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || traffLightRelay1 || Trigger || || 32.00 || No | | [[Image:Io11.png]] || OnTrigger || traffLightRelay1 || Trigger || || 32.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || OnTrigger || yellowLight || LightOff || || 32.00 || No | | [[Image:Io11.png]] || OnTrigger || yellowLight || LightOff || || 32.00 || No | ||
|} | |} | ||
Now the map can be compiled and the traffic lights should be working! | |||
[[Category:Level Design Tutorials]] | [[Category:Level Design Tutorials]] |
Revision as of 08:30, 24 May 2011
The Half-Life 2 resources already provide a model of a signal light, this tutorial will explain how a dynamic traffic light can be set up using inputs and outputs.
required Entities
- a
prop_dynamic
with the following keyvalues:
- World Model = props_c17\Traffic_Light001a.mdl
- Disable Shadows = Yes
- Collide with world = Not solid (necessary when you want to place the lights inside the model or very close to it)
- three
point_spotlights
placed at roughly the right position near the model
- one
logic_auto
- two
logic_relays
.
I/O setup
The input and output logic will define how long each light will be visible, this example will use the following durations:
- red and green - 30 seconds
- yellow - 3 seconds
Entity names
The targetname keyvalue defines the name of the entities, the three point_spotlights should use the following names respectively: "greenLight" "redLight" "yellowLight". The first logic_relay will be named "traffLightRelay1" and the second one "traffLightRelay2".
Outputs
The logic_auto requires the following output:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnMapSpawn | traffLightRelay1 | Trigger | 0.00 | Yes |
Add these outputs to the first logic_relay:

Add these outputs to the second logic_relay:
Now the map can be compiled and the traffic lights should be working!