DireAussie
Chieftain
- Joined
- Nov 12, 2005
- Messages
- 60
There are 2 XML files:
in xml\audio:
AudioDefines.xml
Audio2DScripts.xml
Open each file and scroll to the end.
in Audio2DScripts:
Copy the last entry between <Script2DSound> and </Script2DSound> and paste in another one just below it. This will become your new sound.
Then change the "ScriptID" value to AS2D_MYSOUND where MYSOUND is what you want to call it.
Change "SoundID" to SND_MYSOUND, where MYSOUND is the same as above.
"Soundtype" should be changed to the most appropriate value. Scroll up in the file - you'll see lots of different sound types. Choose one that you feel is appropriate for your sound.
The rest of the values you can leave. Probably the most interesting to change is "iMinVolume" and "iMaxVolume", which controls how loud it will be in-game.
Here's an example of the custom sound I made:
in AudioDefines.xml:
Scroll to the bottom, then scroll up until you reach the <SoundData> fields. Copy and paste for a new entry like you did before between <SoundData> and </SoundData>
Change "SoundID" to SND_MYSOUND where MYSOUND is the same as you used above
Change "Filename" to the file of the sound on your hard drive, without the .wav extension. If you are in a mods directory then you should put the sound somewhere under the sounds folder in your mod. The rest of the values should stay the same
example:
Your sound is now ready to go!
Code to play the sound:
Make sure you have imported python extensions into the file that will play the sound:
The code to play the sound:
in xml\audio:
AudioDefines.xml
Audio2DScripts.xml
Open each file and scroll to the end.
in Audio2DScripts:
Copy the last entry between <Script2DSound> and </Script2DSound> and paste in another one just below it. This will become your new sound.
Then change the "ScriptID" value to AS2D_MYSOUND where MYSOUND is what you want to call it.
Change "SoundID" to SND_MYSOUND, where MYSOUND is the same as above.
"Soundtype" should be changed to the most appropriate value. Scroll up in the file - you'll see lots of different sound types. Choose one that you feel is appropriate for your sound.
The rest of the values you can leave. Probably the most interesting to change is "iMinVolume" and "iMaxVolume", which controls how loud it will be in-game.
Here's an example of the custom sound I made:
Code:
<Script2DSound>
<ScriptID>AS2D_SWARM</ScriptID>
<SoundID>SND_SWARM</SoundID>
<SoundType>GAME_SFX</SoundType>
<iMinVolume>80</iMinVolume>
<iMaxVolume>80</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>0</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
</Script2DSound>
in AudioDefines.xml:
Scroll to the bottom, then scroll up until you reach the <SoundData> fields. Copy and paste for a new entry like you did before between <SoundData> and </SoundData>
Change "SoundID" to SND_MYSOUND where MYSOUND is the same as you used above
Change "Filename" to the file of the sound on your hard drive, without the .wav extension. If you are in a mods directory then you should put the sound somewhere under the sounds folder in your mod. The rest of the values should stay the same
example:
Code:
<SoundData>
<SoundID>SND_SWARM</SoundID>
<Filename>Sounds/randomevents/swarm</Filename>
<LoadType>DYNAMIC_RES</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>
Your sound is now ready to go!
Code to play the sound:
Make sure you have imported python extensions into the file that will play the sound:
Code:
from CvPythonExtensions import *
The code to play the sound:
Code:
CyAudioGame().Play2DSound("AS2D_SWARM")