Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Introduction to Triggers in Entities - A Tutorial for Counter-Strike 1.6

Wondering how to make a light go on and off? Want a door to open when you press a button? Want a sound to play when you pass through a certain area? Here is the basic of all of it.

If you are reading this, I am supposing you already know how to add a point entity to a map and how to tie a world brush to an entity in the map. If not, you may want to read [this](http://cs.gamebanana.com/tuts/11491 "Introduction to Mapping"). Introduction to **Triggers** ==================================================== Trigger could be referred to any entity (lets say "A") that communicates with another entity (called target, lets say "B") and causes a change in the state of entity "B".
When a player walks through/uses/touches the trigger entity, it calls the target entity and changes its state.
Its similar to a gun and a bullet, when u pull the trigger, the bullet gains the motion.
What entities can be triggered or called upon by a trigger? ----------------------------------------------------------- Any entity with a "name field" can be called upon by a triggering entity. These entities that are called upon by the trigger are known as the "targets". For example, light, func door, func rotating etc.
  • Just select an entity that you have added in the map and right click on it in 2-D viewport,
  • click on properties,
  • You will see "name" there under "Class Info" tab.
  • In the name field type a name value.
We all have a name so that people can call us, same is with entities, you have to give them a name to call/trigger them.
In the [image](http://files.gamebanana.com/img/ss/tuts/52a05cdbb6ea1.jpg "name"), you can see that I have named the light entity as "light1".
What entities could be used as a trigger? ----------------------------------------- Any entity having a target field, can be used as a trigger. For example, all entities named with prefix "trigger_", func door, func breakable, func button etc.
If you want to call an entity (suppose the light entity that we named light1 previously) with a trigger,
  • create a trigger entity (like trigger multiple or a func button),
  • select it and right click on it in 2-D veiwport,
  • click on properties.
  • Under the "class info" tab you will see "target", just type the name of the entity you want to call (here, light1) in "target" field.
Refer to the [screenshot](http://files.gamebanana.com/img/ss/tuts/52a05ce5d4e22.jpg "target"). [Here](http://cs.gamebanana.com/tuts/10630 "Trigger entities") is a list of some trigger entities and there uses.
How to create a time gap between the triggering/calling and its consequences? ----------------------------------------------------------------------------- Suppose you want the light to turn on 2 seconds after you pass through a trigger entity,
  • just look into the properties of the trigger entity, there will be a field "[delay before trigger](http://files.gamebanana.com/img/ss/tuts/52a05cd3b789a.jpg "delay")" under the "class info" tab.
  • Type in the value of the time gap(in seconds) there.

That means, If you type "2" there, the light will turn on/off after 2 second of a player passing through the trigger.
Few more things ---------------
  1. If you want to create an area that triggers an entity every time a player passes through it, you can use trigger multiple.
    • Create a brush/block over that area with texture "triggeraaa",
    • select this block, right click in 2-D viewport,
    • click on "tie to entity",
    • in "class" field, choose "trigger multiple".
    • Write the value of the target. Done.

    This block will not appear in the game, but it will trigger the target entity every time someone passes through it.
    We can use "trigger once" entity if we want the triggering process to happen only once, that is the first time the player passes through that block/brush.

  2. You can use a "func_button" to create a button that triggers the target.
    • Make a button-like structure in the map,
    • select this button, right click in 2-D viewport,
    • click on "tie to entity",
    • in "class" field, choose "func button".
    • Write the value of the target. Done.

    1. That's it for now.
      Keep mapping.