Extensive Modding Guide + Template

Extensive Modding Guide + Template

Introduction


Extensive Modding Guide + Template image 1

Extensive Modding Guide + Template image 2

Modding in Democracy 4 is very simple once you understand the basics, all you need is ~5-30 minutes, and hopefully, within this guide, you will understand everything you need to make your mod.

Before we start I would like you to keep something in mind, you need to put effort into anything if you want it to turn out good, so please don't get hasty, take your time and I'm certain it will turn out great!

Preparations


Extensive Modding Guide + Template image 6

Hold your horses, I know you wanna start but first, we need to get everything setup.

First off, you need a few things, you need a text editor, all systems come with one, but I suggest getting a new one, here my suggestions:

Notepad++ (Currently Using)

Sublime Text

Visual Studio Code

There are other ones but those are the best in my opinion.

Now we aren't done, you need to have an idea, name, description, thumbnail, and all of that done, make sure to make a folder for everything related to your mod(s) as well.

Creating Your Mod


Extensive Modding Guide + Template image 15

It's pretty easy to create your mod.

Go To Documents/My Games/Democracy4/mods . You may need to create the mods folder.

Create a Folder with your mods name.

Open the game.

Click on "Mods".

Go to "Create Mod".

Fill out the boxes, for the description box I suggest typing a place holder. Select the folder that you made.

Custom Names


Extensive Modding Guide + Template image 24

This is the easiest thing to mod, all you need to do is make a file, fill it out, then use it in a nation.

If you need to find names just google whatever background you need for the names, do remember you need Male names, Female names, and Family/Last Names.

Go to your mods folder then make a "data" folder. No ""

Open the "data" folder, create a text folder for example "UkrainieNames". No ""

Inside first add [maleforenames], [femaleforenames], [surnames], each on their own line and add names based on gender or if last name. No ,

Example:

[maleforenames]

Test

[femaleforenames]

Testa

[surnames]

Testy

Overrides


Extensive Modding Guide + Template image 38

Like adding names, overrides are pretty easy, create a file, edit it and done.

Go to /data/ then make a folder called "overrides". No ""

Inside add make .ini with name of your override, example Test.ini

Inside the .ini add [override] then in a new line add TargetName = "" and in a new line add HostName = "" in another new line add Equation = "" in a new line add Inertia =

The "TargetName" is the thing that will be modified.

The "HostName" is the trigger/cause for changing the "TargetName".

The "Equation" is the amount that the "TargetName" will be changed by, the number between () is the time while the stuff before it is the amount of change, which can be - or +.

Inertia Self-explanatory, 0 is the minimum and 1 I think is the maximum.

Here is an example:

[override]

TargetName = "GDP"

HostName = "AirlineTax"

Equation = "0.00-(0.1*x)"

Inertia = 0

Do note that all overrides in /data/overrides/ will change all nations, if you want it to be nation-specific then in the nation file in /data/missions/nationname/ add an override folder there.

Dilemmas


Extensive Modding Guide + Template image 55

Dilemmas are pretty much a 2-3 options issues/events that can influence your nation, this is the hardest thing yet but still pretty easy.

Open /data/ then make a folder called "simulation". no ""

In "simulation" create a folder called "Dilemmas". no ""

Inside create a .txt folder with your Dilemma's name.

Here is an example with explanation:

[dilemma]

name=DilemmaSystemName # This is the internal system name.

[influences]

0 = _random_,0.1,0.8 # This is what causes the dilemma, it can be anything pretty much, like IncomeTax or OilPrice.

[option0]

OnImplement = CreateGrudge(Equality,0.05,0.9);CreateGrudge(Liberal,0.05,0.9);CreateGrudge(Parents,-0.07,0.6);CreateGrudge(Conservatives,-0.05,0.9); # This is what happens if you select the first option.

[option1]

OnImplement = CreateGrudge(Equality,-0.05,0.9);CreateGrudge(Liberal,-0.05,0.9);CreateGrudge(Parents,0.07,0.6);CreateGrudge(Conservatives,0.05,0.9); # This is what happens if you select the second option.

[option2]

OnImplement = CreateGrudge(Equality,0.05,0.9);CreateGrudge(Liberal,-0.05,0.9);CreateGrudge(Parents,0.07,0.6);CreateGrudge(Conservatives,-0.05,0.9); # This is what happens if you select the third option, you can have 2 or 3 options.

This needs a /translations/ file too.

And make sure to not add # and everything after it, they are to explain everything.

Go to your mods folder and create a folder called "translations". no ""

In "translations" make a folder called "English", if you want other languages then check the official translations guide. no ""

Inside "English" make a .csv file called "dilemmas", you can edit .csv files with notepad or your text editor of choice. No ""

Open "dilemmas.csv". No ""

Follow the following example (This is from one of my mods):

#,TerroristAttack,Terrorists Attack Moscow Theater!,"60-70 terrorists attacked a Moscow theater, we have been told that at least 800 hostages have been taken, the terrorists have many explosives inside, Our Spetsnaz Forces, SOBR, Police, And FSB are ready to storm the building and take down the threat, Or we can give in to the demands of the terrorist.",

#,TerroristAttack_0,Given In To Demands,"Ivan Petrov, Your trusted prime minister says, These terrorists have no fear of killing every one of those hostages and fight to the last man, we should give in to their demands so we can avoid losing many lives.",

#,TerroristAttack_1,Storm The Building,"Your Minister of Defence, Army General Victor Molotov, Says, We Simply Cannot throw down our weapons and give up! what do you think the other superpowers will say? do you think that will stop other terrorists from doing the same? We must storm the building at once!",

Do note if you want a third option you need to add TerroristAttack_3 so you can have that third option work.

Events


Extensive Modding Guide + Template image 83

Events are things that happen without your control, mostly, depending on the influences of the event it can happen randomly or it can happen because your military budget, and it can happen because another event happened, it's pretty close to dilemmas but without choices.

It's also pretty close to making dilemmas.

Open /data/ then go to /simulation/.

Create a folder called "events". No ""

Inside "events" create a .txt file with your event's name. No ""

Inside your event(s) follow the example below.

[config]

Name = Test # This is the system name.

Texture = Test.png # This is the image, put yours in /bitmaps/events.

GUISound = Test.wav # This is the sound, put yours in data/sound

OnImplement = CreateGrudge(Capitalist,-0.050,0.70);CreateGrudge(GDP,-0.030,0.75);CreateGrudge(BusinessConfidence,-0.15,0.75); # This is the changes that happen.

[influences]

0 = _random_,0,0.24 # Again this is chance it happens.

Again this needs a translation file.

And make sure to not add # and everything after it, they are to explain everything.

To finish your events like I already said events need /translations/ files. (Just one for each)

Open /translations/.

Inside create a .csv file called "events". No ""

In events.csv you must follow the example below.

#,Test,Test Event!. "Test."

The first part is the system name, the second part is the headline you will see for the event, and the last is the long text for it.

Here is a real example from an event for a mod of mine.

[config]

Name = AirAccident

Texture = AirAccident.jpg

GUISound = DM4_Plane Crash.wav

OnImplement = CreateGrudge(GDP,-0.01,0.70);CreateGrudge(_All_,-0.01,0.70);CreateGrudge(MilitarySpending,0.02,0.30);

[influences]

0 = _random_,0.3,0.5

2 = MilitarySpending,0+(0.20*x)

#,AirAccident,Air Accident!,"One of our military cargo planes transporting equipment and vehicles have crashed for unknown reasons, We have started an investigation into the matter, We should have a report sent to our top military personal as soon the investigation is done..."

Like I already said, events have no choices so no AirAccident_0 or whatever.

Countries


Extensive Modding Guide + Template image 117

Creating a custom country might be the hardest thing to do, because it needs a lot of changing and balancing until you get it right, in one of my mods I have 24 custom countries, and I had my mod for a whole year and they still have issues, it mostly because I'm going for realism.

If you are making a real country then it needs a lot of research that can take days, your best hope is people that play the mod that is in that country to correct stuff for you, if not then start researching, but of course, you can just have the countries then patch them until they are done.

Before we start my way of making countries is copying a base game nation's files that are closest to the nation I want to make, for example, to make China the US is pretty close in GDP/Debt aspects and a few things like population.

So lets start!

Open /data/ then make a "missions" folder. No ""

Inside "missions" create a folder with your nations name. No ""

Inside your nations folder in data/missions/ create a .txt with your nation's name.

Open the .txt then follow the example below.

[config]

currency = "Tst" # Pretty simple, you have symbols too.

population = 26071 # This is a bit annoying because this is not 26071 people it's like 1000000 or something.

economic_cycle_start = 0.2 # Pretty much useless

min_income = 0 # Always 0 here.

max_income = 150000 # The higher the richer someone can be, doesn't mean you will have more rich people but richer rich people.

name = Testy # This is the internal system name, should be the same of this .txt file and /data/missions/ folder and /translations/missions/ file.

names_file = "data/names/turkishnames.txt" # This is the names that will be used for the country.

flag = "flag_Testy.png" # This is a circle flag of the country, 512x512 or 500x500 works best.

map = "map_Testy.svg" # This is the outline map for the country, basicily the blue thing when you start a new game and select a country.

GUID = 2 # This is where the country will be, 0 us first and 999999 is last I think, you can as well have countries with the same number and the game will sort them by letter.

fx_rate_to_pound = 1 # This is pretty much all numbers on your screen, unless your going for realsim leave to 1.

apathy = 0.33 # This is the voter turn out of your country.

starting_debt = 585000 # This is the debt that you need to pay before having a money reserve.

min_gdp = 440000 # This is controls the graph with the GPD crap and the GDP thingy for your country.

max_gdp = 1240000 # if this is too high compared to min_gdp then your country will be poor until you fix it.

wealth_mod = 2.9 # This again is just for realism, pretty much meaning what most people can buy with their money or some crap.

[policies] # Now this is again is mostly about realism about if it as well is all about your Income and defiest, 0 is the lowest policy amount and not having the policy means it not implamaneted, 1 is max.

AbortionLaw = 0.75

AgricultureSubsidies = 0.7

AirlineTax = 0.1

AlcoholLaw = 0.50

AlcoholTax = 0.55

ArmedPolice = 0.5

ArtsSubsidies = 0.15

BorderControls = 0.35

BusLanes = 0.5

BusSubsidies = 0.25

CarbonTax = 0.27

CCTVCameras = 0.2

CharityTaxRelief = 0.25

ChildBenefit = 0.62

CitizenshipTests = 0.65

CompulsoryFoodLabelling = 0.7

CorporationTax = 0.45

DisabilityBenefit = 0.48

ExecutiveTermLength = 0.5

ExecutiveTermLimit = 0.24

FoodStandards = 1

ForeignAid = 0.20

FreeSchoolMeals = 0.25

GameHunting = 0.85

GenderTransition = 0.2

HandgunLaws = 0.4

IncomeTax = 0.55

InheritanceTax = 0.42

IntellectualPropertyRights = 0.20

IntelligenceServices = 0.33

JudiciaryIndependence = 0.95

LabourLaws = 0.28

LegalAid = 0.65

MarriedTaxAllowance = 0.1

MaternityLeave = 0.35

MicrogenerationGrants = 0.25

MilitarySpending = 0.52

MinimumWage = 0.55

Narcotics = 0.32

PayrollTax = 0.1

PetrolTax = 0.08

PoliceForce = 0.3

PressFreedom = 0.95

PrisonerTagging = 0.25

PrisonerVoting = 1.0

PrisonRegime = 0.3

Prisons = 0.65

PropertyTax = 0.39

RaceDiscriminationAct = 0.8

RentControls = 0.1

RetirementAge = 0.33

RightToDie = 0.5

RightToPrivacy = 0.5

RoadBuilding = 0.42

SalesTax = 0.28

SchoolBuses = 0.75

ScienceFunding = 0.3

SelectiveSchooling = 0.6

SmartMeterProgram = 0.25

SocialCare = 0.18

