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

Ober

Sir Anjin
20 Badges
Sep 15, 2009
650
384
  • Darkest Hour
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • For The Glory
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Deus Vult
  • Crusader Kings II
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Victoria 2
  • War of the Roses
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
Eventmaking Guide for Darkest Hour
Comic Sanz lolololo


Table of Contents:


1.) Introduction
*Words of Wisdom
*Things You Will Need


2.) Eventmaking - Basic Information
*Event files in general
*Where are event files stored?
*Linking event files
*Power of Hashtag


3.) General Event Syntax
*Header
*Triggers
*Dates
*Strings and Pics
*Actions
*Summary


4.) Advanced Eventmaking
*How to make decisions?
*Additional Header Stuff: Persistent
*Additional Header Stuff: Inventions
*Additional Header Stuff: All
*Additional Header Stuff: One_Action
*Triggering Events: Trigger Command
*Triggering Events: Save_Date
*Triggering Events: Flags
*Triggering Actions and Commands
*Explanation on specific commands


5.) General Words of Finishment

1.) Introduction

Words of Wisdom

People of Darkest Hour are in despair! They lack a good event guide and they cannot make a mods! How terribly wrong is that?

Well, actually it is kinda weird, since events are one of the easiest things in Europa engine. Just a tad tedious when you go with making massive descriptions and pictures on your own. Anyway it's fairly easy, until 3.) it kinda feels like I made a tutorial about making water boil. Coz it's this eaaseeh!

But then again, some of the people might be struggling with it, I personally struggle with loads of funny things (like using gas cooker, I always have feeling that everything will explode once I'll put lighter close to it), so well, some might be struggling with events. They are perfectly easy, and you can even procude them en masse, if you ain't lazy ass (like me) and you don't get stuck on writing nice, epochal, climatic descripctions (like me).

Also please take note that I tried to cover all I know about events in this guide. You should be good to go after finishing 3.), 4.) is more for spicing dem events up, and also, even if it says "Advanced", it's not really that advanced - it's just an additional stuff that could, and well, should be used at some point.

Once you're done with reading, you can go and check AC's post (#3), where he points out some mistakes (I mostly fixed them) and adds some more explanations. Do it!

To pippolo who know a thing or two on events - if there are any mistakes or typos, let me know instantly, maybe I've missed something. Since it's guide for the people, we want it to be the best guide right?

Let us proceed then. Okay?

Things You Will Need...

* Notepad ++ - Well, must-have for every cozy and fashionable modderu. No, seriously, it makes things so much better you gotta grab it (or another text editor more advanced than usual Windows Notepad, but not Word for god's sake!)
* Event Commands.txt file - You can find it in your Modding Documentation folder in main Darkest Hour directory. For me it's F:/Games/Darkest Hour/Modding Documentation - here you can find it, it contains all (or 99% at least) of event and trigger commands - a glorious reference file, makes things go much faster.
* Patience, Will, Eagle's Eye to quickly catch all stupid typos (N++ will do), and all other virtues needed to become Valiante Modderu.
* Beer, snacks, tartar sauce, whatever you fancy. Optional.

2.) Eventmaking - Basic Information

Sooo, if you wanna do dem events, you gotta keep some major points in mind - one should not be venturing into Modderland without handful of basic rules. And event files, they have a few important ones you gotta know. Really, just a very few:

Usually event files are located in Db/Events folder. So, no-mod Darkest Hour version has its events located in (your paths)/Darkest Hour/Db/Events.

Here you will find all fancy events used in vanilla, all of them in .txt format and with appriopriate names to know what's what. So, as you may know, in germany.txt file you will find events for Germany. In france.txt there will be events for...France, correct! Although of course it's not necessary to name files like that. If you'll name your event file Glorious Empire of Bukabuka Menhap Yongwa.txt and "link" it properly, it will still work. No problem. Just keep in mind that format for event files is .txt. I am not sure about other formats.

Just for the sake of reference - For the Glory (same as Darkest Hour but for EU2) reads both .txt and .eue files for events. Since both games are on Europa Engine you can alternatively try it, but that actually has no effect whatsoever. Stick with .txt and you'll be fine.

*If you want to look for Darkest Hour Full's events, you look for the same Db and events folder, but in mod's location! So here we go: (your paths)/Darkest Hour/Mods/Darkest Hour Full/Db/Events.

Of course if you have some other mods, in most cases you will track events the same way. Just pick mod's folder and there you go! However, over course of time some of the modders decided to be cozy and sort event files in appriopriate folders! If you'd take a look at Kaiserreich (/Mods/Kaiserreich/Db/Events) you will see a lot of folders with eventfiles inside them, so you have Russia, Spain, USA, WWII, Mitteleuropa, etc. folders and inside them files like russian domestic policy, russian foreign policy, Spanish Civil War, Alaska and Hawaii, Partitions, etc...

And guess what? It's brilliant! If you have a lot of files you can easily sort them this way. Also, you can split events of major countries in a few files, appriopriate to events. So, in terms of Kaiserreich, in Russia folder you can find five (!) files for Russia only. If you're making something big, sorting files like that makes it infinitely easier to browse through them, also it's easier for other people to quickly find what they want.

Keep it in mind! Keep your files tidy! That goes to some of KR people, as a OCD-modder I'm fainting when I have to go and browse through their files. Eeek!

*So, "how do we link events" now you might ask? I wanna deal with it now - it's fairly easy too.

Sooo, usually mods do have their "master event file", however weird does that sounds. Well, I call it that way at least. Let's go back to Darkest Hour Full (I assume y'all have that one).

Go to your DHF/Db directory again. But now, instead of opening events folder, open events.txt file inside db. You should have that kind of list right 'ere:

Code:
# Darkest Hour events

event = "db\events\bulgaria.txt"
event = "db\events\china.txt"
event = "db\events\coups_events.txt"
event = "db\events\death_events.txt"
event = "db\events\election_events.txt"
event = "db\events\france.txt"
event = "db\events\generic_decisions.txt"
event = "db\events\germany.txt"
event = "db\events\hoi2.txt"
event = "db\events\hungary.txt"
event = "db\events\italy.txt"
event = "db\events\japan.txt"
(....)

That's where all links to event files are being stored. If you wanna add your own, simply add link to your file at the end, well, anywhere - doesn't matter. For example:

Code:
# Darkest Hour events
[b]event = "db\events\Glorious Empire of Bukabuka Menhap Yongwa.txt"[/b]
event = "db\events\bulgaria.txt"
event = "db\events\china.txt"
event = "db\events\coups_events.txt"
event = "db\events\death_events.txt"
event = "db\events\election_events.txt"
event = "db\events\france.txt"
event = "db\events\generic_decisions.txt"
event = "db\events\germany.txt"
event = "db\events\hoi2.txt"
event = "db\events\hungary.txt"
event = "db\events\italy.txt"
event = "db\events\japan.txt"
(....)

Should be pretty straightforward. And now, just in case you're going nuts with multiple folders and files Kaiserreich style, here goes example for KR version of this files (events kaiserreich.txt in Kaiserreich/db/)

Code:
# Kaiserreich: Legacy of the Weltkrieg

# Random events
event = "db\events\RandomEvents.txt"

# Invention type events
event = "db\events\secret_weapon_events.txt"

###########
#### Mitteleuropa
###########
event = "db\events\MittelEuropa\AUSGLEICH.txt"
event = "db\events\MittelEuropa\Austria.txt"
event = "db\events\MittelEuropa\Flavour Events.txt"
event = "db\events\MittelEuropa\GERMAN DOMESTIC.txt"
event = "db\events\MittelEuropa\GERMAN FOREIGN.txt"
event = "db\events\MittelEuropa\Prussia.txt"

Now, usually events.txt file is usually added in .eug scenario file so you don't really have to do that, but for the sake of explanation (and in case you're making new scenario). What does that mean?

When you load a scenario in Darkest Hour, game reads main .eug file to look for files it has to open. So you only have to link your events.txt file here same as you just linked events file in events.txt. If you are adding event files to already existing mod it's done already, but just in case I'll tell ya. Go to Darkest Hour Full/Scenarios/ and open 1936.eug. Open it with N++ and search (ctrl+f) for phrase "events.txt":

Code:
(...)
event      = "db\events\AI\AI_HOL.txt"
event      = "db\events\AI\AI_BEL.txt"

[b]# Includes for global data
include = "db\events.txt"[/b]

# Victory points distribution
include = "scenarios\1936\vp.inc"

# Include files for each country tag used in the scenario
include = "scenarios\1936\abyssinia.inc"
include = "scenarios\1936\afghanistan.inc"
(...)

Here you can link your events.txt file. However, as you can see above, AI event files (which we'll be talking about soon) are linked straight into scenario file, not via events.txt. And yes, it's also viable option to do. You can choose which way to prefer - going via events.txt is much more organized, and I like when things are organized because ordnung. But you really can do it however you want to.

Okay, that'd be it about linking. One more thing to cover in here.

*Comments. Some of you should know already, but some might be asking - are those # things necessary?

Technically no, they're not needed. But practically? Yes, hell yes, goddamn yes, for a thousand of times yes! Again it helps you sort things out and browse files quicker. It is useful as goddamn hell so please don't stop reading now, it will benefit in future. You will thank me later for that one.

The reason # is used so often is because this way you "comment out" some parts of the file. Which means - game won't read it. It will omit every single line which has # at the start. And that's great since you can make comments - essentially that's what's # for!

So, how do you use it to your advantage? A lot of stuff. Examples for ya:

Code:
# Risorgimento Grand Campaign's Event Files Database
(...)
# 7. Central & Eastern Europe [70001 - 80000]


event = "Db/Events/Central & Eastern Europe/Civil war in Poland.txt" # (70001 - xxx)
event = "Db/Events/Central & Eastern Europe/Monarchy in Poland.txt" # (70050 - xxx)
event = "Db/Events/Central & Eastern Europe/Civil war in Ukraine.txt" # (70201 - xxx)


# 8. Southern Europe [80001 - 90000]

event = "Db/Events/Southern Europe/Croatia.txt" # Croatia (80001-80099)
#event = "Db/Events/Southern Europe/Regia Aeronautica.txt" # Regia Aeronautica Development (80100-80125)
#event = "Db/Events/Southern Europe/Regia Marina.txt" # Regia Marina Development (80126-80160)
#event = "Db/Events/Southern Europe/Regia Escirito.txt" # Regia Escirito Development (80161-80190)
#event = "Db/Events/Southern Europe/Escirito Coloniale.txt" # Escirito Coloniale Development (80190-80199)
event = "Db/Events/Southern Europe/Abissynian War.txt" # 2nd Italian-Abissynian War (80200-80220) 100% DONE
event = "Db/Events/Southern Europe/Albanian Crisis.txt" # Albanian Crisis/Italian Incorporation of Albania (80221-80240) 100% DONE
event = "Db/Events/Southern Europe/Serbia.txt" # Serbia (81001-xxx)
event = "Db/Events/Southern Europe/Greece.txt" # Greece (83001-xxx)
(...)

To describe files in events.txt - here for example I always store ID ranges I use for certain files - someone who will want to add something later will know which IDs should he use to not mess with my plans. Also, see how event links for Italian Armed forces are commented out? (#event). Game will not read those files and I can have them referenced here for a future. So I can easily work on them, when I wanna test them I can simply delete #, if something goes wrong I can bring it back. Comments are great way to provide basic information on things, very important for other modders, extremely helpful if you gotta deal with thousands of files.

Code:
# Socintern Cooperation Events
# by Anjin Miura

## RUSSO-SERBIAN COOPERATION ##

# 30600 SOV: Russo-Serbian Treaty of Mutual Assistance
# 30601 SER: Russo-Serbian Treaty of Mutual Assistance

# 30602 SOV: Russo-Serbian Treaty of Economical Development
# 30603 SER: Russo-Serbian Treaty of Economical Development

# 30604 SOV: Russian Military Mission in Serbia
# 30605 SER: Russian Military Mission in Serbia

# 30606 SER: Russian Aid: Modernization of Infrastructure
# 30607 SER: Russian Aid: Age of Electrification
# 30608 SER: Russian Aid: Development of Heavy Industry
# 30609 SER: Russian Aid: Agricultural Revolution
# 30610 SER: Russian Aid: Rise of Military Industry
# 30611 SER: Russian Aid: Russo-Serbian Military Academy

event = { 
(...)

To make actual header of file (while you can show off by claiming that you made those files! cozy!) and table of contents! I hate browsing through uncommented files, where nothing is referenced and you gotta keep searching, and you waste your valuable time! And here, look: you have all IDs used here, which TAGs (countries) are getting the events, even the title - so if you are looking for a specific event, it takes half of a second to check it. Handy, aye?

Code:
command = { type = trigger which = 30603 } # SER: Russo-Serbian Treaty of Economical Development

To describe some commands and again utilize time. Sometimes people have no time to check which event has ID 30603, or which province is 351. And with little # at the end they know it instantly. Sometimes you can describe motives for why is such command here, sometimes you can even comment out whole command and leave it for now, until you'll decide what to do with it.

You gotta love comments. Surely they are not obligatory, but if you expcet someone else to take a look on them, or even help you with them, use at least basic comments. It helps! Also it makes files look sexually attractive. Makes you look professional.

Everyone wants to be professional.

3.) General Event Syntax

Code:
event = { 
	id = 90025
	random = no
	country = FRA
	style = 2

	trigger = { 
	event = 90023
	event = 90024
	flag = FRA_Elections_32
	NOT = {
	flag = FRA_32_Crackdown
	}
	}
	
	date = { day = 13 month = july year = 1932 }

	name = "Second French Revolution"
	desc = "EVT_FRA32_25"
	#-# Edouard Herriot's government formed in May was under heavy attack from the very first day of its formation. Its main enemies were convinced that Cartel used its influence in political circles to press certain officials and win elections with 62 percents while pre-election rankings were giving them around 40. Whole long-awaited crucial elections had been neglected following day. Every assembly of new French parliament was ending with major argument and disorder, unable to make any votings. In meantime monarchist leader Charles had been unofficialy proclaimed King of France in Reims and all monarchist supporters were rallying in western France around historical cities of Reims and Verdun. That's not what led directly to a disaster however. Picqueray along with her army finally appeared in the north a few days ago and took control in Le Havre and Evreux, meeting no response from local army units. From that place target could be only one. On 14th July of 1932, 143 years since Bastille has been destroyed, Picqueray enters Paris along with loyal army from Le Havre. City surrendered after all Gendarmerie units were wiped out. Herriot and his government escaped from Paris and moved south, again barely escaping Royalists also moving towards Paris from west. Several other cities around the France pledged their allegiance to France Nouvelle, mostly industrial ones: Bordeaux, Lyon and Marseille. Royalists maintained control of Toulon, main Marine Nationale base, and also hold strong influence in countryside all around the France. 
	picture = "France_SFR"
	
	action_a = {
		name = "A new 1789 it is! We gotta fight for unity of France!"
		command = { type = dissent value = 10 }
		command = { type = independence which = U11 value = 0 when = 0 } # Union des Villes de France		
		command = { type = event which = 90082 where = U11 value = 3 } # Union des Villes de France proclaimed
		command = { type = independence which = VIC value = 0 when = 0 } # Kingdom of France
		command = { type = event which = 90081 where = VIC value = 2 } # Kingdom of France proclaimed
		command = { type = war which = VIC }
		command = { type = war which = U11 }
		command = { type = damage_division which = land where = 20 }
		command = { type = disorg_division which = land where = 20 }
		command = { type = manpowerpool value = -50 }
		command = { type = money value = -200 }
		command = { type = supplies value = -1000 }
		command = { type = capital which = 74 } # Vichy
		command = { type = clrflag which = FRA_Elections_32 }
		command = { type = setflag which = Second_Revolution }
	}
}

What a monster! It looks so scary! How am I meant to go through all this madness?! Are you crazeeh?!

No. We'll go section after section. And you will get it. Get your event commands file ready (Things You Will Need), now it will be needed. You can also find help about event syntax here, but it's a bit too short. Mine's better. Thou some references here are valuable, I'll use them too of course. Technically it's just summary of all the knowledge lying here and there.

Okay, off we go!

*Header:

Code:
event = { 
	id = 90025
	random = no
	country = FRA
	style = 2

It's this part. Very beginning. Opening. Like in chess.

event = { opens the event section. Everything from the first { here aaall the way until corresponding } at the end is what makes our event.

id = x - according to event commands.txt "valid event IDs range is 0 to 2,147,483,647". Fair enough. Always make sure you'll be using unique ID. Each events needs its own.

random = no indicates whether event is...random or not. Random events weren't really popular in HoI2 and DH anyway, but for example infamous EU4's comets are random events. A generic events which can pop up randomly - you can check Db/randomevents.txt in main DH directory to see what random events are.

country = x indicates for which TAGs will this event work. If you want to find specific TAG, just go to config/world_names.csv of corresponding mod and search via name of country you want to make event for. I am not entirely sure because I've never tried it, but I assume that if you would do something like that:

Code:
country = { GER FRA SOV }

Event would be avaiable for Germany, France and Soviet Union. Still, it could fire only once, for whoever will meet requirements for it first. Not sure if that works in Darkest Hour, I presume it might, needs some testing.

If you won't add country = { } event will most likely be available for all countries currently existing in game. That's how random events work for example - since they use no country = { }, everyone can get them. On the other hand using TAG(s) in country and setting random from no to yes might effect in random events for just one specific country. You might want to experiment with this.

style = x - not much to tell really. Darkest Hour team nailed it in their file: "style = 0/1/2 # 0 = uses vanilla event screens 1 = allow bigger pictures to be used 2 = uses the new newspaper style event screens". We'll get to pictures later.

*Triggers:

Triggers are one hella sneaky bastards. They are tough nuts to crack, but if you are one of the masterminds who like to play with logic thingies, you might make your events superior. They will be able to fire in most unexpected moment if you will be able to grasp them. With exception of basic triggers there are three components to play with:

AND means that all of the conditions need to be true for the event to fire.
OR means that only one of the conditions need to be true for the event to fire.
NOT mean that none of the conditions can be true for the event to fire.

All the trigger conditions can be found in event commands.txt. Once you open the file you'll have huge TRIGGERS in line 39 I guess. Take note that in lower parts of file there are new triggers and commands added with Darkest Hour - search for "New with Darkest Hour :" (line 382). And now, back to our event:

Code:
	trigger = { 
	event = 90023
	event = 90024
	flag = FRA_Elections_32
	NOT = {
	flag = FRA_32_Crackdown
	}
	}

So, in language of humans we could read it that way:

If event 90023 already happened and event 90024 already happened and flag FRA_Elections_32 is TRUE then event will fire.

Event will not fire if flag FRA_32_Crackdown is TRUE.

We will get to the flags later, maybe next time? It remains to be seen. They are useful. And to finish trigger of topics - here you could only see NOT used - so if that crackdown flag set by one of events will be active, there's no way that this event will fire. And yeah, if you'd know whole file, in one event there's an option to smash plotters and thus set flag Crackdown_32 and thus prevent Civil War from erupting.

You can play with AND, OR and NOT however you want - they are tricky, but mastering them means mastering the events. Thou you don't need to make them really crazy, sometimes a simple NOT can make difference needed to suit your goals. I guess we'll need a special post later on to cover triggers. Not now. And remember - there are lot of trigger commands, go check them.

Remember about brackets! Every AND/OR/NOT needs to be opened with { and closed with }. And after all the triggers are set you need to close whole trigger = { thing with }. Always pay attention to that, N++ is useful since it always highlights whether brackets is closed or not - just click on it.

*Dates

You probably want your event to file at the certain point in timeline, don't you? Like, if Roosevelt died in 1945, then you wanna make sure event will fire in 1945, in exact day, even in exact hour(!). And so I wanna French Revolution to start on 14th July, exactly at 14th July, same as in 1789. So I simply added a date:

Code:
date = { day = 13 month = july year = 1932 }

But you said 14th July and here day is 13! What is this madness?! You even cannot into numbers, sire, you are dismissed!

It has to be that way. Why? Well, Hearts of Iron series was never really good at measuring time, so every month has 30 days (you know how awkward it is to write an AAR and have something important happen on 30th February?). But there's something more. Hearts of Iron cannot read day = 30, it will crash because for game day 30 is non-existent.

First day is referred as 0. Last day as 29. So you always gotta add one to your date in eventfile. If you want to have fifth day of month, then you gotta write day = 4 because 4 + 1 = 5. If you wanna it to be thirteenth, then 29 because 29 + 1 = 30. I had my chips with adding day = 30 and wondering "why is game crashing again?!". Keep that in mind. Days go from 0 (day 1) to 29 (day 30). Also, for a sake of future reference - you can also use numbers to describe months. It goes from 0 to 11 again, 0 being January. So, in case above, July could be replaced with 6 (since it's seventh month in the year, 6 + 1 = 7).

But now you might say that you don't want a specific date for an event. Maybe you just want it to fire between date X and date Y once all requirements are met? Yeah, no problem. Say hello to offset and deathdate:

Code:
date = { day = 13 month = july year = 1932 }
offset = 5
deathdate = { hour = 15 day = 9 month = may year = 1933 }

Offset is number of days between trigger checks, for example: let's say that event 90024 didn't fire yet. It's 14th July and Revolution event won't fire too because not all triggers are ready. So game leaves event behind and waits another 5 days to check requirements once again. So, let's say that on 16th July event 90024 finally fired. Now, when game will check triggers for Revolution on 19th July (5 days as in offset) and they will be ready, Revolution will happen. If you'd set offset to 900, game would check triggers every 900 days. That kind of thing.

AC's Remark: "Note: the lower the offset (with 1 being the lowest valid number), the higher is the load on the engine (and therefore, the lower the speed of the game). Higher offsets allow better performance."

Deathdate is when event literally dies and game won't be checking for it any longer. So, let's say that feral event 90024 didn't fire until 11th May of 1933. Since deathdate is set to day = 9, which is 10th May, it won't have any effect. Revolution won't fire because it crossed its deathdate. It's over, not gonna happen.

Also, in this case you can see hour, just in case you wanna specify it too. Zero rule applies here too - while hour = 0 is 1:00 A.M, hour = 23 is midnight. Dunno, maybe you wanna play with hour too, might be useful for crisises like one before WWI when there were massive DoWs in span of hours.

If you would like to have an event which can fire anytime in game and triggers are being checked every X days, just set date to scenario's startdate, deathdate to its end and offset to desired check time, I assume that's how Bitter Peace was working in HoI2 at least.

*Strings and Pics

Ah, some flavour you say? Yeah, pretty much every event needs a title and description. Nicey picture too? Well, I can only give you a hint, you gotta make pictures yourself.

Code:
	name = "Second French Revolution"
	desc = "EVT_FRA32_25"
	#-# Edouard Herriot's government formed in May was under heavy attack from the very first day of its formation. Its main enemies were convinced that Cartel used its influence in political circles to press certain officials and win elections with 62 percents while pre-election rankings were giving them around 40. Whole long-awaited crucial elections had been neglected following day. Every assembly of new French parliament was ending with major argument and disorder, unable to make any votings. In meantime monarchist leader Charles had been unofficialy proclaimed King of France in Reims and all monarchist supporters were rallying in western France around historical cities of Reims and Verdun. That's not what led directly to a disaster however. Picqueray along with her army finally appeared in the north a few days ago and took control in Le Havre and Evreux, meeting no response from local army units. From that place target could be only one. On 14th July of 1932, 143 years since Bastille has been destroyed, Picqueray enters Paris along with loyal army from Le Havre. City surrendered after all Gendarmerie units were wiped out. Herriot and his government escaped from Paris and moved south, again barely escaping Royalists also moving towards Paris from west. Several other cities around the France pledged their allegiance to France Nouvelle, mostly industrial ones: Bordeaux, Lyon and Marseille. Royalists maintained control of Toulon, main Marine Nationale base, and also hold strong influence in countryside all around the France. 
	picture = "France_SFR"

name is of course our event's name. Those are not very long usually, so you can simply type them here in quotation marks. Will work well.
desc however is a different deal. Game has a limit of symbols it can display in game via quotation marks, something around 250 if I recall correctly. If you'll cross limit, event won't likely show up. So, how to make it work? That's where config files are coming handy. In your mod directory, along with db and scenario and a few other folders you have config - here's where all string (names) are being stored in respective files. In world_names you will find names of countries, in models.csv names of equipment, province_names store names of provinces, etc. etc.

Also please take note of another use for comments: original description can be listed under desc section and commented out, so you can read description in event file too. Handy if you're looking for event via description. You can pretty much use # only, #-# is thing I saw in files of absolutely best mod ever designed for Europa Engine game - AGCEEP for EU2/FtG - and since all the people who made it are clearly geniuses, I wouldn't even think about questioning them.

#, ##, #-#, doesn't matter. Having your descs around is helpful. Let's get back to adding descriptions to event now.

Technically you can add your entry to any of those, but since you are nice and caring person who keeps his file tidy you'll put it int event_text.csv, right? I hope so.

Okay, so what you need to do is come up with string name for your wall of text and insert it at the end of your file. String for this description is EVT_FRA32_25. It is also a hint for me - FRA32 will surely remind me that it's pre-civil war event and subtle _25 that it's event with ID along lines of xxx25. Remember guys, always make your life easier with such little things.

So, how does string works?

Code:
EXAMPLE;English;French;Italian;Spanish;German;Polish;Portugese;Russian;Extra1;Extra2;X

EXAMPLE is name of your string, asme as mine EVT_FRA32_25. And after that you have following language versions. You can add certain translations this way, so for English version EVT_FRA32_25 will game will display what's between first semicolons (where English is now), if you'll change language to French - then what's in French, etc. etc. Most likely you're all using English version of the game, so simply change English to your description and leave rest as it is - again, to not make a mess.

Code:
(...)
EVT_FRA32_25;Edouard Herriot's government formed in May was under heavy attack from the very first day of its formation. Its main enemies were convinced that Cartel used its influence in political circles to press certain officials and win elections with 62 percents while pre-election rankings were giving them around 40. Whole long-awaited crucial elections had been neglected following day. Every assembly of new French parliament was ending with major argument and disorder, unable to make any votings. In meantime monarchist leader Charles had been unofficialy proclaimed King of France in Reims and all monarchist supporters were rallying in western France around historical cities of Reims and Verdun. That's not what led directly to a disaster however. Picqueray along with her army finally appeared in the north a few days ago and took control in Le Havre and Evreux, meeting no response from local army units. From that place target could be only one. On 14th July of 1932, 143 years since Bastille has been destroyed, Picqueray enters Paris along with loyal army from Le Havre. City surrendered after all Gendarmerie units were wiped out. Herriot and his government escaped from Paris and moved to Lyon, again barely escaping Royalists also moving towards Paris from west. Several other cities around the France pledged their allegiance to France Nouvelle, mostly industrial ones. Royalists maintained control of Toulon, main Marine Nationale base, and also hold strong influence in countryside all around the France. ;French;Italian;Spanish;German;Polish;Portugese;Russian;;Extra2;X
#EOF;;;;;;;;;;;X
#EOF;;;;;;;;;;;X

And this way game will handle your description nicely. Also remember to put your entry just before EOF things. Dunno what they are, but knowing how evil and mysterious can game devs be, I wouldn't mess with that crap.

And as for picture, you simply insert its name between quotation marks again. In my case game will try to read France_SFR picture from Gfx/events_pics events. Always make sure that your pic is in .bmp 24-bytes format . Always. Style from header can be used to change type of picture - seeing as I have it set to 2 I can guess it's the best one. But you are entitled to test it on your own and choose your favourite.

I can't find a tutorial for a event pics and I thought there was one around! If you know where it is, just link it, I have no bloody idea about graphics. Once I'll find it (or someone will simply make tutorial on it) we'll have a good source on pictures. Also you might want to head to Graphic Request Thread (sticky up there) to request a pic, sure that someone will help you out ;)

Okay, now time for the best....ARE UUU REDEEEEH?!

*Actions

Ooh, actions. Main part of the event you might say. It's what you pick when event fire - you could also call them options I think. Sometimies you might have one with just a minimal dissent bump, sometimes you might have monsters like Bitter Peace's territorial changes. It depends on what you want to achieve.

As far as I know we can have more than four actions right now, also you don't need to mark them as _a, _b, _c, etc. It can be simply action = { }, but since I'm kind of used to the letters I usually use them. It's not necessary.

In name you simply put your action's name, one highlighted in game. Potentially you could store it in event_text.csv, but is it worth it? Game surely won't have problems with strings inserted this way under 250 symbols, but make sure that your action names won't be too long. Game also has problems with showing too long names and sometimes you might get an unreadable mess. Keep it straight. Place for convoluted explanations is called desc, not name.

If you have more than one action, you can add ai_chance before commands are listed. Ai_chances of all options in your events have to (or at least it'll work nicely ths way) equal 100 in overall. Assume you have three actions: action_a has ai_chance = 70, which means that there's 70% chance that AI will pick it. Action_b has ai_chance = 7, which is 7%, and action_c's ai_chance is 23, which means 23%.

70+7+23 = 100%. You shouldn't be crossing 100% I believe. Making all ai_chances equal less than 100% might work, just no idea what effects you will get. It's highly advised that you stick to 100% rule.

AC's Remark: "Sum of AI_chance doesn't have to be 100% (old HOI restriction that has been removed in DH)".

Okay, let's stick to our commands - we'll go through them

Code:
	action_a = {
		name = "A new 1789 it is! We gotta fight for unity of France!"
		command = { type = dissent value = 10 }
		command = { type = independence which = U11 value = 0 when = 0 } # Union des Villes de France		
		command = { type = event which = 90082 where = U11 value = 3 } # Union des Villes de France proclaimed
		command = { type = independence which = VIC value = 0 when = 0 } # Kingdom of France
		command = { type = event which = 90081 where = VIC value = 2 } # Kingdom of France proclaimed
		command = { type = war which = VIC }
		command = { type = war which = U11 }
		command = { type = damage_division which = land where = 20 }
		command = { type = disorg_division which = land where = 20 }
		command = { type = manpowerpool value = -50 }
		command = { type = money value = -200 }
		command = { type = supplies value = -1000 }
		command = { type = capital which = 74 } # Vichy
		command = { type = clrflag which = FRA_Elections_32 }
		command = { type = setflag which = Second_Revolution }
	}
}

So, choosing an action_a (only one in this case) will effect in:
-getting 10% of dissent,
-TAG U11 will be liberated (nice example of comment here with name of country, no need to remember all TAGs or check world_names this way), units in are will change allegiance (value = 0), country will use it's basic domestic policy set in revolt.txt (when = 0),
-Event 90082 (name in comment) will fire for TAG U11 (where = U11) in three days from now (value = 3),
-TAG VIC will be liberated, units in are will change no allegiance (value = 0), country will use it's basic domestic policy set in revolt.txt (when = 0),
-Event 90081 will fire for TAG VIC (where = U11) in three days from now (value = 3),
-War on VIC will be declared,
-War on U11 will be declared,
-All land divisions of FRA will take 20 damage (so if they have 100/100 strength, they'll have 80/100 after that command and they will need to be reinforced),
-All land divisions of FRA will temporarily lose 20 organization (it will regenrate itself quickly),
-Manpower will be decreased by 50 (which is around four-five divisions worth),
-Money will be decreased by 200,
-Supplies will be decreased by 1000,
-Capital will be moved to Vichy,
-Flag FRA_Elections_32 will be cleared (set to FALSE),
-Flag Second_Revolution will be set to TRUE,

For more explanation in terms of commands simply look in event commands.txt. They'll get their own section in this guide. Once again, please go to event commands file for a reference in terms of commands and triggers! All of them are listed and explained here, and since there are lots of them, you will surely find what you want. Later on I will focus on crucial ones, which might need further explanation and examples, like flags.

So, that's how basic actions work.

Basic actions?

Well, there are a few more tricks with them to spice things up. Yeah, more reading for you.

*Summary of Event Syntax

One and only eternal truth of eventland: always be sure to check all the brackets and quotation marks! Twice!

Always remember to close every action! After last command of action = { is placed, remember to close it with } in the end! And if it's your last action you gotta put another } at the end to close whole event! Sometimes you'll really get a cluster of brackets, so it helps to always check it. Notepad ++ is very helpful in this case. Always always always check them all once you'll make a few events. In this, very short section, I have only a little summary of brackets, so you can see with your own eyes what's going on here. This should give you a brief idea about how messy brackets can be.


Code:
event = { # This bracket opens whole event 
	id = 90025
	random = no
	country = FRA
	style = 2

	trigger = { # This bracket opens trigger section
	event = 90023
	event = 90024
	flag = FRA_Elections_32
	NOT = { # This bracket opens NOT section
	flag = FRA_32_Crackdown
	} # This bracket closes NOT section
	}  # This bracket closes trigger section
	
	date = { day = 13 month = july year = 1932 } # Date needs to be written inside brackets

	name = "Second French Revolution" # All strings, either inserted straight up or referenced via code to event_text.csv have to be in quotation marks
	desc = "EVT_FRA32_25"
	#-# Edouard Herriot's government formed in May was under heavy attack from the very first day of its formation. Its main enemies were convinced that Cartel used its influence in political circles to press certain officials and win elections with 62 percents while pre-election rankings were giving them around 40. Whole long-awaited crucial elections had been neglected following day. Every assembly of new French parliament was ending with major argument and disorder, unable to make any votings. In meantime monarchist leader Charles had been unofficialy proclaimed King of France in Reims and all monarchist supporters were rallying in western France around historical cities of Reims and Verdun. That's not what led directly to a disaster however. Picqueray along with her army finally appeared in the north a few days ago and took control in Le Havre and Evreux, meeting no response from local army units. From that place target could be only one. On 14th July of 1932, 143 years since Bastille has been destroyed, Picqueray enters Paris along with loyal army from Le Havre. City surrendered after all Gendarmerie units were wiped out. Herriot and his government escaped from Paris and moved south, again barely escaping Royalists also moving towards Paris from west. Several other cities around the France pledged their allegiance to France Nouvelle, mostly industrial ones: Bordeaux, Lyon and Marseille. Royalists maintained control of Toulon, main Marine Nationale base, and also hold strong influence in countryside all around the France. 
	picture = "France_SFR" # Name of the picture, always in quotation marks
	
	action_a = { # This bracket opens action_a section 
		name = "A new 1789 it is! We gotta fight for unity of France!" # Quotation marks for names, remember.
		command = { type = dissent value = 10 } # Every command has opening bracket before type and closing at the end of command. Keep that in mind.
		command = { type = independence which = U11 value = 0 when = 0 } # Union des Villes de France		
		command = { type = event which = 90082 where = U11 when = 3 } # Union des Villes de France proclaimed
		command = { type = independence which = VIC value = 0 when = 0 } # Kingdom of France
		command = { type = event which = 90081 where = VIC when = 2 } # Kingdom of France proclaimed
		command = { type = war which = VIC }
		command = { type = war which = U11 }
		command = { type = damage_division which = land where = 20 }
		command = { type = disorg_division which = land where = 20 }
		command = { type = manpowerpool value = -50 }
		command = { type = money value = -200 }
		command = { type = supplies value = -1000 }
		command = { type = capital which = 74 } # Vichy
		command = { type = clrflag which = FRA_Elections_32 }
		command = { type = setflag which = Second_Revolution }
	} # This bracket closes action_a section 
} # This bracket closes whole event

Hopefully this will somehow help you in understanding of how quotation marks and brackets are working in events. ALWAYS CHECK IT TWICE. Sometimes you might get stuck for hours with a weird crash, and when in the end it appears that you've missed one little } or ", you really might want to kill yourself.

I know a thing or two about losing four hours because of a bracket. Trust me.

*Summary:

At this point you really should have no problems with making good events. You know how to operate with triggers (thou it requires training), how to properly use strings, and make multiple actions with random chance of AI picking them. Also, with an event commands file you could technically go on your own now, as most of commands have nice explanations there. You won't get lost for sure.

But then again I assume you might have some more questions. And some commands seem to be unclear at this point, like mentioned flags. Moreover, we are not done with triggers yet. You can also apply them to actions and even commands, so they are available only if conditions are met. For example, if we'd get back to Second Revolution event, by adding trigger to check whether France owns #74 (Vichy) we could make sure that nothing will mess up. Of course in this case it's completely useless, but sometimes you might want to use it. Using triggers for actions might also be great. We'll also look in dem later.

4.) Advanced Eventmaking

Yeah, you can start feeling like a pr0 right now. Although "Advanced" doesn't mean that it's much harder - that's simply additional stuff you can use, sometimes might make your events much cooler. Think about it. Big modding plays are here!

*Decisions

I can imagine that most important for most of you are decisions. Biggest innovation in Darkest Hour's events, personally I consider them best form of decision in all Paradox game. In EU3, even EU4, you just click on a green tick and magic happens. Not funny. Forming Germany or Great Britain is so unclimatic - you just click one button and poof! Meh. Darkest Hour's decision are superior. They have their own panel (little picture in decision menu), own description, they can have multiple actions and feel sooo much much better. I wonder why Johan won't just steal this idea in implement in EU4.

Decisions are what I absolutely love about this game. Wish For the Glory could have stuff like that :(

Soo, how does one go about making decision? Gotta bring one of mine again, about Italian army.

Code:
event = { 
	id = 80161
	random = no
	country = ITA
	decision_picture = "ItalianArmy1"
	save_date = yes
	style = 2
	
	decision = {
		event = 80215
		flag = Abissynian_Victory
		atwar = no
	}

	decision_trigger = {
		headofgovernment = 25002 # Paolo Thaon di Revel
		owned = { province = 825 data = ITA }
	}

	trigger = {
		event = 80215
		flag = Abissynian_Victory
		atwar = no
	}
	
	date = { day = 0 month = may year = 1933 }
	offset = 1
	deathdate = { day = 30 month = december year = 1964 }
	
	name = "Future of Royal Italian Army"
	desc = "EVT_ITA_RE_1"
	#-# Words about fighting and description of three groups and stuff.
	picture = "AbissynianWar_Victory"
	
	action = {
		ai_chance = 65
		name = "Ugo Cavallero and his Firepower Focus"
		command = { type = setflag which = ITA_Firepower }
		command = { type = dissent value = 5 }
		command = { type = domestic which = DEFENSE_LOBBY value = 1 }
		command = { type = domestic which = PROFESSIONAL_ARMY value = 1 }
		command = { type = chiefofstaff which = 25014 } # Ugo Cavallero
		command = { type = chiefofarmy which = 25019 } # Antonio Gandin
		command = { type = activate which = 6010 } # Firepower Focus
		command = { type = gain_tech which = 6010 } # Firepower Focus
		#command = { type = waketeam which = TT_Cavallero } # Ugo Cavallero
		#command = { type = waketeam which = TT_Gandin } # Antonio Gandin
		command = { type = morale which = land value = 3 } 
		command = { type = max_organization which = land value = 3 } 
	}
	action = {
		ai_chance = 25
		name = "Rodolfo Graziani and his Mobility Focus"
		command = { type = setflag which = ITA_Mobility }
		command = { type = dissent value = 8 }
		command = { type = domestic which = DEFENSE_LOBBY value = 1 }
		command = { type = domestic which = PROFESSIONAL_ARMY value = 2 }
		command = { type = chiefofstaff which = 25015 } # Rodolfo Graziani
		command = { type = chiefofarmy which = 25018 } # Valentino Babini
		command = { type = activate which = 6210 } # Mobility Focus
		command = { type = gain_tech which = 6210 } # Mobility Focus
		#command = { type = waketeam which = TT_Graziani } # Rodolfo Graziani
		#command = { type = waketeam which = TT_Babini } # Valentino Babini
		command = { type = morale which = land value = -1 } 
		command = { type = max_organization which = land value = 5 } 
	}	
	action = {
		ai_chance = 10
		name = "Pietro Badoglio and his Defence Focus"
		command = { type = setflag which = ITA_Defence }
		command = { type = dissent value = -5 }
		command = { type = domestic which = DEFENSE_LOBBY value = -1 }
		command = { type = domestic which = PROFESSIONAL_ARMY value = -1 }
		command = { type = chiefofstaff which = 25007 } # Pietro Badoglio
		command = { type = chiefofarmy which = 25008 } # Alberto Bonzani
		command = { type = activate which = 6210 } # Mobility Focus
		command = { type = gain_tech which = 6210 } # Mobility Focus
		#command = { type = waketeam which = TT_Badoglio } # Pietro Badoglio
		#command = { type = waketeam which = TT_Bonzani } # Alberto Bonzani
		command = { type = morale which = land value = 10 } 
		command = { type = max_organization which = land value = -3 } 
	}		
}

As you can see, decision differs from event only with two additional trigger sections. Also, decision_picture = " " in header is picture for decision panel. It's that rectangle picture you see in decision menu. Every decision has one. If you won't add it, game will use generic pic for decision panel. Usual event picture where description and actions are is, same as before, refered as picture = " ".

AC's Remark: "decision_desc = "....", optional decision specific text (used on tool-tips instead of event description)." It makes perfect sense and I totally forgot about that.

But woah woah woah, wait, two additional trigger sections?!

Worry not! It's actually easy. Let's take a look at all three of them:

Code:
	decision = {
		event = 80215
		flag = Abissynian_Victory
		atwar = no
	}

	decision_trigger = {
		headofgovernment = 25002 # Paolo Thaon di Revel
		owned = { province = 825 data = ITA }
	}

	trigger = {
		event = 80215
		flag = Abissynian_Victory
		atwar = no
	}

Decision = { } is what makes decision available in decision panel. That doesn't mean you can take it! You'll see red X indicating that you haven't fulfilled all requirements. If you'll hover your mouse over that red X you'll see things listed in decision_trigger = { - here you have to set requirements needed to take decision. And last one, trigger = { } indicates when will AI take this decision.

So, why decision and trigger are exactly the same? Shouldn't only one of them do?

Well, technically yes. But when I was testing it in DH 1.3 Full without trigger, AI was taking decision without fulfilling any requirements. It might not be necessary, or maybe I was using 1.3 RC3. Or maybe something was broken. Or maybe, well, most likely I'm simply stupid.

Trigger is often used to avoid AI stabbing itself in the face. Suppose that by taking decision AI will lose 10 manpower, and it has only 9 in manpowerpool. So, AI will end up with...-1 manpower. Game shouldn't crash, but it might certainly be weird. So in trigger you can make sure that AI won't damage itself. In this case, if you'd set "manpowerpool = 12" in trigger, AI won't take this decision until it has 12 manpower - this way no harm will be done.

It applies to events like foreign aid for civil wars - to prevent AI from sending its last resources to fighting sides. And in general to prevent it from doing silly, silly things.

So let's sum up our decision trigger really quickly:

Decision will be available in decision panel if:
Event 80215 (Abissynian War - Victory) happened, flag Abissynian_Victory is set to TRUE and Italy is not at war,

Italy will be able to take this decision if:
Minister #25002 (Paolo Thaon di Revel - thanks my # friend) is in government and province 825 (Addis Abada) is owned by Italy,

AI will be able to take decision if:
Event 80215 (Abissynian War - Victory) happened, flag Abissynian_Victory is set to TRUE and Italy is not at war,

Thou it might not be necessary. I just remember having problems with this particular one in 1.3 patch. Whether it works or not, always do testing - even if you're 300% sure everything is fine.

And that's pretty much it concerning decisions. Rest of it is same as usual event - you have three options and you get to pick how you want Italian Army to develop. Also, just as a sidenote - I have TT_xxx here instead of IDs because I haven't made those techteams yet. So you can see that I commented those commands out - this way I can test this decision without worrying about lack of techteams and also I can keep TT commands around. Once I'll add those techteams, I'll simply add their IDs instead of TT_xxx and everything will be working.

It's most likely that if I wouldn't do it this way, I'd simply forget about techteams at first. So those entries are also a reference for me. Always make your life easier guys, that's what they told me in school.

*Additional Header Stuff

Remember where header section is? Place where you have country, random, etc. Technically you could also consider date and picture as parts of header - you can easily add them before description if you feel like so, order doesn't matter unless first is header, then description, then actions. Minor stuff like date and picture can be moved above. But that's not about it!

Event commands.txt lists several additional header thingies, quite useful in some situations, wanna have a look? If you want to use them in your event, simply add'em under random or style.

*Additional Header Stuff: Persistent

persistent = [yes/no]

DH Devs: Can the event fire more than once. Default is set to NO.
Moi: This way you can make events appear periodically, for example once a year in specific day. Kaiserreich's national days events would be a good example, let's take a look at Hungarian one:

Code:
event = {
 id = 900
 random = no
 country = HUN
 persistent = yes
 style = 2
 picture = "FORA"

     trigger = {
         day = 14
         month = 2
         NOT = {
         day = 15
         }
         NOT = {
         month = 3
         }
     }

     date = { day = 0 month = january year = 1936 }
     offset = 1
     deathdate = { day = 30 month = december year = 1963 }
 (...)

Persistent = yes makes event available to fire more than once and trigger allows event only to fire when day is 14 (so 15th as we know) and month is 2 (March, since 0 is January). When those conditions are met (when we have 15th March in game), event will fire.

And now important side not for events like that - why is NOT = { for 15 and 3 needed? At first I kind of thought of it myself, but answer is actually pretty easy. Game doesn't check if day or month is EXACTLY 14 or EXACTLY 2. If there would be no NOTs, event would fire every single day since 15th March until 30th December, making game absolutely unplayable. By adding those triggers game ensures that ONLY eigible date for event is 15th March. It won't accept neither days from 16 to 30 - NOT = { day = 15 } could be read as "Not if day is 15 OR HIGHER". Same with month. With event date encompassing whole timeline, it's ensured that it will fire only once a year.

I believe it could be done other way too, but that could require more work and testing. Technically you could set offset to 360 and remove NOTs. So once game will find 15th March and fire event once, it shouldn't be checking it for next 360 days, so, in Darkest Hour's wicked calendar system until next 15th March. But that's just a wild thought - I believe I did something this way once. Maybe it's not necessary, I guess that such sidenotes can be useful in understanding stuff like events. At least I always appreciated such in other guides.

*Additional Header Stuff: Inventions

Inventions = [yes/no]

DH Devs: Can only trigger once per country. Default is set to NO.
Moi: Used mostly for technologies, main part is "once per country". Everyone is able to discover atomic bomb for example, but invention events is needed to allow you to build it. If there'd be no inventions, only first country to discover tech would be able to make nukes, at least it sounds logically to be that way. I presume you could somehow use inventions to your advantage outside of technology events, thou I have no ideas so far. I believe it could be useful in some special cases.

*Additional Header Stuff: All


all = [yes/no]
DH Devs: When such event is triggered by another event, it will be executed for all countries in the TAG = { … } list or for all countries in the world if no TAG (and no country) is specified. Default is set to NO.
Moi: It's the first time I see it...sounds great! Nice idea to utilize events in case of repetitive events. Let's assume that you want to create great coallition against Reich and France is one to form it. So, France is leader and it gets event #1 where it can choose whether to invite some countries or not. And if it decides to go for it, it triggers only one event with "all=yes" in header.

This way I can assume that all countries in TAG = { } in event triggered by France (let's say Poland, Czechoslovakia, Yugoslavia, Romania, Belgium and Netherlands) will get the same event with option of joining and not joining coallition. This way, instead of making one event per country (six in this case), you can only make one for all potential allies. Now that sounds perfect! Would work with all types of coallitions, congresses, conferences, international treaties, etc. Again, it is only my wild thought whether example above will work - thou since I can see some use for it, I'll definitely try it out. Nice for massive, repetitive events.

*Additional Header Stuff: One_Action

one_action = yes / no (default)

DH Devs: If set show just one (random) action to the player. The action is chosen based on AI chances (if present), else it is random using the same rules as for the AI (set in misc.txt).
Moi: You could use it for roulette mod for DH. You pay for having a go and game chooses random score for you. Some you win, some you lose.

No, seriously, no hazard allowed in DH. Except of military hazard. Risky encirclements. Wild ambushes. That kind of things.

I would consider this one good for elections or some 50/50 situations. Suppose that you have an event where you can choose to spy German rocket lab somewhere deep in Germany. So, as France, you can send spy or not. If you'll decide to send him, in a week or two you'll get a result event with two options - success and failure, with ai_chances set for both, say 30% for success and 70% for failure.

If one_action = yes will be added to header of this result event, game will choose one option, according to ai_chances values. So you'll get only success - so for example some blueprints and research modifier - or only failure, with relations going down and some dissent. Only one of the options will be shown.

Good for a "gamble" events, although adding some randomness for elections would be nice too. No more choosing for you, your RNG Nation will decide itself which party wins! I can also definitely see myself using it.

So, there is only one more header addon to go - save_date. It's probably as useful as all of those listed above at once, but since it belongs more to a triggers section than here, we'll explain it in...triggers section.

*Triggering Events: Trigger Command

So, you have an event X in your file, and you want it to trigger certain event Y if chosen. There are a few ways to accomplish it. You should be familiar with basic triggers to make singular events happen. But what if you want to have one event tied to another or even multiple event chain? That's what this section's for.

In event commands.txt you can find a trigger command. That's the easiest way to trigger event Y with event X.

Code:
type = trigger which = [event id]	# Immediately trigger another event

But maybe you want it to fire a little bit later? Say, three days later? Well, actually I'm not sure if it's listed in event commands.txt, guess I found it in Kaiser events for Russia, but you can do a little trick with this command. You could already see it in first France event. I'd call it Extended Trigger Command (I love funky names) and define it this way:

Code:
command = { type = event which = [event id] where = [TAG] when = [x] } #  Triggers [event id] event for [TAG] in [x] days from this event.
command = { type = event which = 90081 where = VIC when = 2 } # Triggers 90081 Event for VIC in 2 days from this event.

Quite possibly that would be it. We could stop it here, you know how to trigger events, trigger command is awesome! Well, it has one little downside: its effect will be shown in game. If you'll hover mouse over action which includes this trigger, game will say something like: "Event x will occur in y days for TAG". Suppose that you want to surprise a player with sneaky event which secretly launches surprise blitzkrieg against him if he'll choose option number one. It sounds good, it has some marvellous stuff, it's almost perfect, but tooltip says:

"Event Surprise Anschluss will occur in 5 days for Germany".


Hell naw he ain't gonna click it! AI won't be bothered of course, but if someone will play this country, there's no way, he won't pick it. And moreover he'll know what's coming. And element of surprise will be lost. Surprise Anschluss won't be surprising anymore. So use this way of triggering only when outcome is quite sure - for results of investments, or any other expected situation like other country's answer to your demands. Hidden things have to remain hidden. Things get spicy then and damn I love spicy things! Everyone does.

*Triggering Events: Save_Date

Say hello to save_date. Let's get back to header of our Italian decision:

Code:
event = { 
	id = 80161
	random = no
	country = ITA
	decision_picture = "ItalianArmy1"
	save_date = yes
	style = 2
	
decision = {
(...)

Save_date = yes means that game will save the date when this event ot decision fire. Suppose that we've taken Regia Escirito decision on 7th May of 1933. Now, I have save_date here for a reason - I want a specific event to trigger after certain amount of days from it. It's about Italian panzers:

Code:
event = { 
	id = 80162
	random = no
	country = ITA
	style = 2
	
	trigger = {
		event = { id = 80215 days = 50 }
	}

	name = "Valentino Babini's report"
	desc = "EVT_ITA_RE_2"
	#-# Another story about tanks and about who Babini was etc.
(...)

Ohh, can you see that shiny thing in trigger? That's how you put save_date to use. Event = { id = 80215 days = 50 } in trigger means that event will fire if 50 days passed (days = 50) from event 80215, which has save_date = yes in header. You always gotta use save_date in event you wanna count days from. Good for foreign interventions for example - I have English and French aid to Ethiopia set up realistically this way, so they don't send and get resources in a day or two. And everything works nicely this way, you can't guess a thing. It will just happen and you have to deal with it.

In this event, Babini's report, Italian tanks are rising. Fifty days from decision can be understood as a time during which Babini guy written his report and handed it to new Chief of Staff. That's cool, isn't it?

So, that's how save_date works. It's main advantage is that you can hide events this way and keep things mysterious. If you use date trigger (this one with days = 50 here) for decision, and add it to decision_trigger, game will show it as valid requirement. In Darkest Hour Full Sudethenland event requires Anschluss of Austria to happen 180 days earlier, you can see it if you hover your mouse over red X / green tick. If you'll add date trigger to decision = { }, decision won't even show up until certain amount of days will pass.

So for example you can make decision show up after 30 days from event X, but it might be available to take after 40 days from event X. You just need event X to have save_date = yes. It's altogether a bit weird since I'm writing this guide and I'm bad at writing guides, however, I believe that once you'll an example or two you'll get it easily.

Triggering Events: Flags


So that leaves us with flags. You could see them in almost all events in this guide. So, what are flags about? Flags are the best way to make long eventchains and activate or deactivate group of events at once. Event commands.txt states that there are two types of flags:

Code:
	type = setflag which = [keyname]	# Sets Global flag, visible for all countries
	type = clrflag which = [keyname]	# Clears Global flag, visible for all countries
	type = local_setflag which = [keyname]	# Sets Local flag, visible only for this country
	type = local_clrflag which = [keyname]	# Clears Local flag, visible only for this country	
[CODE]
[FONT=Palatino Linotype]
So in other words, Global and Local flags. Quite possibly you could use Local if you want to use same name for Global and Local flag, for example Civil War. But then again, is it worth it to make such mess? Also, I always felt that Local flags are somewhat buggy, couldn't really grasp them. Maybe they have problems with new Europa engine, For the Glory already excluded local flags and uses only global ones. 

I guess that it's common to use global flags with proper naming system and keep things nice and tidy. For example TAG_name_year might work. As you will see below, I use FRA_Elections_32 in example. And even if five countries would have elections in 1932 and would require a flag, there's no problem. I can make ENG_Elections_32, GER_Elections_32, U87_Elections_32, etc. Noooo problum.

Also take a note that there are two commands - setflag and clrflag. When explaining flags' effects I was writing stuff like flag Abissynian_War is TRUE - TRUE means that flag is active (setflag was used before). FALSE means that flag was either not activated even once, or it was activated and then cleared. In Revolution event you had the same FRA_Elections_32 flag cleared since it was no longer needed.

It's like binary code. It even works this way in savegame. Every savegame has a section of flags, just below wars, quite early in the file. Kaiserreich for example has a massive list of flags in later saves:[/FONT]

[CODE]
	flags = { 
		3rdI = 1 
		3rdI_1 = 1 
		3rdI_1_ENG = 1 
		3rdI_1_GEO = 1 
		3rdI_1_Invite = 1 
		3rdI_1_MEX = 1 
		3rdI_1_PRK = 1 
		3rdI_1_RSI = 1 
		3rdI_ENG_issue1_Y = 1 
		3rdI_ENG_issue2_Y = 1 
		3rdI_ENG_issue3_Y = 1 
		3rdI_FRA_issue1_Y = 1 
		3rdI_FRA_issue2_Y = 1 
		3rdI_FRA_issue3_Y = 1 
		3rdI_FRA_issue4_Y = 1 
		3rdI_FRA_issue5_Y = 1 
		3rdI_H = 1 
		3rdI_MEX_issue3_Y = 1 
		3rdI_RSI_issue6_Y = 1 
		ACW_AUS = 1 
		ACW_AUS_CAL_CON = 0
(...)

While 0 means that flag is FALSE (off), 1 means that flag is TRUE (on). By turning flags on and off you can activate and deactivate multiple events, thus manipulating event chains with ease.

Let me go back to French events , I'll show you very good example of how flags are working:

Code:
event = { 
	id = 90001
	random = no
	country = FRA
	style = 2

	date = { day = 0 month = february year = 1932 }

	name = "French Legislative Elections of 1932 - Election Campaign Starts"
	desc = "EVT_FRA32_1"
	#-# After four years since last elections in 1928 the time to choose new government came at once. A long anticipated elections of 1932 are just three months ahead. Victorious in 1928 coallition of Alliance Democratique and Radicaux Indépendants seems to be doomed to fail this time. A renewed alliance of left-wing Parti Radical and S.F.I.O, "reinforced" by several minor left-wing parties was consistently first in pre-election soundings. However, the difference between second Ligue des Patriotes, also recently formed alliance of monarchist and far right-wing groups isn't really big and groups advocating radical change of political course and even restoration of monarchy are gaining support quickly. Even if both groups are easily getting more than 50% of votes, the list does not ends here. A long-term project involving consolidation of radical liberal and technocratic movements into one, led by French Petroleum Company's director Ernest Mercier started to bear its fruit and is also ready to compete in upcoming elections. Fierce rivalry between these three biggest groups remains main topic in every French newspaper everyday. With closing elections however, their political differences are being settled not only in press or radio, but also on the street via their respective para-military groups. On 1st February of 1932 French president Paul Doumer announced that election days will be 1st and 8th May following year. 
	picture = "France_1932"
	
	action_a = {
		name = "Can Third Republic survive the storm? "
		command = { type = dissent value = 2 }
		command = { type = setflag which = FRA_Elections_32 }
	}
}

So, that's the first event - as you can see it sets flag FRA_Elections_32 for a first time. So FRA_Elections_32 is now active - every event which requires it to fire will fire indeed. So this way our elections can go.

Code:
event = { 
	id = 90003
	random = no
	country = FRA
	style = 2
	save_date = yes

	trigger = { 
	flag = FRA_Elections_32
	event = 90002
	}
	
	date = { day = 20 month = february year = 1932 }
	offset = 1
	deathdate = { day = 20 month = april year = 1932 }

	name = "Battle of Angers"
(...)

Event 90003 requires event 90002 to fire and flag FRA_Elections_32 to be active. Since both are true (90002 fired before it), chain can go on. In addition, 90003 uses save_date, so you can expect it to be helpful on the way.

Code:
event = { 
	id = 90005
	random = no
	country = FRA
	style = 2
	save_date = yes

	trigger = { 
	event = { id = 90003 days = 20 }
	flag = FRA_Elections_32
	}
	
	date = { day = 0 month = march year = 1932 }
	offset = 7
	deathdate = { day = 29 month = april year = 1932 }

	name = "Jeunesses Patriotes' assault France Nouvelle in Lille"

This event fires if our flag is active AND Battle of Angers happened 20 days ago. Both are correct, so we can proceed. Please note that we have save_date again - technically we could continue with 90003's save date, but just in case if some kind of failure I decided to use new save_date here.

Code:
event = { 
	id = 90008
	random = no
	country = FRA
	style = 2
	save_date = yes

	name = "Deloncle Affair - Government Reaction"
	desc = "EVT_FRA32_8"
	#-# So yeah, all France is upon us, blaming government and Gendarmerie for failure to prevent an assasination attempt in the centre of Dijon. Hell is upon us really...but we have to come up with our official statement! 
	picture = "France_1932"
	
	action_a = {
		ai_chance = 90
		name = "We are going to 'investigate' that case."
		command = { type = dissent value = -3 }
		command = { type = money value = -100 }
		command = { type = trigger which = 90009 where = FRA value = 4 } 
	}
	action_b = {
		ai_chance = 10
		name = "We are not going to be bothered with uncivilized political movements fighting like street gangs!"
		command = { type = dissent value = 10 }
	}		
}

This event fires a few days after assasination attempt and is a place where you can pick another way. Hence we used save_date again - to help us execute another events as things may change from here on. Action A will make investigation event happen in next four days. And here a new path may begin. How?

Code:
event = { 
	id = 90009
	random = no
	country = FRA
	style = 2

	name = "Deloncle Affair - Investigation starts"
	desc = "EVT_FRA32_9"
	#-# So it begins. How should we deal with that tremendous case? 
	picture = "France_1932"
	
	action_a = {
		ai_chance = 100
		name = "Call the best French detectives and police to investigate it!"
		command = { type = dissent value = 2 }
		command = { type = money value = -50 }
	}
	action_b = {
		ai_chance = 0
		name = "Oppan Crackdown Time! [W.I.P]"
		command = { type = dissent value = 15 }
		command = { type = money value = -200 }
		command = { type = domestic which = DEMOCRATIC value = -1 }
		command = { type = domestic which = FREEDOM value = -2 }
		command = { type = setflag which = FRA_32_Crackdown }
	}	
}

Choosing action B will activate flag FRA_32_Crackdown. From here and with the help of save_date from last event, you can potentially start a chain about military taking power and persecuting disloyal factions. Of course I wasn't working on that line for now, but it sits here ready to be extended. Only a military line will use FRA_32_Crackdown flag, and triggering event via save_date, not via extended trigger command will provide us with some mysterious events, which you'll have to deal with. So it won't be easy to predict what's gonna happen. And that's what events are about.

Also take note of how ai_chance is used there. I wanna keep action_b here for testing purposes, but AI could potentially pick it and screw whole game. Since ai_chance is set to 0, AI will NEVER pick this option. And [W.I.P] in action name will let someone who plays France know that he should not be going this way for now. Also you might use it to add certain options which only player will be using. For example, I remember adding a 0% chance for Czechoslovakia to surprise attack Germany during Sudethenland Crisis in HoI2. AI won't even try, but player might. Why not?

Anyway, from this point chain goes all the way to the end, so far only to bloody Revolution. Revolution event clears FRA_32_Elections flag, which is not used since then, and sets up new one - Second_Revolution - solely dedicated to war in France. Since it concerns more than one country (TAG), it can be called that way, without necessary prefixes.

Code:
(...)
	action_a = {
		name = "A new 1789 it is! We gotta fight for unity of France!"
		command = { type = dissent value = 10 }
		command = { type = independence which = U11 value = 0 when = 0 } # Union des Villes de France		
		command = { type = event which = 90082 where = U11 value = 3 } # Union des Villes de France proclaimed
		command = { type = independence which = VIC value = 0 when = 0 } # Kingdom of France
		command = { type = event which = 90081 where = VIC value = 2 } # Kingdom of France proclaimed
		command = { type = war which = VIC }
		command = { type = war which = U11 }
		command = { type = damage_division which = land where = 20 }
		command = { type = disorg_division which = land where = 20 }
		command = { type = manpowerpool value = -50 }
		command = { type = money value = -200 }
		command = { type = supplies value = -1000 }
		command = { type = capital which = 74 } # Vichy
		command = { type = clrflag which = FRA_Elections_32 } # Killing useless flag. It will be set back to 0 in savegame.
		command = { type = setflag which = Second_Revolution } # Setting up new flag. It will be set to 1 in savegame.
	}
}

Of course you can make multiple flags required to fire an event and go crazy with them in general - much like Kaiser people did - as there's unlimited number of them, as long as every flag has its own unique name. Always remember to turn off flags used for a last time - to prevent unexpected madness from happening.

*Triggering Actions and Commands

Remember when I told you that only a certain actions will pop up if you will make specific triggers? Good! Now it's time to see how it works. Gotta introduce you to my current work:

Code:
event = {
id = 30602
random = no
country = SOV
save_date = yes

decision = {
flag = RUS_SER_Coop
exists = SER
}

decision_trigger = { 
relation = { which = SER value = 75 } 
atwar = no
}

trigger = {
relation = { which = SER value = 75 } 
atwar = no 
}

name = "Russo-Serbian Treaty of Economical Development"
desc = "State of Russian economy was terrible, but what could Serbians say? One of the poorest European states, sitting next to powerful Italy and rapidly industrializing Hungary would stand no chance in any prolonged war without complete collapse of economy. Even if Russians were struggling hard, they achieved quite a lot in short timespan since Socialist-Revolutionaries' takeover. Hoping to implement some of Russian innovations and get even limited material aid, Serbian Central Comitee was desperate to sign promised Treaty of Economical Development as quick as it was possible. This time Russian Foreign Comissaire Sukhanov, along with prominent engineers and industrialists was to visit Broz and Serbian leaders in Beograd to conclude Treaty. Since we promised to Serbians that aid will be given, we have to decide how many resources will be dedicated for it."
style = 0
picture = "Russia_Serbia"

date = { day = 17 month = february year = 1934 }
offset = 1
deathdate = { day = 17 month = august year = 1934 }

action_a = {
ai_chance = 75 
name = "Material and technological aid as promised in December"
command = { type = relation which = SER value = 15 }  
command = { type = dissent value = -2 } 
command = { type = belligerence value = -1 } # Fulfilling promises
command = { type = setflag which = RUS_Aid_Normal }
command = { type = trigger which = 30603 } # SER: Russo-Serbian Treaty of Economical Development
}

action_b = {
ai_chance = 15
name = "We are doing quite well, why not invest some serious stuff in Serbia?"
command = { type = relation which = SER value = 25 }  
command = { type = relation which = DDR value = -10 }  
command = { type = relation which = U13 value = -10 }  
command = { type = relation which = ITA value = -10 }  
command = { type = belligerence value = 1 } # Military Industry
command = { type = dissent value = 2 }
command = { type = domestic which = INTERVENTIONISM value = 2 }
command = { type = setflag which = RUS_Aid_Extended }
command = { type = trigger which = 30603 } # SER: Russo-Serbian Treaty of Economical Development
}

action_c = {
ai_chance = 10
name = "We have to limit our aid to civil goals only."
command = { type = relation which = SER value = 5 }  
command = { type = dissent value = 3 }
command = { type = domestic which = INTERVENTIONISM value = -1 }
command = { type = belligerence value = -2 } # No military investments
command = { type = setflag which = RUS_Aid_Limited }
command = { type = trigger which = 30603 } # SER: Russo-Serbian Treaty of Economical Development
}
}

Oh damn, another one of those big guys? Well, you should pretty damn understand it at this point! Anyway, there's a decent-sized eventchain about cooperation of "reformed communist" Russian SFSR and Serbia. One of the main part is economical cooperation. Well, Russia pumping moniez in Serbia to be honest. So as you can see in actions, there are several relation changes, also every action sets up different flag, and most of all...

Why all three options trigger only one event?

Because actions are triggered depeneding on flags. I don't have to make three events for three options then - only one. Depending on a flag, Serbia will also receive some relation and dissent changes. Also, this Russian decision uses save date - we'll be triggering aid events depending on how much time had passed since treaty was signed. It makes no sense to build roads in one day, right? Okay, let's go to Serbian event, that 30603, see how action triggers are working:

Code:
event = {
	id = 30603
	random = no
	country = SER

	name = "Russo-Serbian Treaty of Economical Development"
	desc = "Since the establishment of Serbian People's Republic in 1926, Socialist Russia always tried to ensure that nothing bad will happen to its sister republic in Balkans. Soon after coup Internationale broke and less radical Serbia stayed on side of Russia and Socintern. In next years Russian SFSR had to focus on its internal matters - fighting off countless hardline factions inside party and secret police and slowly recovering from disastrous losses during Civil War, Moscow couldn't fully assist Beograd. And Russian assistance was required by Serbians, constantly threatened by radical Hungarians from north. Backing of Big Brother could prove crucial. Soon, during autumn of 1933 Chernov finally announced during Central Comitee's congress that Russia is ready to aid Serbia. Josip Broz and Ivo Andrić were to visit Moscow on 17th December of 1933 and sign Treaty of Mutual Assistance, which would be a backbone of extended Russo-Serbian cooperation and basis for next treaties and initiatives."
	style = 0
	picture = "Russia_Serbia"

	action = {
		trigger = { flag = RUS_Aid_Normal }
		name = "Great!"
		command = { type = relation which = SOV value = 15 }  
		command = { type = relation which = ITA value = -10 }  
		command = { type = relation which = U13 value = -10 }  
		command = { type = dissent value = -3 }
	}

	action = {
		trigger = { flag = RUS_Aid_Extended }
		name = "Fantastic!"
		command = { type = relation which = SOV value = 30 }  
		command = { type = relation which = ITA value = -20 }  
		command = { type = relation which = U13 value = -20 }  
		command = { type = dissent value = -6 }
	}
	
	action = {
		trigger = { flag = RUS_Aid_Limited }
		name = "Well, beggars can't be choosers..."
		command = { type = relation which = SOV value = 5 }  
		command = { type = dissent value = 2 }
}
}

To make action use a trigger simply put it between action's opener and name. Will work for sure. You can use NOTs, ANDs and ORs freely. Just remember about brackets - usually there's a horrible mess with them when you add triggers on action or command level.

So as you can see all three options require different flag. Depending on Russia's choice, Serbia will get only one of actions. There's no way they'll have two options to choose, since Russia can overall pick only one of flags.

It is pretty straightforward really. You can use all triggers avaiable in actions - maybe you want some actions to be available once another event fired or if you have good relations with some guys? It's all up to you.

And from this point improvement events will work in the same way. This way I can make only one event per improvement, and by implementing action triggers make it work in all three cases. And by usage of command triggers I can even help Serbia get max out of this aid, for example prevent already discovered technologies from being given by Russia. What's the point of getting blueprint for already discovered tech? Why not get another one? And also, what's the point in giving Serbia blueprints for techs it's far away from? You can solve issues like that with command triggers.

One of improvement events, agricultural revolution. Now here you can see action and command triggers used to a full extent:

Code:
event = {
	id = 30606
	random = no
	country = SER
	
	trigger = {
	event = 30602
	event = { id = 30602 days = 90 }
	atwar = no
	}
	
	date = { day = 0 month = march year = 1934 }
	offset = 1
	deathdate = { day = 0 month = september year = 1934 }

	name = "Russian Aid: Agricultural Revolution"
	desc = "First and foremost, Russian aid was focused on improving Serbian agriculture, which seemed to be stuck deep in 19th Century at the time. With the main goal of mechanization and invention of modern fertilizers modernization of Serbian agriculture begun almost instantly after treaty was signed. First effects could be seen next summer, when for a first time new technologies were used. For a first time since its creation, Communist Serbia is predicted to produce more agricultural products than it needs! A glorious success of Socialist Reformation! "
	style = 0
	picture = "Russia_Serbia"

	action = {
		trigger = { flag = RUS_Aid_Normal }
		name = "Great!"
		command = { type = relation which = SOV value = 5 }  
		command = { type = industrial_modifier which = total value = 1 } 
		command = { type = industrial_modifier which = supplies value = 2 } 
		command = { trigger = { NOT = { tech = 5020 } } type = gain_tech which = 5020 } # Mechanized Agriculture
		command = { type = construct which = IC where = 336 value = 1 } #Petrograd
		command = { type = construct which = infrastructure where = 336 value = 0.2 }
		command = { type = dissent value = -2 }
	}

	action = {
		trigger = { flag = RUS_Aid_Extended }
		name = "Fantastic!"
		command = { type = relation which = SOV value = 10 }  
		command = { type = industrial_modifier which = total value = 2 } 
		command = { type = industrial_modifier which = supplies value = 3 } 
		command = { trigger = { NOT = { tech = 5020 } } type = gain_tech which = 5020 } # Mechanized Agriculture
		command = { trigger = { tech = 5020 NOT = { tech = 5030 } } type = gain_tech which = 5030 } # Agri-Chemistry
		command = { type = construct which = IC where = 336 value = 1 } # Petrograd
		command = { type = construct which = IC where = 340 value = 1 } # Sabac
		command = { type = construct which = infrastructure where = 336 value = 0.2 }
		command = { type = construct which = infrastructure where = 340 value = 0.2 }
		command = { type = dissent value = -5 }
	}
	
	action = {
		trigger = { flag = RUS_Aid_Limited } # Same as Normal since Limited only prevents military investments
		name = "Well, beggars can't be choosers..." 
		command = { type = relation which = SOV value = 5 }  
		command = { type = industrial_modifier which = total value = 1 } 
		command = { type = industrial_modifier which = supplies value = 2 } 
		command = { trigger = { NOT = { tech = 5020 } } type = gain_tech which = 5020 } # Mechanized Agriculture
		command = { type = construct which = IC where = 336 value = 1 }
		command = { type = construct which = infrastructure where = 336 value = 0.2 }
		command = { type = dissent value = -2 }
}
}

You should be able to tell at this point what are requirements for event to fire - I'll leave it to you as a little quiz ;) So, as you can see, every action is being bound to a certain flag. If Russia chosen to provide Serbia with normal aid, Serbia will receive some decent buffs. Extended aid will effect in some more decent buffs, elevating Serbia out of poverty quicker. In case of this event chain limited aid means that no military buffs will be given - so in case of military events I will simply not make a limited version action. Usually you'd probably make three events for one improvement - and here you have three options in one event. ;)

And as for command triggers...as you can see I used them for technologies. Yeah, you simply enter them like that, which makes it even more clustered. But if I'd be to write it this way just for you:

Code:
command = {
	trigger = {
		NOT = { tech = 5020 }
	} 
	
type = gain_tech which = 5020 } # Mechanized Agriculture

I believe that you'll understand now, huh? ;) There should be no problem with writing commands this way, I simply prefer to keep everything nice and tidy. As long as brackets are matching, anything goes. In this case, if you have Mechanized Agriculture discovered, you won't get blueprint for it. And take a look at Extended option now:

Code:
command = {
	trigger = {
		NOT = { tech = 5020 }
	} 
	
type = gain_tech which = 5020 } # Mechanized Agriculture

command = { 
	trigger = { 
		tech = 5020 
		NOT = { tech = 5030 } 
	}
type = gain_tech which = 5030 } # Agri-Chemistry

So, if you have Mechanized Agriculture already you'll be given Agri-Chemistry blueprint, but if you have discovered it already, again, you won't get it. Letting it go in this case wouldn't matter much, this blueprint would do no harm anyway, but that's quite a good example of how it works.

Another nice example I found in Kaiserreich Russia's events. During Russo-Mongolian tensions Mongols will leave alliance, but ONLY if they're allied with Russia. Because sometimes they are, sometimes they not - since most of the time they're allied with Tibet. And if they're allied with Tibet, why'd their leave alliance?

Code:
(...)
	action_c = {
        ai_chance = 20
		name = "What!? Siberia is ours!"
                command = { 
				trigger = { 
				alliance = { country = RUS country = MON } 
				} 
				type = leave_alliance }
				
		
		command = { type = trigger which = 750050 }
(...)

Trigger clearly indicates - If Russia and Mongolia are in alliance, leave_alliance command will apply and Mongolia will break its alliance. However, alliance with Tibet has no real effect.

That's about it when it comes to triggering actions and events. Certainly useful, helps in utilizing useless events and commands when by using one or two easy triggers you can make it work with one event. Of course it is not necessary, but since it's a time-saving measure you might consider doing it.

It's really a time-saving measure. I made that Agriculture event in 3 minutes. And I have five more to go. So guess I'll be done in around 20 minutes. And now imagine if I'd be to make every single event for every single flag. Yeah, 18 events. Ain't nobody got time fo' dat! 6 <18, I can tell.

*Explanation on specific commands

To be absolutely honest with you I wanted to make a short list on most common mistakes with some commands, but in fact I have no idea which ones would it be :( So if you have any questions, just post what's bugging ya and we'll come up with solution.

5.) General Words of Finishment

Well, actually I saw quite a few people asking about event guide here and there. Since I suddenly felt into guide mode I decided that I might go for it. Would be nice to cover all major modding aspects at some point, we have almost every tutorial needed in forum. Major .pdf version with all of them anyone?

There might be mistakes and typos so bear with me; or maybe rather let me know so I will fix them.

Any questions, any problems, just post down there, either me or someone else (most likely someone else) will help you out.

I give credits to no one but me because I am the greatest and to Havard who made glorious EU2 Modding Guide, which essentially got me into modding hell long time ago and also made me write a lot of not-that-good-yet-somewhat-useful-guides. I believe that original creators of EU2 AGCEEP also deserve dem credz, here's where I learned how to sort my files nicely and use comments and in general a lot of wise things.

Okay, okay, used some examples from KR, thanks for that guys, now go home just because :( Davis will have a communist party for ya.

Speaking of Havard's guide, knowledge needs to be passed and shown to the people, that's how we can get more and more modders to do things. I hate seeing people in User Modifications saying that "they'd make a mod but they can't".

Now you have almost every guide one might need, countries, events, units, technologies, graphics, anything else? We might lack some (not sure if there's AI guide, I might go for it) and sticky thread for modding help, so if anyone will say that he can't mod once again, well, you know, shotgun bullets are bad fo' yo' health. I'd highly advise to go and educate yourself before you wreck yourself.

I learned how to mod EU2 in a month since I got Internet in 2008, barely knowing English and having no idea about any, even easiest kind of programming. You need some serious excuses to prove me that you can't do it. Unless you are lazier than me, although I take that as impossibiru.

Also, you could see some examples from best mod ever W.I.P, known as Il Risorgimento. I was left alone with it again, and I'm trying to do a comeback with it, but no certain informations until it's ready. Serbian events were one of examples. Until then please treat me like a man who knows nothing; I simpri rack disciprine a rot.

Well, promise is a promise. And it will be done. And maybe one of you guys will make your own mod too, having all those juicy guides around?

Yeah, I hope so.
 
Last edited:
  • 3
Reactions:
My online translator says me that it's really Great and extremely helpful Text and it's so funny :)
GRAND RESPECT!!
 
Last edited:
First of all, thank you for this guide, it's truly excellent.

However, please don't be offended if I point out a few imprecision and I suggest some improvements here and there.

event = {
id = [id]
country = [country tag] / tag = {TAG1 TAG2 TAG3} #optional, default nothing (event valid for ALL countries)
random = yes/no # optional, default no
persistent = yes/no # optional, default no
save_date = yes/no # optional, default no
one_action = yes/no # optional, default no
all = yes/no # optional, default no
invention = yes/no # optional, default no
Country/tag
This section control which countries the event should happen to and must contain only valid country tags. It is possible to specify only one country (with country = [country tag]) or multiples countries (with tag = { [country tag1] [country tag2] [country tag3] }). If the country/tag section is omitted then the event will fire for each country that meets the trigger conditions; however, this is extremely inefficient and it is better to list them in a long tag = {...} section.
Random
If random is set to yes, then the event uses a hard-coded randomization. The use of this option is deprecated as the randomizer is reset on game reload and it is not possible to influence the frequency with which the event fire. Using a "random = X" line in a trigger (see below) allows a better handling of the events. It applies automatically to all nations when no country or TAG = { ... } list is defined. Otherwise it fires only for the specified country or only for countries in the TAG = { ... } list (since DH 1.03 RC3).
Note: If any of the commands in the action is invalid for the country it is checked for, then the event won't fire.
Persistent
If persistent is set to yes, then the event can fire more than once, anytime its conditions are met. Persistent events are not recorded in history section of savegame (which tracks which events already happened so that they cannot happen again).
Save_date
If save_date is set to yes, the number of days passed since that event fired are recorded (and incremented each day by 1) and can be used in the trigger of other events. This can be set in scenario files too, for example the 1940 scenario may record how many days have passed since the Molotov-Ribbentrop Pact event fired: save_date = { 2003025 = 257 }.
One_action
If one_action is set to yes, even if an event has more than one action, only one of the possible actions will be displayed to the player (who therefore will be forced to accept it). The choice of the displayed action is based on the defined AI chance for each action. In this way the player cannot choose the action and is forced to accept whatever happens to him.
All
If all is set to yes and this event is triggered by another event, then it will be executed for all countries in the TAG = { } list or for all countries in the world if no TAG (and no country) is specified.
Note: please be aware that all = yes works only if the event if triggered by another event.
Invention
If invention is set to yes, then the event uses a hard-coded randomization, used specifically for the discovery of techs (and which therefore should not be used for something else). It applies automatically to all nations so it doesn't need a country/tag section. The frequency with which it fires is based on the following parameter from misc.txt:
# Mean number of "invention" events occuring per year
4
I think only country/TAG should be updated, what you wrote about the other headers seems fine.

A few more words about styles if you want:
0 (default value): old style from HOI2, with 156x116 pixels event pictures
1: allows bigger pictures to be used (400x116 pixels) and has smaller action buttons
2: newspaper header, composed as follow:
newspaper Header picture of 400 x 48 pixels; generic (news_header.bmp) or country specific (news_header_TAG.bmp)
display current game date and capital name
event picture
event title
event text
event Effects – if only one action with less then 5 effects
event Action buttons

A few more words about date/offset/deathdate:
Note: the lower the offset (with 1 being the lowest valid number), the higher is the load on the engine (and therefore, the lower the speed of the game). Higher offsets allow better performance.

Sum of AI_chance doesn't have to be 100% (old HOI restriction that has been removed in DH). You wrote, please correct:
If you have more than one action, you can add ai_chance before commands are listed. Ai_chances of all options in your events have to (or at least it'll work nicely ths way) equal 100 in overall. Assume you have three actions: action_a has ai_chance = 70, which means that there's 70% chance that AI will pick it. Action_b has ai_chance = 7, which is 7%, and action_c's ai_chance is 23, which means 23%.

70+7+23 = 100%. You shouldn't be crossing 100% I believe. Making all ai_chances equal less than 100% might work, just no idea what effects you will get. It's highly advised that you stick to 100% rule.

You wrote:
command = { type = trigger which = 90082 where = U11 value = 3 } # Union des Villes de France proclaimed
command = { type = trigger which = 90081 where = VIC value = 2 } # Kingdom of France proclaimed
...
Event 90082 (name in comment) will fire for TAG U11 (where = U11) in three days from now (value = 3),
Event 90081 will fire for TAG VIC (where = U11) in three days from now (value = 3),
No, this will make it fire immediately. Wrong command, it should be "type = event which = 90082 where = U11 when = 3".

You sometime use decision_pane. instead of decision_picture. There is no decision_panel. Also, here's the default picture if you want to add it to your text:
decision_picture = "picture_name.bmp". Optional (there will be a generic picture loaded by default - gfx\event_pics\decisions_empty.bmp), placed on the decision plate

You didn't write (unless I'm wrong) about this:
decision_desc = "....", optional decision specific text (used on tool-tips instead of event description).

You wrote:
Well, technically yes. But when I was testing it in DH 1.3 Full without trigger, AI was taking decision without fulfilling any requirements
I'm surprised to read that you are surprised. AI only checks trigger section of decision (it's like an event for them), so a decision without trigger section is like an event without trigger: always true (for the AI, since it's a decision). Perhaps I'm missing something? But I think how decision works has not been changed since DH 1.00.

You wrote:
command = { type = trigger which = [event id] where = [TAG] value = [x] } # Triggers [event id] event for [TAG] in [x] days from this event.
command = { type = trigger which = 90081 where = VIC value = 2 } # Triggers 90081 Event for VIC in 2 days from this event.
But the correct syntax is:
type = event which = [event id] where = TAG/-1(current country) when = [delay](in days)

There are no problems whatsoever with local_flags, but they are only visible for that specific TAG. So obviously other countries cannot check the local flag of another country.
The main difference is that global flags is probably a very long list. The list of local flags of a specific TAG is probably much shorter, therefore quicker to check (better performances).

Finally, a few tips about performances:
Here are some performance hints that should be taken into account when writing events:
Triggers (no matter if these are for events, actions or commands) should be as simple as possible and those that are most likely to fail should be first;
If there is at least one action that has no own triggers it should be on top of the actions - that's because action triggers are now considered as continuation of the event trigger and there should be at least one valid action in order for the event to fire; actions without triggers are considered as always valid (no matter what commands they have in opposite to 1.2/1.3);
If all actions has triggers, actions with triggers that are most likely to be true should be on top. This will allow for faster event validation (if main trigger is true and there is at least one valid action the event is good to go);
The following two rules have smaller impact, but should be followed too as a good practice.
Commands in actions should be arranged so most likely to be valid commands should be on top of the list.
command = { type = addcore which = 300 } #Invalid for Germany. Province #300 is Berlin
command = { type = money value = 10 } # Always valid command - good to have it on top!
Command without own triggers should be prioritized in commands list over commands using triggers.
 
First of all, thank you for this guide, it's truly excellent.

By pointing out all the mistakes and thingies I forgot you actually proved it's not excellent at all. It makes me look uncool right now :(

But no, seriously, thanks. Guess I fixed all the bugs you mentioned. And hell, I always thought that this trigger works, damn I even tested it and it worked a few times. Or maybe my brain tries to deceive me. Again. :(

Nevertheless, thanks. Should be fixed now.
 
country = x indicates for which TAGs will this event work. If you want to find specific TAG, just go to config/world_names.csv of corresponding mod and search via name of country you want to make event for. I am not entirely sure because I've never tried it, but I assume that if you would do something like that:

Code:
country = { GER FRA SOV }
Event would be avaiable for Germany, France and Soviet Union. Still, it could fire only once, for whoever will meet requirements for it first. Not sure if that works in Darkest Hour, I presume it might, needs some testing.

If you won't add country = { } event will most likely be available for all countries currently existing in game. That's how random events work for example - since they use no country = { }, everyone can get them. On the other hand using TAG(s) in country and setting random from no to yes might effect in random events for just one specific country. You might want to experiment with this.

In Darkest Hour you can define valid countries for events in 3 ways:
1. country = TAG #Valid only for one country
2. tag = { TAG1 TAG2 TAG3 ... TAGx } # valid for all countries in the list
3. No country or tag used - valid for all countries

A quote from event commands.txt:
Code:
tag = { TAG1 TAG2 TAG3 … TAGX }

Added new option to generic events decision used to define countries which this event/decision is available for. No country = TAG should be specified for such events/decisions. The event/decision will be available only for the specified countries. This will greatly improve game speed when a lot of generic events are used for just few countries (set in event’s triggers).
 
persistent = yes and country = { A B C D } should not be used together, or rather they can be, but the behavior is not always what you would expect it to be depending on how you code the event, so make sure to test it.
 
Does this wonderful command work even if you reload a save game in the time period?

Code:
command = { type = event which = [event id] where = [TAG] when = [x] } #  Triggers [event id] event for [TAG] in [x] days from this event.
command = { type = event which = 90081 where = VIC when = 2 } # Triggers 90081 Event for VIC in 2 days from this event.

Cheers,
Sword
 
Does this wonderful command work even if you reload a save game in the time period?

Code:
command = { type = event which = [event id] where = [TAG] when = [x] } #  Triggers [event id] event for [TAG] in [x] days from this event.
command = { type = event which = 90081 where = VIC when = 2 } # Triggers 90081 Event for VIC in 2 days from this event.

Cheers,
Sword

Yes, as long as the queued event is still valid at the time it is set to fire (but that applies even if you do not save/reload the game).
 
Well, I was thinkin' about that, but Mod Documentation folder actually has AI almost fully covered, so I am not sure whether any additional explanation is needed.

For all AI folks: go to Mod Documentation/AI Files Modifiers.txt, technically everything's explained there nicely. It's simply sort of AI file with all commands used and commented out.

I doubt that any more clarification would be needed. Biggest problem with making AI is testing it out - you can check event just by firing it via console, and AI...not really. So it's a tedious job, guess most tedious one out of all modding aspects (maybe except leadermaking, those semicolons can make you feel dizzy).
 
Well, I was thinkin' about that, but Mod Documentation folder actually has AI almost fully covered, so I am not sure whether any additional explanation is needed.

For all AI folks: go to Mod Documentation/AI Files Modifiers.txt, technically everything's explained there nicely. It's simply sort of AI file with all commands used and commented out.

I doubt that any more clarification would be needed. Biggest problem with making AI is testing it out - you can check event just by firing it via console, and AI...not really. So it's a tedious job, guess most tedious one out of all modding aspects (maybe except leadermaking, those semicolons can make you feel dizzy).

Yup, there's no better guide than the one in mod doc, that's the best the devs know more or less.
 
I'll just post here the thing I've just learned a hard way. Please mods move to more appropriate place...

If you want to use NOT = { division_exists ...} trigger you MUST ensure that DORMANT division in question was active at some point otherwise trigger fails! although condition is correct, division doesn't exist...
Example: You have a unit that GER sends to SPA. When GER for any reason decides to stay away from SPA civil war unit is never sent. Later trigger on existence of that unit will fail because it was never activated.

I suspect that other trigger division_in_province works the same way but I haven't tested it.

Good luck.

[EDIT]
If you remove division first and then use above trigger then trigger works. So I guess the correct description for the command is that dormant unit must be activated or removed before trigger works expectedly.
 
Last edited:
Hi, I`ve been using this guide for a couple of days, trying to create an event chain. But it just doesn`t seem to work. The game crushes every time I pick a country. Maybe you could add me in Skype or smthng, so I could send you the code and discuss it in private. *shy*
 
persistent = yes and country = { A B C D } should not be used together, or rather they can be, but the behavior is not always what you would expect it to be depending on how you code the event, so make sure to test it.
Someone care to elaborate? I have tons of persistent events and never once have I had any trouble with them. in what way does country = { A B C D } behave differently frpm trigger = { OR = { tag = A tag = B etc. } } other than that it's better optimized?


On an unrelated note, it's linked in the modding tools thread but it should also be mentioned here that there is a tool available that lets you validate events for syntax errors and other stuff, and it catches quite a bit that DH's built-in validation doesn't. You can download it here. Not needed if you only have a couple of custom events, but if you're creating a mod then you should probably run it at least once.
 
Hello Andrei Gijgorev!
You helped me greatly with regex stuff for the RDD mod a couple of years ago. I'm just saying Hi! and thanks again. Your expertise was much appreciated. Unfortunately that mod didn't come to fruition. The main modder kept starting all over again...