Flashlight Triggered Events

===Introduction===
This is a short and easy tutorial on how to create events based by pointing your flashlight at specific targets. Here a ragdoll will be hanging from the ceiling in a room shrouded in darkness and will fall down if the player looks at it with the flashlight turned on.
==The entities==
In this tutorial you will use the following entities:
*info_player_start
*item_suit
*light
*logic_playerproxy
*logic_branch
*logic_branch_listener
*trigger_multiple
*trigger_look
*prop_ragdoll
*phys_constraint
==The rooms==
First of all create a tiny map with two rooms and make a short hallway connect the two. Then place an info_player_start and an item_suit right next to each other in one of the rooms. Place an light entity here as well so the other room becomes dark. From now on we'll call the room the player spawns in as the "spawn room" and the other "dark room."
==The flashlight listener==
To perform the condition checks we need place an logic_playerproxy anywhere in your map, you don't need to name this. This entity can, among many other things, perform an output whenever the player turns the flashlight on or off. Since we can't turn logic_playerproxy on or off we're going to store the status of the flashlight in a logic_branch. Create an logic_branch and name it "flashlight_branch" and let initial value be 0. In logic_playerproxy, make the following outputs:
==The room listener==
Now we need to find out if the player is in the dark room we are making. First make another logic_branch and name it "room_branch", let initial value be 0. We want to know if the player is actually in the room when the flashlight turns on. So we're going to make two triggers: One that indicates that the player enters the dark room and one that indicates he or she is leaving the dark room. At the door leading into the dark room create one trigger_multiple that fills the entire frame and place it at the end of the hallway at the entrance to the dark room. Then make another trigger_multiple at the other entrance leading to the spawn room.
On the trigger closest to the dark room make this output:
And on the trigger closest to the spawn room make this output:
Two conditions down, time to handle the trigger on look.
==The trigger look==
First of all we're going to need a phys_constraint and a prop_ragdoll. First place the prop_ragdoll and give it the fast-zombie model (for the spooky effect), located at models/zombie/fast.mdl. Name it "fastzombie" and place it somewhere above ground in the dark room so it can't be seen from the entrance. Next, place the phys_constraint close to the prop_ragdoll and name it "fastzombie_constraint", in "Entity 1" write "fastzombie".
Next up is the trigger_look, this trigger will fire an output if these conditions are met: The player is inside the trigger volume and has either looked or moved towards a given entity. Make a trigger volume that fills the entire dark room and make it a trigger_look with these values added:
The rest of the values can be as they were. Create a third logic_branch and name it "look_branch" with initial value set to 0. In the trigger_look we made, make an output with this:
The last check we need for the look trigger is to check if the flashlight is activated while the player is looking where we want him or her to. For this we need another output in logic_playerproxy:
The whole output page should look like this:
We are nearly done. Go your cluster of logic_branch and place a logic_branch_listener near them, it dosen't need a name. Fill in this on the first three entries of the logic_branch_listener:
Still on the logic_branch_listener, create an output with the following:
And that should be all. Compile your map, grab the suit, enter the room and look at the hanging zombie with the flashlight on to make it fall down.
Down below is an .vmf file of the tutorial and two addtional events triggered by the flashlight and trigger_look.
==Addtional info==
* Example map of the tutorial
Category:Tutorials