setSoundEffect: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<h3 style="display:none">Bottom Section</h3> " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...)
Line 1: Line 1:
{{Command|Comments=
{{Command


|arma1|Game name=
|arma1


|1.00|Game version=
|1.00


|gr1= Sounds |GROUP1=
|gr1= Sounds


|gr2= Triggers |GROUP2=
|gr2= Triggers


|gr3= Waypoints |GROUP3=
|gr3= Waypoints


| Defines the different sound effects.  
| Defines the different sound effects.  
Line 18: Line 18:
* SoundDet (only for triggers) - creates a dynamic sound object attached to a trigger defined in [[CfgSFX]]
* SoundDet (only for triggers) - creates a dynamic sound object attached to a trigger defined in [[CfgSFX]]


To stop any sound, deactivate the trigger (might take up to 0.5 sec to stop) or delete the trigger (immediate). Also use <tt>"$NONE$"</tt> to skip the sound (1st item), when there is none to be used (Example 3, 4, 5). |DESCRIPTION=
To stop any sound, deactivate the trigger (might take up to 0.5 sec to stop) or delete the trigger (immediate). Also use <tt>"$NONE$"</tt> to skip the sound (1st item), when there is none to be used (Example 3, 4, 5).


| trigger '''setSoundEffect''' [sound, voice, soundEnv, soundDet] |SYNTAX=
| trigger '''setSoundEffect''' [sound, voice, soundEnv, soundDet]


|p1= trigger: [[Object]] |PARAMETER1=
|p1= trigger: [[Object]]


|p2= [sound, voice, soundEnv, soundDet]: [[Array]] of strings |PARAMETER2=
|p2= [sound, voice, soundEnv, soundDet]: [[Array]] of strings


| [[Nothing]] |RETURNVALUE=
| [[Nothing]]


|s2= waypoint '''setSoundEffect''' [sound, voice, soundEnv, soundDet] |SYNTAX2=
|s2= waypoint '''setSoundEffect''' [sound, voice, soundEnv, soundDet]


|p21= waypoint: [[Array]] - format [[Waypoint]] |PARAMETER21=
|p21= waypoint: [[Array]] - format [[Waypoint]] |PARAMETER21=
Line 34: Line 34:
|p22= [sound, voice, soundEnv, soundDet]: [[Array]] of strings |PARAMETER22=
|p22= [sound, voice, soundEnv, soundDet]: [[Array]] of strings |PARAMETER22=


|r2= [[Nothing]] |RETURNVALUE2=
|r2= [[Nothing]]
   
   
|x1= <code>_trigger [[setSoundEffect]] ["Alarm", "", "", ""];</code> |EXAMPLE1=
|x1= <code>_trigger [[setSoundEffect]] ["Alarm", "", "", ""];</code>
|x2= <code> [_group1,2] [[setSoundEffect]] ["Alarm", "", "", ""];</code> |EXAMPLE2=
|x2= <code> [_group1,2] [[setSoundEffect]] ["Alarm", "", "", ""];</code>
|x3= <code>_trigger [[setSoundEffect]] ["$NONE$", "Alarm", "", ""];</code> |EXAMPLE3=
|x3= <code>_trigger [[setSoundEffect]] ["$NONE$", "Alarm", "", ""];</code>
|x4= <code>_trigger [[setSoundEffect]] ["$NONE$", "", "BattlefieldFirefight1", ""];</code> |EXAMPLE4=
|x4= <code>_trigger [[setSoundEffect]] ["$NONE$", "", "BattlefieldFirefight1", ""];</code>
|x5= <code>_trigger [[setSoundEffect]] ["$NONE$", "", "", "Owl"];</code> |EXAMPLE5=
|x5= <code>_trigger [[setSoundEffect]] ["$NONE$", "", "", "Owl"];</code>




| [[createTrigger]], [[setMusicEffect]] |SEEALSO=
| [[createTrigger]], [[setMusicEffect]]


}}
}}

Revision as of 11:11, 18 January 2021

Hover & click on the images for description

Description

Description:
Defines the different sound effects.
  • Sound - plays a 2D sound from CfgSounds
  • Voice - plays a 3D sound from CfgSounds
  • SoundEnv - plays an environmental sound from CfgEnvSounds
  • SoundDet (only for triggers) - creates a dynamic sound object attached to a trigger defined in CfgSFX
To stop any sound, deactivate the trigger (might take up to 0.5 sec to stop) or delete the trigger (immediate). Also use "$NONE$" to skip the sound (1st item), when there is none to be used (Example 3, 4, 5).
Groups:
SoundsTriggersWaypoints

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 ["$NONE$", "Alarm", "", ""];
Example 4:
_trigger setSoundEffect ["$NONE$", "", "BattlefieldFirefight1", ""];
Example 5:
_trigger setSoundEffect ["$NONE$", "", "", "Owl"];

Additional Information

See also:
createTriggersetMusicEffect

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 October 2, 2013
Neokika
To avoid having to create a dummy sound definition, you can use $NONE$ instead. private "_trigger"; _trigger = createTrigger ["EmptyDetector", position player]; _trigger setTriggerStatements ["true", "", ""]; _trigger setSoundEffect ["$NONE$", "", "BattlefieldFirefight1", ""];
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" ];