How to add custom music?

CocoBun

Chieftain
Joined
Nov 30, 2024
Messages
3
Hello everyone!

To make a long story short, I've decided to dive head first into the modding deep end and make my own civilization...

Thats the easier part thanks to Toussaint's guide and template... The hard part is following the music guide by FurionHuang. I put all the music together easily enough and made the soundbank... Everything after that is all mumbo jumbo to me.

Not only that, but after reading more... Apparently I can only have 4 Eras of music instead of the 7 I put together? Help!!!

(I would've posted under that thread, but I get nervous when interacting with other people's posts lol)
 
Yes, and the proper version.
I have the soundbank properly generated and everything, I just don't know how to properly implement it with all 7 tracks that I want, if I even can.
 
You can add as many as you want, I added 3 tracks for each era in my mod of Portugal Play without NFP Portugal

I remember that besides assigning to eras, it was kind of random to listen to it since the game defaults to changing music for the other Civs if you meet other Civs. So, in that case, with Lua coding, I play and stop what I want.

Edited: in that last version of my code if you don't find the music logic try this one: https://steamcommunity.com/sharedfiles/filedetails/?id=2796341847
 
Last edited:
Okay, so theoretically my 7 eras of music should work?

Is there a specific thing I need to code in order to properly implement the music, or will the civ engine recognize the soundbank?
 
In Lua, you know what ERA you are in, so you run your each era music for each era. What I remember is that you can make some events in the WWISE like Play and Stop for each era of music by ERA or by any group of music, at the time I created Music of War (with respective Play and Stop in WWise) and ran When at War (Event in Lua). Did you see my Steam mod files?
 
Download this version of my mod: https://forums.civfanatics.com/reso...ck-dlc-lusitânia.25478/version/28744/download

snippet of code
Code:
    if(iPlayerEra ==2) then
      UI.PlaySound("Stop_Ancient_Music_PORTUGAL");
      UI.PlaySound("Play_Classical_Music_PORTUGAL");
    elseif(iPlayerEra ==3) then
      UI.PlaySound("Stop_Classical_Music_PORTUGAL");
      UI.PlaySound("Play_Medieval_Music_PORTUGAL");
    elseif(iPlayerEra ==4) then
      UI.PlaySound("Stop_Medieval_Music_PORTUGAL");
      UI.PlaySound("Play_Renaissance_Music_PORTUGAL");
    elseif(iPlayerEra ==5) then
      UI.PlaySound("Stop_Renaissance_Music_PORTUGAL");
      UI.PlaySound("Play_Industrial_Music_PORTUGAL");
    elseif(iPlayerEra ==6) then
      UI.PlaySound("Stop_Industrial_Music_PORTUGAL");
      UI.PlaySound("Play_Modern_Music_PORTUGAL");
    elseif(iPlayerEra ==7) then
      UI.PlaySound("Stop_Modern_Music_PORTUGAL");
      UI.PlaySound("Play_Atomic_Music_PORTUGAL");
    elseif(iPlayerEra ==8) then
      UI.PlaySound("Stop_Atomic_Music_PORTUGAL");
      UI.PlaySound("Play_Information_Music_PORTUGAL");


for the war part
Code:
if (isWar > 0 and isWarMusicStarted == 0 and (isPeaceMusicStarted == 1 or isPeaceMusicStarted == 0)) then
      print("  WARRRRRR MUSIC" );
      UI.PlaySound("Stop_Music_PORTUGAL");
      UI.PlaySound("Stop_Ancient_Music_PORTUGAL");
      UI.PlaySound("Stop_Classical_Music_PORTUGAL");
      UI.PlaySound("Stop_Medieval_Music_PORTUGAL");
      UI.PlaySound("Stop_Renaissance_Music_PORTUGAL");
      UI.PlaySound("Stop_Industrial_Music_PORTUGAL");
      UI.PlaySound("Stop_Modern_Music_PORTUGAL");
      UI.PlaySound("Stop_Atomic_Music_PORTUGAL");
      UI.PlaySound("Stop_Information_Music_PORTUGAL");
      UI.PlaySound("Play_Battle_Preview_Leader_PORTUGAL");
      print(" WARRRRRR MUSIC ADDEDDDDDDDDDDD");
      isWarMusicStarted = 1;
      isPeaceMusicStarted = 0;
    end

    if (isWar == 0 and isPeaceMusicStarted == 0 and isWarMusicStarted ==1) then
      print("  PEACEEE PLAY" );
      UI.PlaySound("Stop_Battle_Preview_Leader_PORTUGAL")
      --UI.PlaySound("Play_Music_PORTUGAL");
      iCurrentGameEra = 1
      PlayMusicByEra(PlayerID);
      print("  PEACEEE PLAY MUSIC ADDEDDDDDDDDDDD");
      isPeaceMusicStarted = 1;
      isWarMusicStarted = 0;
    end
 
Top Bottom