Difference between revisions of "Music modding"

From Hearts of Iron 4 Wiki
Jump to navigation Jump to search
m
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Version|Timeless}}
 
 
== Adding your music file ==
 
== Adding your music file ==
{{SVersion|Timeless}}
+
{{Version|1.6}}
  
 
*Your music file should be in *.ogg format and put into the music folder of the game. You can find a lot of online converter on Internet.
 
*Your music file should be in *.ogg format and put into the music folder of the game. You can find a lot of online converter on Internet.

Revision as of 17:43, 12 June 2019

Adding your music file

  • Your music file should be in *.ogg format and put into the music folder of the game. You can find a lot of online converter on Internet.

Open the music.asset (/Hearts of Iron IV/Hearts of Iron IV/music/music.asset). In this file you'll add your music into the game. In this example we will name our file new song.ogg. The ID of the music file (A New Song) can't be longer than 63 characters (the german mutated vowels like ä, ü and ö count as 2 characters) or the file will fail to load at the start of the game.

music = {
  name = "A New Song"
  file = "new song.ogg"
  volume = 0.65
}

Don't forget to save the file.

Conditions

Your music is technically added to the game, but now you have to define the conditions needed for your song to be played. Open the songs.txt (/Hearts of Iron IV/Hearts of Iron IV/music/songs.txt).

  • The conditions use the same format as events, focuses, etc.

For our example, we want that our music be played only if we play a democratic peaceful USA (at the same time) :

music = {
  song = "A New Song"
  chance = {
    modifier = {
      factor = 2
      has_war = no
      TAG = USA
      has_government = democratic
    }
  }
}

Now your music is fully and properly added to the game and will be played if you play a peaceful, democratic USA. You can use almost all conditions. Don't forget to save once again.