Different Musket, Rifle, and Infantry fire sounds (Tutorial post on the topic of unit sounds does not answer this)

arcvoodal

Chieftain
Joined
Jan 14, 2009
Messages
46
I am trying to get the musketman, rifleman, and infantry to use different gunshot sound effects. I have read through this post Adding action sounds to unit animation.

I have three audio files:
MusketFire-000.wav
MusketFire-001.wav
MusketFire-002.wav

(I am 100% certain they work if I use these same audio files as replacements for the game default RifleFire-000.wav etc.)

I will add the code but the indention gets a bit wonky posting it on this forum. I am aware that the sound xmls are super delicate, any commenting or out-of-place white-space will break it.

In AudioDefines.xml I added:
Code:
        <SoundData>
            <SoundID>SND_MUSKET_FIRE</SoundID>
            <Filename>Sounds/Units/MusketFire</Filename>
            <LoadType>DYNAMIC_RES</LoadType>
            <bIsCompressed>1</bIsCompressed>
            <bInGeneric>1</bInGeneric>
        </SoundData>

I added this as the tutorial said:
"Search for SND_TUTORIAL_COMPLETE_0. Any new entries must be after this, but before the part that starts with <ContextTypes>".
Weird that I must not add it right above SND_RIFLE_FIRE but I followed the instructions.

In Audio3DScripts.xml I added:
Code:
<Script3DSound>
        <ScriptID>AS3D_UN_MUSKET_FIRE</ScriptID>
        <SoundID>SND_MUSKET_FIRE</SoundID>
        <SoundType>GAME_SFX</SoundType>
        <iMinVolume>80</iMinVolume>
        <iMaxVolume>100</iMaxVolume>
        <iPitchChangeDown>-5000</iPitchChangeDown>
        <iPitchChangeUp>4000</iPitchChangeUp>
        <bLooping>0</bLooping>
        <iMinTimeDelay>0</iMinTimeDelay>
        <iMaxTimeDelay>0</iMaxTimeDelay>
        <StartPosition>NONE</StartPosition>
        <EndPosition>NONE</EndPosition>
        <iMinVelocity>0</iMinVelocity>
        <iMaxVelocity>0</iMaxVelocity>
        <iMinDistanceFromListener>0</iMinDistanceFromListener>
        <iMaxDistanceFromListener>0</iMaxDistanceFromListener>
        <iMinDistanceForMaxVolume>500</iMinDistanceForMaxVolume>
        <iMaxDistanceForMaxVolume>1000</iMaxDistanceForMaxVolume>
        <iMinCutoffDistance>7000</iMinCutoffDistance>
        <iMaxCutoffDistance>7000</iMaxCutoffDistance>
        <bTaperForSoundtracks>0</bTaperForSoundtracks>
        <iLengthOfSound>0</iLengthOfSound>
        <fMinDryLevel>1.0</fMinDryLevel>
        <fMaxDryLevel>1.0</fMaxDryLevel>
        <fMinWetLevel>0.5</fMinWetLevel>
        <fMaxWetLevel>0.5</fMaxWetLevel>
        <iNotPlayPercent>0</iNotPlayPercent>
</Script3DSound>
I added this just above the AS3D_UN_RIFLE_FIRE (you will notice the iMinVolume has been increased to 80, which works for RifleFire).

Next in the musketman_md_hurta.kf (note it uses knight sounds for some unknown reason) I changed:
Code:
SOUND:AS3D_UN_HIT_KNIGHT,AS3D_UN_DEATH_HIT,AS3D_UN_RIFLE_COCK,AS3D_UN_STAFF_DIRT
and
Code:
SOUND:AS3D_UN_KNIGHT_HIT_VOX

to:

Code:
SOUND:AS3D_UN_MUSKET_FIRE,AS3D_UN_DEATH_HIT,AS3D_UN_RIFLE_COCK,AS3D_UN_STAFF_DIRT
and
Code:
SOUND:AS3D_UN_MUSKET_FIRE

I changed these same values for musketman_md_rangeddiea.kf and musketman_md_rangeddieb.kf

In-game the sound for musketmen just use the default civ4 sound files of RifleFire.

Any ideas where this is going wrong?
 

arcvoodal

Chieftain
Joined
Jan 14, 2009
Messages
46
Appreciate the reply. Unfortunately I took a break and don't want to relearn the entire system to get it to work. They will just have to all have the same sound effect. Maybe this thread will be useful to someone in the future who wants to do something similar.
 
Top Bottom