Create traffic lights
The
Half-Life 2 assets already provide a model of a signal light, this tutorial will explain how a dynamic traffic light can be set up using I/O.
Required entities
- One prop_dynamic with the following keyvalues:
| Keyvalue | Value |
|---|---|
| World Model | props_c17\traffic_light001a.mdl
|
| Disable Shadows | Yes |
| Collide with world | Not solid |
- 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!
External links
vmf + bsp + screenshots (Counter-Strike: Source!) [dead link]