Tutorial: Adding Music to Your MOD Civilization

When we want to follow a longer path pattern (like Firaxis), do we add "Switch Containers" or "Virtual Folders"?

Zrzut ekranu (156).png
 
Wwise always throws an error on my mac due to the fact that they used crossover to transfer it to mac. Thoughts? Especially considering Wwise seems impossible for me?
 
Wwise always throws an error on my mac due to the fact that they used crossover to transfer it to mac. Thoughts? Especially considering Wwise seems impossible for me?
You could try running it in a virtual machine. I don't own a mac, but I don't see any reason why that couldn't work. I've used VirtualBox in the past to get around similar os-based issues.
 
Seems like its been quite here for 2 years, but i would like to ask a question. What action do i use for the music.lua?
 
guys just wanna post a comment here to say thank you all so much for this thread, this has been a great help to my modding sessions since I want my mods to have custom music
 
That being said, I'm trying to figure out how to add ambient music, I've already seen a few mods capable of doing that, how do I get my Ancient Era theme to play first then the other ambients? I've seen other mods able to implement ambients well, can someone who knows how to do that show me pls?
 
Hello everyone,
A bit sorry for reviving a pretty much dead thread, but after following everything in the first 2 posts, it would seem that the mod crashes the game each time.
I get an "unhandled exception access violation" error and I have no idea how to fix this...
If anyone can get why it doesn't work for me...
 
It's alright, I've actually figured out now how to add music, both ambient and main themes.

I'm gonna be releasing a template on this real soon, but I cannot promise it'll have no bugs/glitches. (That being said, any bugs are caused (likely unintentional) by the developers themselves, but I can guarantee that this template will let music work generally for civs, so said bugs are probably gonna be minor and won't show up very often)
 
Glad to see there's still folks on this one. I just worked my way through everything and ran into the same issue as @Neox969 - an unhandled exception access violation when the audio starts to load in.

Jumping back to @darko82 - I had the same problem, initially! Looking back through the tutorial, I realized I missed a detail: when you add Events, you need to make sure they're properly linked to your music object, like this:
K2yB4D0.png


This should cause the appropriate linked items to show up automatically, without needing to drag and drop them in (which I don't think is actually possible if you haven't linked them like this).
 
Last edited:
Hello everyone,
A bit sorry for reviving a pretty much dead thread, but after following everything in the first 2 posts, it would seem that the mod crashes the game each time.
I get an "unhandled exception access violation" error and I have no idea how to fix this...
If anyone can get why it doesn't work for me...

Hey - just finished dealing with this problem, you might be running into the same issue:

In my case, the problem was that my sound bank ("CAEPHOR_Music") and switch container ("CAEPHOR_Music_Bank") were not named identically to my civilization's actual ID ("FEK_CAEPHOR"). By switching the names to match, everything started working:

cg6HjT5.png
 
A few notes for anyone attempting to follow this guide:
1. See Eras.artdef in the base game's files for all of the switches you can use. Not every era has its own switch in the game. Classical uses Ancient's switch, Renaissance uses Medieval's switch, Modern uses Industrial's switch (weirdly). and both Atomic and Informational use Modern's switch (meaning that whatever you assign to modern won't actually play until Atomic). This means you can't assign a playlist to every era, some will simply carry over to the next era(s).
2. Your playlists will not loop throughout their respective eras by default. To accomplish this, visit this link.
3. If you have already linked a Civilizations.artdef to use base game music and you want to switch over to this, you MUST remove this link as it overrides the custom SoundBank. If you don't, the music you selected in Civilizations.artdef will play, not your music.

Alright - so I'm running into some issues trying to get custom music working for my Civ, and I suspect it's because I've done something wrong with my looping settings. Unfortunately, the link in this post is dead, and I think the information in that link (setting up looping settings) is related to my troubles. I've just been kinda fiddling around trying to figure out a solution on my own, and I haven't had any luck yet. Would anyone who knows the correct looping settings be kinda enough to post them here?

For context/clarity: I'm trying to get custom music working for my custom civ - one song for each of the four era categories, plus a diplomacy screen song.I'd like this to work whether I'm playing the custom faction or playing against them (another player / AI), and I'd like it to be integrated with the existing vanilla music for other factions.

My current scenario:
- When playing as the custom faction: the custom music plays correctly, once, when I settle my first city. Once I meet some neighbors, their vanilla music plays. Then eventually, everything goes completely silent, and there's no more music for the rest of the game.
- When playing as a vanilla faction against my custom faction: the vanilla music plays as expected, including music from any vanilla neighbors I meet along the way, until I discover the custom faction as a neighbor. Eventually (presumably when it's trying to switch to their custom music), everything goes silent and no more music plays for the rest of the game. I don't hear the custom music at all in this scenario.
- I'm using the LUA that's been passed around in this thread to manually manage/stop the audio in certain situations.
- There are no errors in LUA.log, Database.log, or Modding.log

I suspect that what's happening is that my custom music is not recognizing when it's reached the end of the song, so it just sits there lingering on silence forever, never allowing the game to switch to another track.

I'm gonna continue to explore and fiddle with settings on my own, but if anybody happens to know the correct settings, or would be willing to share their Wwise project, I'd appreciate it tremendously.

----------------

EDIT: I think I might just be an idiot. I had a typo in one of my events (visible up above in an earlier image, even!).

For future googlers, the settings I'm currently using are:

- Leader music events are referencing music in a separate switch container than the era music. (Make sure you still set appropriate paths for the four eras, even if they all reference the same song!)
- All music playlists are set to Sequence Step (not continuous), with infinite loop count.
- All tracks have a custom marker (name doesn't matter) a second or so before the end of file.
 
Last edited:
Alright - so I'm running into some issues trying to get custom music working for my Civ, and I suspect it's because I've done something wrong with my looping settings. Unfortunately, the link in this post is dead, and I think the information in that link (setting up looping settings) is related to my troubles. I've just been kinda fiddling around trying to figure out a solution on my own, and I haven't had any luck yet. Would anyone who knows the correct looping settings be kinda enough to post them here?

For context/clarity: I'm trying to get custom music working for my custom civ - one song for each of the four era categories, plus a diplomacy screen song.I'd like this to work whether I'm playing the custom faction or playing against them (another player / AI), and I'd like it to be integrated with the existing vanilla music for other factions.

My current scenario:
- When playing as the custom faction: the custom music plays correctly, once, when I settle my first city. Once I meet some neighbors, their vanilla music plays. Then eventually, everything goes completely silent, and there's no more music for the rest of the game.
- When playing as a vanilla faction against my custom faction: the vanilla music plays as expected, including music from any vanilla neighbors I meet along the way, until I discover the custom faction as a neighbor. Eventually (presumably when it's trying to switch to their custom music), everything goes silent and no more music plays for the rest of the game. I don't hear the custom music at all in this scenario.
- I'm using the LUA that's been passed around in this thread to manually manage/stop the audio in certain situations.
- There are no errors in LUA.log, Database.log, or Modding.log

I suspect that what's happening is that my custom music is not recognizing when it's reached the end of the song, so it just sits there lingering on silence forever, never allowing the game to switch to another track.

I'm gonna continue to explore and fiddle with settings on my own, but if anybody happens to know the correct settings, or would be willing to share their Wwise project, I'd appreciate it tremendously.


Hi, I had that problem of going silent then I quitted to understand and nowadays I play sound myself. I only let the first ERA music play since the city is built. The moment I play is when ERA changes, I check that when a unit moves. Also with this, I also play War music, when a war happens.
 
Last edited:
This guide, linked by @actsukrit on twitter, was incredibly helpful, and covers a few tips not mentioned by this thread.

In case the link dies for any reason, I've backed it up on pastebin, as well: https://pastebin.com/7SAfitPt

Between this thread and that guide, my custom civilization's music is now mostly working. It always plays ancient era music when you play against the custom civ (it works fine when playing as the custom civ), and vanilla BGM doesn't yield to the custom diplo music. I'll update this post if/when I figure those issues out.
 
Last edited:
Alright, hopefully my final bump to this thread. I've got a solution working pretty much perfectly, and I wanted to share the last piece of the puzzle for future modders.

After getting my custom civ's music working (following the various tips and guides in this thread), the only remaining bug I encountered is that the vanilla overworld music wouldn't fade out for my custom civ's diplomacy screen, so the music would be layered on top of each other.

Fortunately, there's a very simple bit of LUA (which must be called in a UI context) that solves this problem:

function OnOpenDiplomacyActionView(otherPlayerID)
local playerConfig:table = PlayerConfigurations[otherPlayerID]
local leaderName = playerConfig:GetLeaderTypeName()

if leaderName == "LEADER_YOUR_LEADER" then
UI.PlaySound("Pause_Game_Music")
end
end
LuaEvents.DiplomacyRibbon_OpenDiplomacyActionView.Add(OnOpenDiplomacyActionView);

function DiplomacyActionView_ShowIngameUI()
UI.PlaySound("Resume_Game_Music")
end
LuaEvents.DiplomacyActionView_ShowIngameUI.Add(DiplomacyActionView_ShowIngameUI);
 
Last edited:
I would like to ask. After my music is played in game, why there will be no more music and remains silence for the rest of the game?
 
I would like to ask. After my music is played in game, why there will be no more music and remains silence for the rest of the game?

Your looping settings probably need to be changed in Wwise. Here's what worked for me:

6Snkbn5.png


(Sequence Step, Loop Counts: Infinite / 1)
 
Idk if this is relevant, but if nobody will mind and ppl are still reading this thread scratching their heads on how the heck one should add music, I wanna throw out here the fact that I'm already working on a modding music template that other ppl can use, it's currently a work in progress (I'd say it's 50-70% complete as of now) and when I release it it should make adding music to your mod a lot easier
 
i give up ...how u people got Wwise_v2015.1.9 working ? after reinstall windows i can't run Wwise_v2015.1.9 instalation dosen let me install it ...and all my old music projects dosent work even if i repided them on available version Wwise_v2016 1.6
 
Back
Top Bottom