• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

podcat

Game Director <unannounced>
Paradox Staff
12 Badges
Jul 23, 2007
12.811
38.516
  • Europa Universalis IV
  • Hearts of Iron III
  • Semper Fi
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: Pre-order
  • Hearts of Iron II: Beta
  • Europa Universalis: Rome Collectors Edition
  • Mount & Blade: Warband
  • Paradox Order
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Together for Victory
Hello again, I'm doing an extra diary because I forgot talk about modding and technical things in the last diary. So if all you want to do is play the new expansion you can probably stop reading here, this diary is for modders!

Anyone still here? Good!

New Expansion Format
One of the big things we have done is make sure that installing the new expansion doesn’t stop you from accessing the old expansions and DLC. This means you can still play For the Motherland with Dies Irae - Götterdämmerung and Stars and Stripes etc if you so wish. The expansion is now installed in a sub-folder named "tfh" which contains all the new files and ensures it doesn’t mess up any of the old files.

New Modding Format and Directory Structure
People who have played CK2 or Victoria 2: A House Divided are already familiar with our new format and structure. Now it's time for Hearts of Iron to get the same treatment. The advantage of the new structure is that it moves all user settings to your personal Documents folder (stopping any issues with windows UAC), lets you run multiple mods at the same time from the launcher and save custom settings and file caches for each one (so mods that do a new map doesn’t require you to copy the game folder or rebuild the map each start up). Most importantly it makes it easier for us to support modding and DLC in the future.

So, let's get down to the gritty. Here is how to make a mod:

To make a mod create a file in this directory named with a .mod extension.
If there are more files supplied it is best to put them in a sub-folder with the same name as your mod. Important to note is that all mods for TFH go in the tfh/mod directory.

Example in directory:
Code:
fun.mod
fun/

For this to work the "fun" directory must have a structure that mimics the base games.
So if you want to change a gui file you need to have the whole path as well, like so:

Code:
fun.mod
fun/interface/chat.gui

The fun.mod file would look like this:
Code:
name = "Fun example"
path = "mod/fun"


There are a couple more settings as well. Here is a full list:
Code:
name = "EXAMPLE" # name of your mod, shown in launcher
path = "mod/EXAMPLE" # location of your mod files. note that full path is needed
archive = "mod/EXAMPLE.zip" # if you want to put your mod files in an archive instead (wont load path)
user_dir = "EXAMPLE" # optional. creates a sub directory where settings/map cache/savegames etc can be safely written for your mod and not get mixed up 
replace_path = "events" # this replaces whole path instead of just adding files as normal. useful for directories where the game just loads everything
dependencies = {"another_cool_mod"} # this lets you control order of loading in case you build on top of another mod
 
Thank you sir for the bonus

So
dependencies =

Would be used if you make a sub mod of a mod?
 
Thank you sir for the bonus

So
dependencies =

Would be used if you make a sub mod of a mod?

yes, or a mod of a DLC for example. it basically ensures that they are loaded in the correct order if they change the same files.

Any new scopes\modifiers or effects?

For example, can we set lend lease percentage in a history file for a country or is that only handled by an events?

Also, can the mod directory now handle going further then one level directory for all folders

yes, basically the mods files must follow an identical structure to the files they replace, so if you replace gfx/anims/GermanSoldier.dds you must put it in tfh/mod/MyCoolUniformMod/gfx/anims/GermanSoldier.dds

there are new scopes used when scripting gainable traits where you can access combatants and leaders. it looks like this:
Code:
gainable_trait = {
	trait = urban_assault_specialist
	combat = land_combat
	hours_required = 705
	trigger = {
		terrain = urban
	}
}

Same goes for tactics, here is an example:
Code:
tactic_blitz = {
	trigger = {
		is_attacker = yes
		has_armour_unit = yes
		OR = {
			skill = 3
			trait = panzer_leader
			skill_advantage = 2
		}
	}
	
	base = 1
	picture = blitz
	countered_by = tactic_elastic_defence
	
	movement_speed = 0.5
	attacker = 0.25
	defender = -0.15
}
 
yes, or a mod of a DLC for example. it basically ensures that they are loaded in the correct order if they change the same files.



yes, basically the mods files must follow an identical structure to the files they replace, so if you replace gfx/anims/GermanSoldier.dds you must put it in tfh/mod/MyCoolUniformMod/gfx/anims/GermanSoldier.dds

there are new scopes used when scripting gainable traits where you can access combatants and leaders. it looks like this:
Code:
gainable_trait = {
	trait = urban_assault_specialist
	combat = land_combat
	hours_required = 705
	trigger = {
		terrain = urban
	}
}

