help - how to add audio to new units?

Joined
Feb 6, 2006
Messages
796
Although I'm familiar with modding and editing CIV4's xml, I haven't understood how audio works.

I'm adding a new unit (but the same problem occurs when modifying a new unit), and I want to use my own audio files for it.
So, I put the audio files in a folder under the "sound" folder.
Then, I modified the AudioDefines.xml file, adding the tags for the new audio files.
Then, I modified the Audio3dScripts.xml, adding the scripts that use the newly added audio definitions.

Now, how to use them with my units??

I've tried starting from the CIV4UnitInfos.xml file, in which I can link my unit with its art tag name.
This art tag name refers an entry in the Civ4ArtDefines_Unit.xml file, which also contains several AudioRunSounds tags.
I've tried to use my Audio3dScripts names in those AudioRunSounds tags, but it doesn't work.

Can anyone help me?
Can you clearly explain how to link my unit with those new audio files?
 
You can set select and build sounds easily in the art defines for your unit. For run-loop and run-end effects in the unit art defines, you have to set up your effects in the global types xml as well. In global types xml you need to add your run loop and run end effects to the "FootstepAudioTypes", and "FootstepAudioTags" sections. Look at the passages already there to see how to set it up.

For sounds that are part of your units animations, you'll have to do a bit more work.

If you have max and are making your own unit, reference the fireaxis tut, and sharicks tut to figure out how to set up a sound node so that it works properly.

If you don't have max, and you're trying to substitute your own sounds into an existing units animations you will need to get a hex editor and change the kf files. If you don't have a hex editor try the Cygnus free version, or shop around on the web till you find a free hex editor that works for you.

The first thing you should do is run the unit a few times in-game, and see which anims you want to change sound-wise. Once you know which anims have sounds you want to change, open them up in your hex editor, and scroll all the way to the bottom.

The file I'm using for this example is the wolf hurt anim A. (assets\art\units\wolf\wolf_md_hurta.kf) Let's say I want to change the wolf hurt sound. I would open the wolf hurt anim, and scrolling down I'd see this;

kflookhk8.jpg


The sound I want to replace is SOUND:AS3D_UN_WOLF_HIT_VOX. You can replace it by going into edit, and then replace. If I had a new sound, I would replace it with SOUND:AS3D_UN_WOLF_HIT_NEW, and make a passage for it in the audio defines, and 3d audio scripts xml's.

kfreplaceuh5.jpg


Also, when it comes to editing kf files with a hex editor, you should have all passages you sub in be the same number of characters as the passage you're replacing. Not all hex editors require this, but it's still good practice to avoid potential problems.
 
Back
Top Bottom