TechnologyGrants = 0.18

TobaccoTax = 0.25

UnemployedBenefit = 0.75

WorkSafetyLaw = 0.67

# These I think control some events or policies pretty much for realism too.

_prereq_has_coast = 1

_prereq_mining_industry = 1

_prereq_land_border = 1

_prereq_poachers = 1

_prereq_indigenous = 1

_prereq_sovereign_currency = 1

# These are stuff that you can change as a player when you start a new game as this country but again it's not realism.

[options]

Again don't add # or anything after it.

Once more this needs a /translations/ file.

Let's do the /translations/ file now.

Open /translations/ then /English/.

Inside /translations/English/ create a "missions" folder. No ""

Inside "missions" create a .txt folder with your nations name. No ""

Open the .txt and follow the example bellow.

[config]

name = Testy # This is the internal system name, it needs to be the same for all places, from the data folder to the .txt name here.

guiname = "The Testy Union" # This is the in-game name, it can be anything you want.

description = "Very Testy" # This is the description in-game when you press start new game.

jobtitle = "Head Testy" # This is how you will be addressed, you can as well add your name of example, Like Supreme Leader Jack, Haven't tested it but it should work.

[stats] # This can be anything, but it needs the format of Something: = "Something".

Head Testy: = "Jack"

Again don't add # or anything after it.

Here's an example from my latest country from my mod.

[config]

currency = "€"

population = 10600

economic_cycle_start = 0

min_income = 0

max_income = 150000

name = nth

names_file = "data/names/dutchnames.txt"

flag = "flag_nth.png"

map = "map_nth.svg"

GUID = 1

fx_rate_to_pound = 1.20

apathy = 0.82

starting_debt = 434931

min_gdp = 912241

max_gdp = 1440000

wealth_mod = 2.5

[policies]

No space for this sadly.

_prereq_has_coast = 1

_prereq_royal_family = 1

_prereq_land_border = 1

[options]

MULTIPLEPARTIES

Here's the /translations/ File

[config]

name = nth

guiname = "Netherlands"

description = "The Netherlands, informally Holland, is a country located in Western Europe with territories in the Caribbean. It is the largest of four constituent countries of the Kingdom of the Netherlands. In Europe, the Netherlands consists of twelve provinces, bordering Germany to the east, Belgium to the south, and the North Sea to the northwest, with maritime borders in the North Sea with those countries and the United Kingdom. In the Caribbean, it consists of three special municipalities: the islands of Bonaire, Sint Eustatius and Saba."

jobtitle = "Monarch"

[stats]

National Anthem: = "I will maintain"

Population: = "17.4 million (2020)"

Area: = "41,865 km2 (16,164 sq mi)"

Currency: = "Euro (EUR)"

GDP: = "$1.012 (~EUR844452000000.00 EUR)"

GDP per capita: = "$58,003 (~EUR48980.75 EUR)"

Democracy Index: = "~9.66/10 (9st)"

Biggest Industry: = "Agriculture And Food Industry"

Capital And Largest City: = "Amsterdam"

Driving side: = "Right"

Calling code: = "+31"

Policies


Extensive Modding Guide + Template image 276

Policies are pretty easy, well until it comes to their effects, that's when it's pretty easy to mess up, although as long as you are careful it should be fine.

So let me first explain a few things, a policy is pretty much something that you can have since the start of the game, something that cannot be canceled, or it's optional.

Let me explain a policy from a mod of mine.

#,mpt,default,,,13,18,9,9,FOREIGNPOLICY,,15,110,0+(1.0*x),,16,0,120,0+(1.0*x),,,#Effects,"Capitalist,0.02+(0.1*x)","Poor,0.05+(0.05*x)","Socialist,0+(0.20*x)","PovertyRate,0-(0.10*x)","_LowIncome,0+(0.17*x)","_MiddleIncome,0.08*(x^2)","Environmentalist,0-(0.09*x)","Conservatives,0-(0.05*x)",,,,,,,,,

The first part or "mpt" is the name.

The "default" is the slider that will be used ( you can make your own ).

After that are the flags which will be listed below.

Then you got opposites which are pretty much is a policy that is the total opposite I think, meaning you can only have one or the other.

After that is "introduce" (13 in this case) which is the initial cost to getting the policy.

Right after that we have "cancel" (18 in this case)it's the cost to cancel the policy.

Now we got "raise" and "lower" (both are 9 in this case) these are the cost to increase the slider or lower it.

Afterwards it's the department/policy group of the policy (which is FOREIGNPOLICY in this case) they are listed below.

And prereqs are stuff required to get said policy, again they will be listed below.

The mincost and maxcost (Which are 15 and 110 respectively) are self-explanatory it's the max cost that raising something or lowering will be, and it's controlled by the slider.

The costfunction (0+(1.0*x) in this case) and cost multiplier are pretty much how fast the cost will rise.

After that is implementation (16 in this case) it's the time it takes for it to fully be done or implemented.

Then you got minincome and maxincome (Which are 0 and 120 respectively) again easy to understand, it's the amount of money you get, here is how you get infinite money if you want.

After that is incomefunction (0+(1.0*x) in this case) and incomemultiplier they are the same as before.

Finally you got effects these are pretty much everything that can be changed, this will take too long to explain instead check out the official guide or just copy other stuff or even learn it yourself.

Here are the flags.

UNCANCELLABLE

MULTIPLYINCOME

These Are The Departments/Policy Groups

FOREIGNPOLICY.

WELFARE.

ECONOMY.

TAX.

PUBLICSERVICES.

LAWANDORDER.

TRANSPORT.

This is the prereqs list.

_prereq_canada = 1

_prereq_germany = 1

_prereq_southkorea = 1

_prereq_uk = 1

_prereq_eu = 1

_prereq_has_coast = 1

_prereq_land_border = 1

_prereq_mining_industry = 1

_prereq_nuclear_tech = 1

_prereq_wmd = 1

_prereq_sovereign_currency = 1

_prereq_reserve_currency = 1

_prereq_deadly_animals = 1

_prereq_whaling = 1

_prereq_indigenous = 1

_prereq_royal_family = 1

_prereq_poachers = 1

_prereq_hurricane = 1

_prereq_tsunami = 1

_prereq_earthquake = 1

Simulation


Extensive Modding Guide + Template image 329

The Devs did a very good job explaining this one, if there is a lot of people that need this explained then I will do it.

Updating Your Mod


Extensive Modding Guide + Template image 332
Extensive Modding Guide + Template image 333
Extensive Modding Guide + Template image 334

Updating your mod is pretty much the same as creating it but it's easier, although your mod's description will not be fully transferred to the updated version thanks to either steam or the game devs.

So you either need to rewrite it each time or just make a .txt file with your description which you need to update every time you change your mod's description, thanks to steam and or game devs.

Let's begin.

Open the game.

Go to "Mods". No ""

Go To "Update Your Mod". No ""

Fill out everything after selecting your mod on the right side.

Viewing Your Mod


Extensive Modding Guide + Template image 343
Extensive Modding Guide + Template image 344
Extensive Modding Guide + Template image 345

If you don't have a steam overlay or just didn't pay attention or whatever the reason you didn't see your mod's workshop page then follow these simple steps.

Open steam (should already be).

Click on Democracy 4. Click on Workshop. Hover over "Your Files". No ""

Click on "Files you've posted". No ""

Final Notes


Extensive Modding Guide + Template image 351

So 23,314 letters and 499 lines later and a few hours (for me at least) and we are done!

I hope now you can make your mod empire in D4, but don't worry, is something not working? got an issue? I made a guide just for that, and not just that, I will provide support with any issue your mod may have, I will sub to your mod and test it myself, and if you wish I can send you the fixed version or just type the fix it for you.

Here's the link for that:

https://steamcommunity.com/sharedfiles/filedetails/?id=2555053283

And I'm not done, if you want to make a mod with me as a contributor that can happen too, just make sure to add me and let me know.

So please be careful while modding and make sure to have a backup just encase, I hope you have a wonderful day or night.

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2570491222					

More Democracy 4 guilds