Same goes for tactics, here is an example:
Code:
tactic_blitz = {
	trigger = {
		is_attacker = yes
		has_armour_unit = yes
		OR = {
			skill = 3
			trait = panzer_leader
			skill_advantage = 2
		}
	}
	
	base = 1
	picture = blitz
	countered_by = tactic_elastic_defence
	
	movement_speed = 0.5
	attacker = 0.25
	defender = -0.15
}

Well that's good to hear, hope it all works as intended cause as far as FTM total conversion mods cannot be installed using the mod directory due to this problem.

What about the technology folders not being able to "communicate" with each other except for specific one's? For example if I want a tech in naval doctrines to be dependent on a tech in theory I won't be able to do this but I can link any tech from the "Industry" folder to all other folders...

And last one, any chance of limiting nukes to human players only?
 
What about the technology folders not being able to "communicate" with each other except for specific one's? For example if I want a tech in naval doctrines to be dependent on a tech in theory I won't be able to do this but I can link any tech from the "Industry" folder to all other folders...

And last one, any chance of limiting nukes to human players only?

we might have fixed the tech folders, we did some work there. I dont remember exactly though. AI not wasting your nukes is in my bug list, its not fixed yet.
 
Is there an option to append content of modded file, without replacing original one? This might be useful for "unique" files, like event_modifiers.txt.

no, that would pretty much be impossible to do right for a general case
 
tactic_blitz = {
trigger = {
is_attacker = yes
has_armour_unit = yes
OR = {
skill = 3
trait = panzer_leader
skill_advantage = 2

Have I read panzer leader ? Is this example wrong or did Paradox finally salvaged a kind of panzer leader trait ?
 
New Expansion Format
One of the big things we have done is make sure that installing the new expansion doesn’t stop you from accessing the old expansions and DLC. This means you can still play For the Motherland with Dies Irae - Götterdämmerung and Stars and Stripes etc if you so wish. The expansion is now installed in a sub-folder named "tfh" which contains all the new files and ensures it doesn’t mess up any of the old files.

If the TFH files are all in a new sub-folder, does this mean we need to have the FtM 3.05 patch installed prior to adding TFH?

Thanks in advance for the info!
 
Have I read panzer leader ? Is this example wrong or did Paradox finally salvaged a kind of panzer leader trait ?
It's probably the new Battlemaster trait and it's name only got changed in localization. If I had to venture a guess based on what I know of those damnable file :D
 
Have I read panzer leader ? Is this example wrong or did Paradox finally salvaged a kind of panzer leader trait ?
No, they kept the original "internal" name, but the trait has been changed as described in the DDs
 
It's probably the new Battlemaster trait and it's name only got changed in localization. If I had to venture a guess based on what I know of those damnable file :D

No, they kept the original "internal" name, but the trait has been changed as described in the DDs

Yes I knew that was probably that. Just a faint hope or wishfull thinking...
 
Is there an option to append content of modded file, without replacing original one? This might be useful for "unique" files, like event_modifiers.txt.

no, that would pretty much be impossible to do right for a general case
Bother! That really screws up any "mod depending on mod" that changes these files. If a file like "event_modifiers.txt" is replaced, rather than appended, it really breaks the whole idea of having mods, indeed potentially DLC, be independent of one another.

I understand that it's probably a bit much for an expansion, but really ought to have been included in new games. Maybe for HOI4 - or possibly EU4?
 
no, that would pretty much be impossible to do right for a general case
I see, merging requires some sophisticated logic.
Modding of "common" folder can also be simplified by converting its logic from "hardcoded-filename-for-effect" to more general, "decision" folder style. So, you can create and name file whatever you like, as long its content enclosed in right scope ("event_modifiers = {...}" or "strategic_resources = {...}"). Just an idea.

On some other note, I really like the improvements of new expansion. You guys did a great job:)
 
no, that would pretty much be impossible to do right for a general case

I see, merging requires some sophisticated logic.
Modding of "common" folder can also be simplified by converting its logic from "hardcoded-filename-for-effect" to more general, "decision" folder style. So, you can create and name file whatever you like, as long its content enclosed in right scope ("event_modifiers = {...}" or "strategic_resources = {...}"). Just an idea.

On some other note, I really like the improvements of new expansion. You guys did a great job:)
That would appear to be an excellent suggestion - from this side of the code. I wonder just how difficult it would be from PDS's standpoint...? ;)
 
If I recall correctly, in CK2 that sort of thing was handled by replacing file with folder (I.E. folder called "religion" instead of religion.txt) and you could then add files to that folder in same fashion like adding new events, decisions or localisations. That sort of system would work for files like event_modifiers, as long as you only ever added new stuff. Editing existing ones would cause similar issues like having two events share same ID. However, files with fixed entries, like defines.lua or static_modifiers.txt could not really be handled that way.

In any case, changing that for TFH is probably a bit late by now...
 
Huzzah! Modding actually seems simple now.