What's teh way to play a sound?

RogerBacon

King
Joined
Nov 16, 2003
Messages
649
I want to play a sound "AS3D_UN_ARROW_FLY" but I'm not sure how to do it. I see this in the Python API in the class CyAudioGame:

Code:
INT Play2DSoundWithId(INT scriptId)
int (int scriptId) - Play 2d sound using scriptId and return a handle to the sound.


INT Play3DSound(STRING scriptname, FLOAT x, FLOAT y, FLOAT z)
int (TCHAR* scriptname, float x, float y, float z) - Play 3d sound using scriptname at position (x,y,z) and return a handle to the sound.


INT Play3DSoundWithId(INT scriptId, FLOAT x, FLOAT y, FLOAT z)
int (int scriptId, float x, float y, float z) - Play 3d sound using scriptId at position (x,y,z) and return a handle to the sound.

Which one do I use and do I need to create a CyAudioGame object? Has anyone created sounds in a mod?

Roger Bacon
 
if you want to play an own sound, then you have just to edit the *Audio3DScripts.xml* and *AudioDefines.xml* and of course link the unit or whatever to the new sound.
i've done my own civ-specific-sound (if you click on a unit) to my own civ. it woks perfect :D it's cool to hear my own voice in the game :D
 
0d1n3oo3Broad said:
if you want to play an own sound, then you have just to edit the *Audio3DScripts.xml* and *AudioDefines.xml* and of course link the unit or whatever to the new sound.
i've done my own civ-specific-sound (if you click on a unit) to my own civ. it woks perfect :D it's cool to hear my own voice in the game :D

Thanks for the response 0d1n3oo3Broad but that isn’t exactly what I meant. I know how to attach a sound to a unit but I need to make the game make a sound when an effect that I am making goes off. I want to do a sound the same way we can make visual effects using:
Code:
CyEngine().triggerEffect(….)

I assume that one of the functions I listed at the top of this thread would be used to make a sound and I was just checking to see if anyone had already had any luck with this before I set off to reinvent the wheel.

Roger Bacon
 
Back
Top Bottom