Music modding

From Hearts of Iron 4 Wiki
Jump to: navigation, search

Adding your music file[edit]

  • 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. We will name our file my_music.ogg for example.

music = {
  name = "my_music"
  file = my_music.ogg
  volume = 0.65
}

Don't forget to save the file.

Conditions[edit]

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 = my_music"
  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.

Modding
Documentation EffectsTriggersModifiersScopesLocalisation
Scripting AIBookmarksBuildingsCosmetic tagsCountriesDivisionsDecisionsEquipmentEventsIdeasIdeologiesNational FocusesResourcesTechnologyUnits
Map MapTerrainStatesSupply areasStrategic regions
Graphical InterfaceGraphical Assets
Cosmetic PortraitsNamelistsMusicSound
Other Console commandsTroubleshootingMod structure