[BNW] Need Help adding City-State Audio

Harkodos

Warlord
Joined
Feb 9, 2016
Messages
197
It's admittedly been a while since I've been here, but I've come because I need help.

I'm currently in the process of making unique City-States for my mods and I've been trying to add custom music for when the player greets them in-game; however, whenever I visit the City-States in-game, it will only ever play the music tag for Almaty (the default tag). I've scoured the base files for Civ 5 to try and locate the problem and how to fix it, but to not avail, so that's where I need the help.

Below are examples of how I've set up my audio files for the Minor Civs, if you know how to fix any of my problems, please chime in. Any amount of input could be useful to me.

The code for the SoundDefine:
Code:
<MinorCivsSounds>
    <MinorCivSound>
        <ID>MINOR_CIV_HK_CUSTOM_CITY_STATE</ID>
        <AudioScript>AS2D_MINOR_CIV_HK_CUSTOM_CITY_STATE</AudioScript>
    </MinorCivSound>
</MinorCivsSounds>

The code for the AudioDefine:
Code:
<AudioDefinesFile>
    <SoundDatas>
        <SoundData>
            <SoundID>SND_MINOR_CIV_HK_CUSTOM_CITY_STATE</SoundID>
            <Filename>MinorCiv_Custom</Filename>
            <LoadType>DynamicResident</LoadType>
        </SoundData>
    </SoundDatas>
</AudioDefinesFile>

The code for the Aduio2DScripts:
Code:
<Script2DFile>
    <Script2DSounds>
        <Script2DSound>
            <ScriptID>AS2D_MINOR_CIV_HK_CUSTOM_CITY_STATE</ScriptID>
            <SoundID>SND_MINOR_CIV_HK_CUSTOM_CITY_STATE</SoundID>
            <SoundType>GAME_MUSIC_STINGS</SoundType>
            <iMinVolume>50</iMinVolume>
            <iMaxVolume>50</iMaxVolume>
            <iMinTimeDelay>0</iMinTimeDelay>
            <iDontPlayMoreThan>1</iDontPlayMoreThan>
            <bDontTriggerDuplicates>True</bDontTriggerDuplicates>
            <iMinTimeMustNotPlayAgain>0</iMinTimeMustNotPlayAgain>
            <fTaperSoundtrackVolume>0.0</fTaperSoundtrackVolume>
        </Script2DSound>
    </Script2DSounds>
</Script2DFile>

I've checked the Database file numerous times and it keeps giving me errors such as: "no such tables as MinorCivSound" or "Expected 'Row' or 'Delete' but got 'ID' instead." I've even tried replacing many of these "tables" and "Tags" or adding Row to them, but it has always come bearing the same rotten fruit. This has lead me to believe that Firaxis has intentionally programmed their code to be as confusing as possible (why have tags defined in your files if they don't work when re-created?)

If anyone could help me determine the correct table names and attributes for these files, that'd be great and I'd really appreciate it!
 
Mods must use a different method than the base-game files Firaxis uses.

You want to be using tables <Audio_Sounds> and <Audio_2DSounds> as I recall.

Example for the Alamo wonder "construction" speech:
Code:
	<Audio_Sounds>
		<Row>
			<SoundID>SND_WONDER_SPEECH_ALAMO</SoundID>
			<Filename>Alamo_Quote</Filename>
			<LoadType>DynamicResident</LoadType>
		</Row>
	</Audio_Sounds>
	<Audio_2DSounds>
		<Row>
			<ScriptID>AS2D_WONDER_SPEECH_ALAMO</ScriptID>
			<SoundID>SND_WONDER_SPEECH_ALAMO</SoundID>
			<SoundType>GAME_MUSIC_STINGS</SoundType>
			<TaperSoundtrackVolume>0.0</TaperSoundtrackVolume>
			<MinVolume>80</MinVolume>
			<MaxVolume>80</MaxVolume>
		</Row>
	</Audio_2DSounds>
Also Leugi has a tutorial on adding sounds for leaders which you may need to take a look at.
 
I see. Of course it was so simple as: use the method for adding leader music, etc. (and of course, wrapping the information in GameData, which was not in the Firaxis files is an important tidbit to know.) Even two years into this I am still learning.
 
Alright, so I've done what the tutorials said basically, but I'm still having a problem:
I can't seem to actually designate any of the music I've programmed to any of my unique City-States.

Here's an example of my code, just to showcase what I have so far:
Code:
<GameData>
    <Audio_Sounds>
        <Row>
            <SoundID>SND_MINOR_CIV_HK_CUSTOM</SoundID> --According to Leugi's tutorial, this line should be enough to tell the game that this is the music to use, but I may be misreading something.
            <Filename>MinorCiv_Custom</Filename>
            <LoadType>DynamicResident</LoadType>
        </Row>
    </Audio_Sounds>
    <Audio_2DSounds>
        <Row>
            <ScriptID>AS2D_MINOR_CIV_HK_CUSTOM</ScriptID>
            <SoundID>SND_MINOR_CIV_HK_CUSTOM</SoundID>
            <SoundType>GAME_MUSIC_STINGS</SoundType>
            <MinVolume>50</MinVolume>
            <MaxVolume>50</MaxVolume>
            <MinTimeDelay>0</MinTimeDelay>
            <DontPlayMoreThan>1</DontPlayMoreThan>
            <DontTriggerDuplicates>True</DontTriggerDuplicates>
            <MinTimeMustNotPlayAgain>0</MinTimeMustNotPlayAgain>
            <TaperSoundtrackVolume>0.0</TaperSoundtrackVolume>
        </Row>
    </Audio_2DSounds>
    <!--<MinorCivSounds> -- This is all commented out because the game won't recognize it; however it doesn't seem like there's an equivalent line in the Civ5EngineDatabaseSchema file for me to designate this information.
        <Row>
            <ID>MINOR_CIV_HK_CUSTOM</ID>
            <AudioScript>AS2D_MINOR_CIV_HK_CUSTOM</AudioScript>
        </Row>
    </MinorCivSounds>-->
</GameData>
Am I supposed to add a line in the City-States tables/definitions to make this all work? I didn't see any such lines I could add in the files, but again, I may be reading the outdated files from before modding was possible.
 
That's a shame. It's always the worst when there's just one more piece missing from the puzzle to make it all work out. But I thank you for your assistance regardless.
 
This may be a silly comment, but did you enable 'Reload Audio System' in your mod's properties?
 
Yes, I decided to check that regardless at one point, just to save me the trouble of finding out something as simple as that was giving me problems.
 
Here's a curious question: would it be possible to "force" the game to interpret such files with an SQL code much like what is in the Civ5DatabaseSchema file? If not I'll simply have to forego having music for my City-States (which is a bummer, but I suppose Firaxis just really wanted people to like the Almaty theme, which I do coincidentally but not to the extent that they apparently wanted).
 
You could just force the audio to load via Lua depending on what city-state it is and make the default city-state audio-less.
 
I thought of that, but my knowledge of Lua isn't quite ready for that. Still, a look around the jargon at the Modiki might be good.
 
Back
Top Bottom