Jump to content
Sign in to follow this  
chronicsilence

createSoundSource with custom sound files (or any other global sound effect object)

Recommended Posts

Hi everyone,

So I'm working on a script to play a sound from a vehicle in a multiplayer mission. Currently, I have it spawn a helper object to play the sound using "say3D", since I need to be able to cut the sound off early by deleting the helper object (if you play the sound directly from the vehicle with "say3D", you can't end it before the end of the sound file unless you delete the vehicle itself).

The problem is, using BIS_fnc_MP to run the "say3D" command on every client (its effects are local) is causing significant network overhead and causing a noticeable delay before the sound is actually heard on the clients, so I'm looking for alternatives that are natively global. The other caveat is that it has to be an actual object that plays the sound, so I can attach it to the vehicle and have it stay with the vehicle as the vehicle moves.

I've been looking into the "createSoundSource" command, which seems to be the best of everything. Its effects are global so I don't have to run BIS_fnc_MP, and it creates a sound source object that I can delete when I'm done with the sound. The problem is, it only seems to be able to play built-in sound effects. Does anyone know of any way to make it use a custom sound file that is in the mission file (i.e. one that every client already has in their mission file)? Or, if that isn't even possible, does anyone have any decent alternatives?

Thanks!

Share this post


Link to post
Share on other sites

PlaySound3D is great, except that you can't delete it mid-sound and you can't attach it to objects and move it (the sound will always play from the location that you initially created it). Unfortunately, that means I can't use it.

Share this post


Link to post
Share on other sites

AFAIK you'll have to make a mod if you want custom sounds. The sound source objects are in CfgVehicles so you can't do anything to their properties or create new ones in the description.ext.

Share this post


Link to post
Share on other sites

Im not sure long playing global sounds will sync well for JIP. playSound3D doesnt and there is no reason to think createSoundSource does.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×