Sound sensitive trigger: Difference between revisions
No edit summary |
Hurricaaane (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Level Design]][[Category:Tutorials]] | [[Category:Level Design]][[Category:Tutorials]] | ||
= Sound sensitive Trigger = | |||
In this tutorial, I will explain how we make a trigger that will detect and trigger depending on the sound levels in the surrounding area. Right, lets get stuck in. First of all, make yourself a small area for this example. I’ve made myself a small courtyard: | In this tutorial, I will explain how we make a trigger that will detect and trigger depending on the sound levels in the surrounding area. Right, lets get stuck in. First of all, make yourself a small area for this example. I’ve made myself a small courtyard: | ||
Line 6: | Line 6: | ||
[[Image:Soundsensitive first.jpg]] | [[Image:Soundsensitive first.jpg]] | ||
Now I need something for the microphone to detect from. | Now I need something for the microphone to detect from. An '''[[info_target]]''' is what I used. Call this '''microphone1'''. In your map, it can be called anything you like. Now onto the actual entity setup. Create an [[env_microphone]]. This is the entity that will control the sound output level. Give it the following properties: | ||
'''Measure Target : microphone1''' | '''Classname''' : env_microphone | ||
* '''Name : speaker''' In your map again, this can be anything at all. | |||
* '''Measure Target : microphone1''' Make sure this is the name of your [[info_target]], otherwise the [[env_microphone]] wont do it's sound checks correctly. | |||
* '''Sensitivity : 2''' This should allow you not to be detected by crouching, but will detect you when you run or shoot. | |||
* '''Maximum hearing range : 512''' This is the distance in units the [[env_microphone]] will hear. | |||
* '''Spawnflags :''' | |||
:* Hears combat sounds | |||
:* Hears world sounds | |||
:* Hears player sounds | |||
:* Hears bullet impacts | |||
:* Hears explosions | |||
[[Image:Soundsensitive second.jpg]] | [[Image:Soundsensitive second.jpg]] | ||
''' | Now we need a '''[[logic_compare]]''' to test the sound levels. We need the following parameters for it: | ||
'''compare value : 0.5''' | '''Classname''' : logic_compare | ||
* '''Name : spvol''' Our entity's name again, this entity checks the volume of the microphone and can trigger things. | |||
* '''Initial value : 0''' This is what the [[logic_compare]] will compare all values to, and can trigger an output depending on various states. | |||
* '''Compare value : 0.5''' This is the trigger level to trigger things from the sound level of the env_microphone. | |||
Now we need to set up some of the entity I/O, on our [[env_microphone]], add a new output to our [[env_microphone]] with the following options: | |||
{| | |||
|+Object outputs: speaker - env_microphone | |||
! || My Output || Target Entity || Target Input || Parameter || Delay || Only Once | |||
|- | |||
| [[Image:Io11.png]] || SoundLevel || spvol || SetValueCompare || <none> || 0.00 || No | |||
|} | |||
[[Image:Soundsensitive third.jpg]] | [[Image:Soundsensitive third.jpg]] | ||
The final step now is to set up the output of the [[logic_compare]] to trigger something. This can be open a door, turn on a light, break a rope, anything that can take an entity I/O input. In my case I have rigged up an alarm. | |||
OnLessThan : | '''Output''' : | ||
* OnGreaterThan : This gets triggered when the sound level is past the trigger level. | |||
* OnLessThan : This gets triggered when the sound level is under the trigger level. | |||
This is my final product : | |||
[[Image:Soundsensitive fourth.jpg]] | [[Image:Soundsensitive fourth.jpg]] |
Revision as of 16:09, 14 January 2006
Sound sensitive Trigger
In this tutorial, I will explain how we make a trigger that will detect and trigger depending on the sound levels in the surrounding area. Right, lets get stuck in. First of all, make yourself a small area for this example. I’ve made myself a small courtyard:
Now I need something for the microphone to detect from. An info_target is what I used. Call this microphone1. In your map, it can be called anything you like. Now onto the actual entity setup. Create an env_microphone. This is the entity that will control the sound output level. Give it the following properties:
Classname : env_microphone
- Name : speaker In your map again, this can be anything at all.
- Measure Target : microphone1 Make sure this is the name of your info_target, otherwise the env_microphone wont do it's sound checks correctly.
- Sensitivity : 2 This should allow you not to be detected by crouching, but will detect you when you run or shoot.
- Maximum hearing range : 512 This is the distance in units the env_microphone will hear.
- Spawnflags :
- Hears combat sounds
- Hears world sounds
- Hears player sounds
- Hears bullet impacts
- Hears explosions
Now we need a logic_compare to test the sound levels. We need the following parameters for it:
Classname : logic_compare
- Name : spvol Our entity's name again, this entity checks the volume of the microphone and can trigger things.
- Initial value : 0 This is what the logic_compare will compare all values to, and can trigger an output depending on various states.
- Compare value : 0.5 This is the trigger level to trigger things from the sound level of the env_microphone.
Now we need to set up some of the entity I/O, on our env_microphone, add a new output to our env_microphone with the following options:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
SoundLevel | spvol | SetValueCompare | <none> | 0.00 | No |
The final step now is to set up the output of the logic_compare to trigger something. This can be open a door, turn on a light, break a rope, anything that can take an entity I/O input. In my case I have rigged up an alarm.
Output :
- OnGreaterThan : This gets triggered when the sound level is past the trigger level.
- OnLessThan : This gets triggered when the sound level is under the trigger level.
This is my final product :
File:Soundsensitive fourth.jpg
Hope this can be used in some very effective way, and have fun implementing it!
--Dredfurst 02:13, 30 Jun 2005 (PDT)