setSoundEffect: Difference between revisions
Jump to navigation
Jump to search
m (Text replace - "{{uc:{{PAGENAME}}}}" to "{{uc:{{PAGENAME}}}} {{uc:{{PAGENAME}}}}") |
old_man_auz (talk | contribs) (Added example to get around 'sound not found' error) |
||
Line 47: | Line 47: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on March 7, 2012 | |||
<dt class="note">'''[[User:old_man_auz|old_man_auz]]''' | |||
<dd class="note"> | |||
When using this function, I found that if the parameter '''sound''' was empty, then you would always get a 'Sound not found' error. The following code fixes this problem. You need to create a dummy sound. This is what example 3 is hinting towards. | |||
description.ext: | |||
<code>class CfgSounds { | |||
sounds[] = {}; | |||
class NoSound {name = "NoSound";sound[] = {"", 0, 1};titles[] = {};}; //Dummy sound needed for setSoundEffect command, due to stupid bug in engine. | |||
}; | |||
</code> | |||
(code sample above written by 'CarlGustaffa' on the Bohemia Interactive forums.) | |||
script.sqf: | |||
<code>_trigger = createTrigger[ "EmptyDetector" , _position ]; | |||
_trigger setTriggerStatements [ "true" , "" , "" ]; | |||
_trigger setSoundEffect[ "NoSound" , "" , "" , "Wind2_EP1" ]; | |||
</code> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 22:04, 6 March 2012
Description
- Description:
- Defines the different sound effects. Sound / voice plays a 2D / 3D sound from CfgSounds. SoundEnv plays an enviromental sound from CfgEnvSounds. SoundDet (only for triggers) creates a dynamic sound object attached to a trigger defined in CfgSFX.
- Groups:
- Uncategorised
Syntax
- Syntax:
- trigger setSoundEffect [sound, voice, soundEnv, soundDet]
- Parameters:
- trigger: Object
- [sound, voice, soundEnv, soundDet]: Array of strings
- Return Value:
- Nothing
Alternative Syntax
- Syntax:
- waypoint setSoundEffect [sound, voice, soundEnv, soundDet]
- Parameters:
- waypoint: Array - format Waypoint
- [sound, voice, soundEnv, soundDet]: Array of strings
- Return Value:
- Nothing
Examples
- Example 1:
_trigger setSoundEffect ["Alarm", "", "", ""]
- Example 2:
[_group1,2] setSoundEffect ["Alarm", "", "", ""]
- Example 3:
_trigger setSoundEffect ["NoSound", "", "", "MySound"]; //NoSound = cfgSound dummy (no sound file), MySound = cfgSFX sound effect.
Additional Information
- See also:
- createTrigger
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on March 7, 2012
- old_man_auz
-
When using this function, I found that if the parameter sound was empty, then you would always get a 'Sound not found' error. The following code fixes this problem. You need to create a dummy sound. This is what example 3 is hinting towards.
description.ext:
class CfgSounds { sounds[] = {}; class NoSound {name = "NoSound";sound[] = {"", 0, 1};titles[] = {};}; //Dummy sound needed for setSoundEffect command, due to stupid bug in engine. };
(code sample above written by 'CarlGustaffa' on the Bohemia Interactive forums.) script.sqf:_trigger = createTrigger[ "EmptyDetector" , _position ]; _trigger setTriggerStatements [ "true" , "" , "" ]; _trigger setSoundEffect[ "NoSound" , "" , "" , "Wind2_EP1" ];