HOI4 Dev Diary - Getting started with modding

  • 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.

Havebeard

Yes
Aug 11, 2015
710
2.012
Hi everyone,
As @podcat mentioned in last weeks diary he would attempt to trick into writing a little something about modding. It didn’t work, I wanted to do it all along, hah! This week I will talk a bit about how to get into modding and how we work with requests from modders. Next week I will go into some of the new stuff modders can expect in 1.3.3.

Getting into modding can seem like a pretty daunting task and we’ve received some questions about how to get started. A good first step is going to the User Mods forum and take a look at the Useful threads/information for modders. and the wiki. The Hearts of Iron Modding Discussion subreddit is another good place to find resources.
Ask others in the Modding - Quick Questions thread. It’s a great place to ask specific questions once you’ve gone through some of the tutorials. If no one else can help, I might even show up to answer a few questions.

Starting the game with the -debug enabled gives you access to the console, where you can write trigger_docs. This will print a list of possible trigger and effect with some sparse (programmer made) documentation to the game.log. Sometimes you can find things here that have not yet been documented on the wiki. From there, it all depends on what you want to achieve.
Another useful launch option is start_tag=GER, which loads up the game as the specified tag, skipping launcher and country selector.

Starting in debug mode also enables the glorious error dog, who will show up and bark your mistakes at you, like a mad drill sergeant. The dog is your friend, do as it says and strive to fix all your mistakes before committing your mod to steam. Start from the top and work your way down. Here I’ve done something horribly wrong in the Centre state file, so I CTRL+ALT+Right-Click, open the file and fix my mistake.
errordog.png


Once you’ve gotten into it a bit you will most likely stumble across issues that cannot be solved with the current script features. This is where I come in… maybe! Go to the wishlist thread see if there is already a request for what you are trying to attempt and if there isn’t, make a post describing what you want to achieve. Most of the things in this thread end up in the document below, aptly named by @podcat. We then go over the requests with the tech lead and decide what is possible to do. A lot of the requests we have gotten are for new triggers, basic effects, which is great. Other are basically new features, major core system changes or UI rework on a scale that is not modding, but making a new game.
document.png


A request could be:
‘I need a trigger for army experience’ (I can’t believe we don’t have this.).
‘I want to set state names with an effect’
‘I want the dynamic script flags EU4 has’
Etc etc.

Some will be implemented. Some will be rejected based on technical limitations. Some may even be planned for a future feature, in which case it really is worth waiting for the proper implementation by a team of programmers instead of just me.

Some of the recent additions include:
Code:
-Added console command: set_ruling_party <ideology group> - ideology group has shortcuts d f n c for vanilla HOI groups
-Added console command: add_party_popularity <ideology group> <value> - ideology group has shortcuts d f n c for vanilla HOI groups
-Added trigger has_full_control_of_state
-Added has_army_experience has_air_experience has_navy_experience triggers
-Dynamic state, country and global flags effect. set_global_flag = test_flag_@ROOT
-Added triggers for date days and value to flags
-Added modify_global_flag modify_country_flag modify_state_flag effects. Clearing script flags now removed them completely instead of setting value to zero
-Added timed script flags.

Exampletime:
You want to make a series of events where the German scientists goes celebrating after the fall of France.
Code:
set_country_flag = { flag = GER_drunk_scientists days = 120 value = 1 }
This sets a flag with the value of 1 that disappears after 120 days.

You can then use the flag as a trigger for a national focus that gives you something like the Bob Semple, or what else your drunken scientists would come up with.
Code:
modify_country_flag = { flag = GER_drunk_scientists value = 1 }
will change the country flag to 2, which you can then use to trigger something else. You can also see how long a flag has been set for and what date it was last set or modified.

You probably want to make you own tooltip though, since flags don’t generate proper tooltips at the moment. Proper tooltips for them might be a future request =)
Code:
custom_trigger_tooltip = {
    tooltip = GER_drunk_scientists_tooltip
    has_country_flag = GER_drunk_scientists
}

Hope this gives you an idea of how to get started and encourages more people to start modding Hearts of Iron.

Next week I will talk in detail about the new modding features that will be available in 1.3.3.

@podcat : Since people are probably curious about a little update from the rest of the team, we have been working on some optimizations to speed up late game a bit. Also don't forget to tune in at 16:00CET on www.twitch.tv/paradoxinteractive today where me and Daniel will be checking out the Kaiserreich mod in our series of mod highlights in World War Wednesday!
 
Last edited by a moderator:
  • 54
  • 20
  • 17
Reactions:
I think as well also needs to be said, don't be afraid to send known modders a Personal Message if they have done something that you want to do, or if they have done something obviously similar. Many of us old timers are usually pretty willing to give a helping a hand, and we are a hardly insular lot. While some of us are pretty lax in checking the modding help threads (I am hideously guilty of not poking my nose in there), a call out will almost always get some help.
 
  • 6
  • 6
Reactions:
Cheers for the DD Great Bearded One, and thanks for all your modding support :D.

On the by, I'm a huge fan of:

Code:
modify_country_flag = { flag = GER_drunk_scientists value = 1 }

I remember you teasing it in the wishlist thread - is this something that'll make it in for 1.3.3 (or is already in, in 1.3.2?) Will it work to increment downwards as well (so we can set the value to -1, or -3 or what-have-you)?

If so, I'm pretty sure just liberated my planned 'random chance' tech model from the vagaries of the MTTH system (in particular, the resetting of MTTH when reloading, which would have played havoc with the rate of tech progression depending on whether people played in long or short sessions) - so thank you very much :).

I'm also a huge fan of the "Not possible to add sub-equipment to ships/planes" being in yellow (it's gotta be better than red o_O). Very much a fan of what's in green as well (death to the AI's battlecruiser obsession!)

I think as well also needs to be said, don't be afraid to send known modders a Personal Message if they have done something that you want to do, or if they have done something obviously similar. Many of us old timers are usually pretty willing to give a helping a hand, and we are a hardly insular lot. While some of us are pretty lax in checking the modding help threads (I am hideously guilty of not poking my nose in there), a call out will almost always get some help.

On this note, cheers for all your help Zarathustra :). With the ability to adjust flag values, it means I can move the tech model back to on-actions without turning it into an arcane labyrinth of if statements and more flags than a Modern Day mod for HoI4.
 
  • 2
Reactions:
Cheers for the DD Great Bearded One, and thanks for all your modding support :D.

On the by, I'm a huge fan of:

Code:
modify_country_flag = { flag = GER_drunk_scientists value = 1 }

I remember you teasing it in the wishlist thread - is this something that'll make it in for 1.3.3 (or is already in, in 1.3.2?) Will it work to increment downwards as well (so we can set the value to -1, or -3 or what-have-you)?

If so, I'm pretty sure just liberated my planned 'random chance' tech model from the vagaries of the MTTH system (in particular, the resetting of MTTH when reloading, which would have played havoc with the rate of tech progression depending on whether people played in long or short sessions) - so thank you very much :).

I'm also a huge fan of the "Not possible to add sub-equipment to ships/planes" being in yellow (it's gotta be better than red o_O). Very much a fan of what's in green as well (death to the AI's battlecruiser obsession!)



On this note, cheers for all your help Zarathustra :). With the ability to adjust flag values, it means I can move the tech model back to on-actions without turning it into an arcane labyrinth of if statements and more flags than a Modern Day mod for HoI4.
modify_country_flag is a 1.3.3 thing.
 
  • 3
Reactions:
This is really neat that paradox take such a keen interest and engage with the modding community, helping to facilitate those modders so they can bring further good & out of the box thinking content, alternative time periods and alot more replayability from a single game, thats value for money, one day the student may out do the teacher, but wouldn't be possible without the help and support of paradox, this is a win win all round. Creative Assembly for a good time were still selling quite a few copies of Total War Medieval 2 because of the extremely well polished conversion Third Age Total War. Hopefully in good time, all these big mods currently out will continue to polish, and heart of iron 4 will have a bunch of flagship mods to boast and keep paradox on there toe's to keep leading and innovating.

Thanks Havebeard and to everyone else working in the trenches at paradox, and of course the modders, keep doing what your doing.
 
  • 4
Reactions:
Who is this @Havebeard fellow, and who has allowed him to post in the main forum? :mad:

:p
Yeah, he should be back doing what we tell he, aye Sleight? Slaving away day and night, adding those new triggers and effects we deem to be needed :D
 
  • 5
Reactions:
I am always amazed at how paradox games are moddable, few other series can claim such a title.

However, it can be a bit jarring to get into, even for a programmer like myself. Those DD are always welcome to give some insight on how modding works and evolves.

If it is okay to do some shameless publicity, I am also working on a GUI to help new modders get into the fray. It is still in its early beta stage, but I am always fixing things and adding features. Fell free to check it out!
 
  • 4
  • 1
Reactions:
Thank you for the guide :)
 
  • 1
Reactions:
Thanks @Havebeard !

In my limited experience of modding games Paradox has the best modding support and the whole HOI IV team has been great responding to modders with things like @Sideburnout releasing original 2d graphic assets to make modding easier & bring it it up to the quality for core HOI IV quality.

As has been pointed out the best place to start modding is looking around the modding forum. We are a friendly community and I think a bit more of a community than the Steam Workshops. I have had a great time working with my friends @Zarathustra_the & @Axe99 along with many others and even though we are often working on different projects we are working together to make HOI IV better.

We would like to help you but it is best to read up a bit first this will get you the basics and it is much easier to answer a specific question than general concepts. We often work to coordinate modding for a better player experience.

For the average player you should look into mods for the best gaming experience. We often do things the HOI IV Dev team cannot do because of the time needed or the ability to focus on one small area of WW II. Also while the Dev team make the game they think is best for the general audience, different modders have different visions of what they think the game should be and this may better fit your view of what you think HOI IV should be.
 
  • 2
  • 2
  • 1
Reactions:
I would really, really like an event effect that changes the composition of a specified division template, as well as an event effect that changes a division of a specified name from one template to another. Pretty please....
 
  • 3
Reactions:
Notepad++ and Sublime are both freely available. We don't use any other programs to do the scripting for a new focus tree.

Ah. I was mostly refering to tool with a gui; mostly because for me I suck at getting the X,Y placement on my own. :p
 
Ah. I was mostly refering to tool with a gui; mostly because for me I suck at getting the X,Y placement on my own. :p
Something like
Code:
        relative_position_id = AST_empower_the_workers
        x = 2
        y = 4
will position your focus relative to other focuses. This together with frequent reloading the game has more or less allowed me to place them as desired :).
 
  • 1
Reactions: