Hearts of Iron IV: Writing our civil war | Modding

Guide on how, how to write your own civil war event in any country and place this event, eg, into national focus.

 

Attention

This guide assumes, that you are already at least a little familiar with modding for HoI4. Otherwise, can recommend this guide: go to the guide. Everything is simple enough in it., which allows you to quickly get up to speed.

What i use?

For writing code (if you can call it that) I use “easy” code editor from Microsoft – Visual Studio Code (Not to be confused with the Visual Studio IDE).

You can also use Notepad++. This text editor is great for our purposes..

Simple civil war
Analysis of the simplest option

Consider the simplest way to start a civil war using the example of a national focus.

so, we have the following code:

start_civil_war = {
	ideology = democratic
	size = 0.5
}

Let's agree right away, what for convenience I will call start_civil_war function, and everything inside its curly braces (body) – arguments. P.S. further there will be other functions.

Let's analyze the code in order:

  • ideology – this argument points to ideology, which will start a civil war.
  • size – this argument indicates, how will it be divided already existing army between the parties to the conflict. In this example, the army will be divided 50/50.

If you put the code above into the national focus code, then everything will already work for itself. In this example, Democrats will raise a civil war and take half of the entire army of the country. Moreover, the territory, which they will take, will be random, like the new temporary capital (if the main one did not go to the rebels initially).

Here is an example of a working national focus:

focus = {
	id = EXA_example_focus
	icon = GFX_goal_unknown
	x = 0
	y = 0
	cost = 10

	completion_reward = {
		start_civil_war = {
			ideology = democratic
			size = 0.5
		}
	}
}

How do you see, the civil war function is placed in another function, which is triggered when focus is completed.

But it's clear, that this is too little. I would like more. Well then let's move on.

Add more conditions

Now consider the following code:

start_civil_war = {
	ideology = democratic
	size = 0.5
	capital = 226
	states = {
		137 192 196 197 200 203 221 226 259 227 228 
	}
}
  • capital – indicates the ID of the area, where the rebel capital will be located.
  • states – indicates the ID of the area / areas, who will be initially controlled by the rebels.

In this example, the area, who own the ID, located in the game on the territory of the USSR, or rather in Ukraine.

To find out the ID of the area I need, I used the page[hoi4.paradoxwikis.com] at the official Wiki HoI4 with a list of all areas in the game. But there are other ways too.

Outcome: now the rebellion will be raised in specific areas, and the capital of the rebels will be established in a specific area. It remains only to add this code to the focus code..

Small addition

You can also add inside start_civil_war line ruling_party = <name of ideology> what to change the ideology of the main part of the country (not rebels) to the specified by you. This line is much more important and useful., than it might seem at first glance.

A little conclusion

On this for the basic part – everything. Next, I will go outside the function start_civil_war and show you what other cool things you can do with the civil war.

Choosing a side in civilian life

So, how in the game there is a choice of side in the civil war? Why this should be discussed separately? Because, that developers from Paradox did not provide a separate function or argument, which would indicate, what the player is playing (or not playing) for the rebels.

Now I will try to explain how it works.. Let's take, for example, Germany's focus on overthrowing Hitler. Like everyone (those who, of course, played with the necessary DLC and “permeated” this trick) known, revolt is raised neutrals, but technically (in code) it doesn't look like this. Technically a revolt is raised fascists (under its own regime), and the country's ideology just changes to ideology neutrals.

Consider the code snippet (with my comments) from the event, which uses this focus, to be sure of my words:

set_capital = 55 # Перенос столицы основной части страны во Франкфурт
start_civil_war = {
	ruling_party = neutrality # Нейтралы становятся правящей партией
	ideology = fascism # Фашисты поднимают восстание
	size = 0.5
	capital = 64 # Берлин - столица повстанцев
	states = { 64 61 52 53 54 60 65 66 67 68 62 63 5 }
}

The path to the file with the given code: Hearts of Iron IVeventsWTT_Germany.txt

The whole problem is, that the player always plays on the other side, against which they rebelled. And the absence of the function of attaching the player to the necessary side of the conflict has to be bypassed in this way, ie. instead of an uprising of neutrals, raise a revolt of the fascists. This must be taken into account in the future..

We create additional divisions

If you want to add one of the parties to the map at the beginning of the civil war (or both sides) new divisions, then you first need to create a file in your mod folder on the following path: modnamehistoryunits

File, as I understand, can be named arbitrarily, but I would advise you to give meaningful names, like for example such a file for Germany: GER_German_Civil_War_neutrality.txt

This file contains templates for divisions, and then their location on the map.

Here is the code from the same file for Germany:

division_template = {
	name = "Landsturmregiment"
	is_locked = yes

	division_names_group = GER_Inf_01

	regiments = {
		infantry = { x = 0 y = 0 }
		infantry = { x = 0 y = 1 }
		infantry = { x = 0 y = 2 }
	}
}

units = {
	division = {
		name = "1. Landsturmregiment"
		location = 9655
		division_template = "Landsturmregiment"
	}
	division = {
		name = "2. Landsturmregiment"
		location = 3690
		division_template = "Landsturmregiment"
	}
}

The path to the file with the given code:
Hearts of Iron IVhistoryunitsGER_German_Civil_War_neutrality.txt

P.S. I have shortened some of the code with the placement of divisions, because. it is the same type and too long due to as many as 24 divisions. In the variant above, only 2 divisions.

In order not to stretch the guide, I will skip the details of creating divisions. But I will leave video link, where it is described in detail, but you need to understand at least a little English.

I will briefly say, what we need to know the province ID, in which we want to place the division (Yes, provinces, not areas). You can still use page[hoi4.paradoxwikis.com] on the official Wiki games.

Next, we include this file in the national focus code (but it could be an event) through a line:
load_oob = "GER_German_Civil_War_neutrality"
And that's it. Upon completion of the focus, it will execute the code in the given file.

This is what it looks like in a complete example inside a function. completion_reward:

completion_reward = {
        set_capital = 55
	start_civil_war = {
		ruling_party = neutrality
		ideology = fascism
		size = 0.5
		capital = 64
		states = { 64 61 52 53 54 60 65 66 67 68 62 63 5 }
	}
	load_oob = "GER_German_Civil_War_neutrality" # А вот и файл с нужным сценарием
}
From Ev1ls0n

Related Posts:

Be the first to comment

Leave a Reply

Your email address will not be published.


*