createSoundSource: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]OFP[ _]Elite *(\|.*)?\]\]" to "{{GameCategory|ofpe|Scripting Commands}}") |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 1: | Line 1: | ||
{{Command|Comments= | {{Command|Comments= | ||
| arma1 |Game name= | | arma1 |Game name= | ||
Line 12: | Line 11: | ||
|gr1= Broken Commands |GROUP1= | |gr1= Broken Commands |GROUP1= | ||
|gr2= Sounds |GROUP2= | |gr2= Sounds |GROUP2= | ||
| Creates a sound source of the given type (type is the name of the subclass of [[ArmA:_CfgVehicles|CfgVehicles]] which is pointing to the sound defined in [[CfgSFX]]). The actual sound object created is of type <tt>"#dynamicsound"</tt> and could be detected with [[allMissionObjects]]. If the markers array contains several marker names, the position of a random one is used, otherwise, the given position is used. The sound source is placed inside a circle with this position as its center and placement as its radius. Some of the vanilla classes pre-configured in Arma 3: | | Creates a sound source of the given type (type is the name of the subclass of [[ArmA:_CfgVehicles|CfgVehicles]] which is pointing to the sound defined in [[CfgSFX]]). The actual sound object created is of type <tt>"#dynamicsound"</tt> and could be detected with [[allMissionObjects]]. If the markers array contains several marker names, the position of a random one is used, otherwise, the given position is used. The sound source is placed inside a circle with this position as its center and placement as its radius. Some of the vanilla classes pre-configured in Arma 3: | ||
Line 55: | Line 53: | ||
{{Important| For some unknown reason if at the moment of command execution the player is in first person view and is inside a vehicle, the sound created is greatly attenuated}}|DESCRIPTION= | {{Important| For some unknown reason if at the moment of command execution the player is in first person view and is inside a vehicle, the sound created is greatly attenuated}}|DESCRIPTION= | ||
|'''createSoundSource''' [type, position, markers, placement] |SYNTAX= | |'''createSoundSource''' [type, position, markers, placement] |SYNTAX= | ||
Line 65: | Line 62: | ||
|p5= placement: [[Number]] - The sound is placed inside a circle with given position as center and placement as its radius |PARAMETER5= | |p5= placement: [[Number]] - The sound is placed inside a circle with given position as center and placement as its radius |PARAMETER5= | ||
| [[Object]] |RETURNVALUE= | | [[Object]] |RETURNVALUE= | ||
|x1= <code>_soundSource = [[createSoundSource]] ["LittleDog", [[position]] [[player]], [], 0]</code> |EXAMPLE1= | |x1= <code>_soundSource = [[createSoundSource]] ["LittleDog", [[position]] [[player]], [], 0]</code> |EXAMPLE1= | ||
Line 74: | Line 70: | ||
[[deleteVehicle]] _alarm; //stops alarm | [[deleteVehicle]] _alarm; //stops alarm | ||
};</code> |EXAMPLE2= | };</code> |EXAMPLE2= | ||
| [[playSound]], [[playSound3D]], [[sideRadio]], [[say]], [[say2D]], [[say3D]], [[playMusic]]|SEEALSO= | | [[playSound]], [[playSound3D]], [[sideRadio]], [[say]], [[say2D]], [[say3D]], [[playMusic]]|SEEALSO= |
Revision as of 00:30, 17 January 2021
Description
- Description:
- Creates a sound source of the given type (type is the name of the subclass of CfgVehicles which is pointing to the sound defined in CfgSFX). The actual sound object created is of type "#dynamicsound" and could be detected with allMissionObjects. If the markers array contains several marker names, the position of a random one is used, otherwise, the given position is used. The sound source is placed inside a circle with this position as its center and placement as its radius. Some of the vanilla classes pre-configured in Arma 3:
- "Sound_Alarm"
- "Sound_Alarm2"
- "Sound_BattlefieldExplosions"
- "Sound_BattlefieldFirefight"
- "Sound_Fire"
- "Sound_SmokeWreck1"
- "Sound_SparklesWreck1"
- "Sound_SparklesWreck2"
- "Sound_Stream"
// description.ext class CfgSFX { class MyOwl { sound0[] = {"@A3\Sounds_F\environment\animals\birds\owl1", db-10, 1.0, 1000, 0.2, 0, 15, 30}; // path to addon sound sound1[] = {"@A3\Sounds_F\environment\animals\birds\owl2", db-10, 1.0, 1000, 0.2, 0, 15, 30}; // path to addon sound sound2[] = {"@A3\Sounds_F\environment\animals\birds\owl3", db-10, 1.0, 1000, 0.2, 0, 15, 30}; // path to addon sound sounds[] = {sound0, sound1, sound2}; empty[] = {"", 0, 0, 0, 0, 0, 0, 0}; }; }; class CfgVehicles { class MyOwlSound // class name to be used with createSoundSource { sound = "MyOwl"; // reference to CfgSFX class }; };
_owl = createSoundSource ["MyOwlSound", position player, [], 0];
Note that the sound created by createSoundSource will always be looping. Also when CfgSFX sound definition contains more than 1 sound, there is no guarantee that the sound played will be the same on every PC in Multiplayer.
- Groups:
- Broken CommandsSounds
Syntax
- Syntax:
- createSoundSource [type, position, markers, placement]
- Parameters:
- [type, position, markers, placement]: Array
- type: String - CfgVehicles class
- position: PositionAGL, Position2D or Object - Desired placement position
- markers: Array - If the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the sound will also be created at given z coordinate
- placement: Number - The sound is placed inside a circle with given position as center and placement as its radius
- Return Value:
- Object
Examples
- Example 1:
_soundSource = createSoundSource ["LittleDog", position player, [], 0]
- Example 2:
[] spawn { _alarm = createSoundSource ["Sound_Alarm", position player, [], 0]; //starts alarm sleep 10; deleteVehicle _alarm; //stops alarm };
Additional Information
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
Bottom Section
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Command Group: Broken Commands
- Command Group: Sounds
- Scripting Commands: Global Effect
- Operation Flashpoint: Elite: Scripting Commands
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands