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

Wave

Rocker moth
61 Badges
Sep 12, 2009
946
34
  • Europa Universalis IV: Wealth of Nations
  • Semper Fi
  • Crusader Kings II
  • Europa Universalis: Rome
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Victoria 2: A House Divided
  • Magicka
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Rome: Vae Victis
  • Europa Universalis III Complete
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Reapers Due
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Field Marshal
  • Imperator: Rome Sign Up
  • Crusader Kings II: Monks and Mystics
  • BATTLETECH
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Magicka 2
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • Steel Division: Normand 44 Sign-up
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
Hello world!

It's been almost two years since I posted my first modding guide related to adding new nations into EU:Rome and ever since I've been planning on making a guide of modding generally. This is the second time I sit down and start writing so let's see can I get any better result than the last try which ended up to trashcan..

I'll try to make this guide very clear and maybe even use pictures this time but in case you find any unclear things please ask. I'm more than happy to help and fix this guide to be better.
This guide will advance in a little different order than the other guide but much of same basics are covered.

Events were the last thing I learnt to mod but they are your main tool in making the game interesting so they're very important. One of the big things that could make all EU games a lot better is global events so you could make every country have the same event at the same time but Paradox hasn't yet made it possible.

This guide will have two parts:
Part 1, this, which is my attempt to teach everyone how to read the code before starting to make one yourself.
Part 2, which is my attempt to create an event and describe how to make it work.

How to begin making a mod

If you are at all familiar with modding and know the basics of how to create mod folder and file you can skip this section

You need to create a new mod. That is not as big deal as it sounds.
Go to your Rome installation directory which if you haven't changed it is usually
C:/program files/Paradox interactive/Rome
Or in case you use 64bit system it is
C:/program files (x86)/Paradox interactive/Rome

You will see the folders, common, history, localisation etc. in there. Open the mod folder.

Create a new folder in there and name it whatever you like, this will be the name of your mod. I'll name this one simply guide2.
Now open notepad or some other text editing tool (Notepad++ is very good but I've found it very unstable on my computer so I'm currently using normal notepad which is pretty bad..)

You are currently creating the mod file. The game reads this file and then checks the folders to find your modded/added stuff.
It doesn't matter in which order the content of this file is but it's simple to have name on the top line and the rest below it.
The first line, the name, is the name that will be shown in the dropdown box of the launcher when you choose the mod so it shouldn't be very long. I'll use the name Event mod. And as the only thing we will be doing with this mod is adding new event so there doesn't need to be more than two lines. The second line will make the game check our events.
The mod file should look like this:

Code:
name = "Event mod"
extend = "events"

Once this is done you need to save it. Notepad will offer you a chance to save it as a .txt file but it doesn't work so you need to choose "all file types" from the dropdown box and write .mod in your file. The mod file needs to have the exact same name as the mod folder so despite the mod name saying event mod the folder is named guide2 so the file has to be guide2.mod in order to work.

I know it's in Finnish but that should give a small idea of what I'm talking about.
saveas.png


Save the mod file and open your mod folder. It is currently empty which is rather sad, let's give it something to hold. Create a folder named events and open it. Create a text file in the folder (right-click, create file) and name it whatever you want. These file names aren't used by the game so they can be whatever (not sure if Ä and Ö are fine so I'd suggest avoiding them) you want. I'll name this one modded_events


Understanding the code

Before starting to create our own event I'll use an existing event and literally explain how it works line by line. Prepare for huge wall of text.

This event

RomeGame2012-11-0513-32-10-98.jpg


In the code looks like this:

Code:
# Stolen Cargo
country_event = [color="#FF00FF"]{[/color]

	id = 2902

	[color="#FF7070"]trigger = {
		ruler = { not = { traits = foolish } }
		num_of_ports = 1
		any_character = {
			has_office = naval_tech
			not = { traits = wounded }
			or = {
				traits = stressed
				traits = jealous
				traits = rash
				traits = ambitious
				traits = cold
				traits = arrogant
				traits = shrewd
				traits = deceitful
				traits = selfish
				traits = vengeful
				traits = corrupt
				traits = lapsed
			}
		}
	}[/color]

	[color="#FFFF70"]mean_time_to_happen = {
		months = 240

		modifier = {
			factor = 0.9
			ruler = { wealth = 1000 }
		}
		modifier = {
			factor = 0.9
			ruler = { wealth = 500 }
		}
		modifier = {
			factor = 0.9
			ruler = { not = { popularity = 30 } }
		}
		modifier = {
			factor = 0.9
			ruler = { not = { popularity = 20 } }
		}
		modifier = {
			factor = 0.9
			ruler = { not = { popularity = 10 } }
		}
		modifier = {
			factor = 1.2
			ruler = { popularity = 90 }
		}
		modifier = {
			factor = 1.2
			ruler = { popularity = 80 }
		}
		modifier = {
			factor = 1.2
			ruler = { popularity = 70 }
		}
		modifier = {
			factor = 1.2
			ruler = { traits = generous }
		}
	}[/color]

	[color="#7070FF"]title = "EVTNAME2902"

	desc = "EVTDESC2902"[/color]

	[color=#70FF70]option = {
		name = "EVTOPTA2902"					# I'll be needing a new shipwright very soon
		random_list = {
			65 = {
				random_character = {
					limit = { has_office = naval_tech }
					death = yes
				}
			}
			35 = {
				random_character = {
					limit = { has_office = naval_tech }
					add_trait = wounded
				}
			}
		}
	}
	option = {
		name = "EVTOPTB2902"					# I'm pretty sure it was someone else
		random = {
			chance = 70
			ruler = {
				add_trait = foolish
				add_trait = trusting
			}
			random_character = {
				limit = { has_office = naval_tech }
				wealth = 500
			}
		}
	}
[color="#FF00FF"]}[/color][/color]


This is one of my favourite events, mainly because it created a great story for my current AAR, it has many good examples and while writing this guide I learnt a few things that I didn't know before...

The top line is a comment line. Comment lines do not affect the code anyhow so you can write anything in them. To create a comment lines add # symbol. Everything after it is read as comment so you can use them after functions as well like is done here in the option lines. I suggest adding a comment line and the event name above every event because otherwise later when you have a huge mod with several events you have no idea of which one you want to find.
The second line starts the whole event. country_event means that it will use country scope as default in this event. All the code should be entered between the pink opening and closing brackets. The word scope is used to explain what is the event checking, it can also use province and character scope. More about this later.
ID is pretty obvious. It is the unique number of this event. When making events you must make sure that no other event uses your ID so I suggest starting from 9000 or above. The default event IDs are below that. I haven't tested how great value the ID can have but I've seen event IDs over 700000 so you shouldn't run out of IDs.


The red part of the code is the trigger. The trigger obviously triggers the event, so let's see what is required to make this event happen:
Ruler must not have foolish trait. Here the scope is temporarily switched to character scope with the ruler = {} function. Everything inside those brackets are related to the character.
Your country must have at least one port. all num_of triggers mean the smallest required value, as an example num_of_cities = 2 means that you must have at least 2 provinces but the line doesn't give any limit. Limits can be applied with the usage of AND & NOT booleans, more later.
any_character line switches the scope back to character scope and checks the following things:
Is anyone in the naval tech research job?
Does he have trait wounded? If not it will allow triggering. (This is weird because in my AAR it happened to a wounded character...)
OR lists check if any of the listed things are true. AND lists require all of the listed things to be true.

Summary: If our ruler does not have the trait foolish, our country has at least one coastal province and If our character who is a shipwright is not wounded and has the trait stressed and/or any of the other traits listed this event will trigger.


The yellow part is the clock that starts ticking once the event is triggered. This event will trigger approximately 240 months (20 years) after the trigger conditions are met. However you should not trust the mean_time_to_happen if you're making accurate timer because it has pretty big +/- percentage. As an example an event that has mtth of 1 year can trigger after half a year or after one and a half year.
Below those lines are modifiers that change the mean_time_to_happen. These modifiers aren't required to make the event work so personally I don't use them very much. These are however pretty simple:
First modifier: mtth is 0.9, 90%, of the old value which means it will happen 10% (24 months) sooner IF the ruler has wealth over 1000.
Last modifier: mtth is 1.2, 120%, of the old value which means it will happen 20% (48 months) later IF the ruler has the trait generous


The blue part is only text. title obviously means the title of the event. Original Paradox-made events have all names and descriptions in localisation files and they just use the short texts here. I don't like doing it like that and I write the event names and descriptions right into the event file so in the title file I'd have title = "Stolen Cargo" (which is the title of this event) instead of title = "EVTNAME2902" (comes from Event Name event #2902). The title is the text shown on the red background in the events.
desc means the description of the event, the long text in the event box. I don't know the exact character amount but you can't have very long texts inside it or the game crashes. Example: desc = "Your shipwright is accused of stealing cargo from your ships"
In this part of the event: DO NOT FORGET the quotation marks " " in the beginning of the text and in the end of the text! Otherwise you'll never see your event happening.


The green part of the event is the option part. This part makes the things happen and gives you choises.
You always start with the line option = {. There can be as many options as you want and the game creates as many buttons in the event box.
Below it is name = which is the text in the option button in the event box. Here it is EVTOPTA2902 but you can see the comment line after it showing what the localisation file has: I'll be needing a new shipwright very soon. You can write this in the quotation marks after the name = so no localisation required.
Next line says random_list = {. Paradox events have 2 random options, random = { and random_list = {. In this event you can see them both being used.

This is my own quick conclusion so don't take this as a die hard fact:
Everything inside the random_list = { always have 100% total chance. In this event you can see the 65 = { being the first possibility. It means that whatever comes after it has 65% possibility of happening, below it is 35% possibility and these together create the total of 100%. In random_list one of the options always happens.
random seems to be able to go below or over the 100%. In the B option of this event you can see chance = 70 line which means the following things have 70% of chance to happen, so there is 30% chance of nothing happening.

Interesting fact: Randoms and % chances work pretty nicely in EU:Rome and you may go against all odds and the 10% chance may happen when you expect it the least but in EU3 (at least In Nomine and Heir to the Throne) you will always get the first option if it has greatest chance which then allows you to spam (and abuse) certain things without worrying..

Now let's go back to the option A..
You can see a line random_character = { and maybe wonder what is that for.
All scope changes that were done in the trigger part begin with any_ (i.e. any_province, any_character) but in the option part it is replaced with random_ (random_province, random_character) and after that you need to limit the scope. Here the code takes a random character, then limits the search to only the naval tech research guy and once he is found he is killed. Rather dramatic.
In the 35% chance the same happens but he will get the trait wounded instead of dying.

In the option B there is 70% chance that your ruler will get traits foolish and trusting while your shipwright will gain 500 wealth.


One good place to learn about modding is Descartes' mod guide which I've been using a lot but I think there are some points that aren't exactly right.
 
=== Reserved for the actual guide part ===

Edit 4.12:
Apologies for the delay, I've been busy but I can promise the guide coming within a week or two..
 
Last edited: