er2.playClip 115
Play a global Audio Clip (.wav)
Return value
Return Type | Description |
---|---|
void | This function doesn't return anything |
Parameters
Parameter | Type | Description |
---|---|---|
1 | string | File name and extension of the clip to play. Currently only .wav files are supported. File must be placed inside a folder called "sounds" inside your mission folder (C://..../yourmission/sounds/) |
2 | bool | (Optional) Set to true if you want the clip to be played on all clients. False if you want it to be played on the client executing the script only. Default is True |
3 | float | (Optional) Volume multiplier. Default is 1 |
4 | float | (Optional) Max duration of the clip. Default is entire clip duration |
5 | bool | (Optional) Max duration of the clip. Default is 0, which represent entire clip duration |
Examples
Example 131
-- play a global 2D clip called "clip.wav" located inside "<mission folder>/sounds/", synched online, at default volume, one time
er2.playClip("clip.wav")
Example 133
-- we want to play a clip forever, so first of all let's see if someone (like a previous host) already started playing the clip
-- if we never initialized the variable, the value will be nil
if global.get("loop_clip_played") == nil then
-- play a global 2D clip called "clip.wav" located inside "<mission folder>/sounds/", synched online, at default volume, looped forever
er2.playClip("clip.wav", true, 1, 0, true)
-- set a global variable to remember that we initialized the audio already
global.set(true, "loop_clip_played")
end