Darkest Hour - Dev Diary #13 - Modding with Darkest Hour Part 3

  • Hearts of Iron IV Survey

    Help us make HoI IV better by sharing your experiences in this 5 minute survey


  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

^_AC_^

Field Marshal
84 Badges
Feb 24, 2009
5.521
186
  • Victoria 2: A House Divided
  • Sengoku
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Magicka
  • Leviathan: Warships
  • Knights of Pen and Paper +1 Edition
  • Victoria 2: Heart of Darkness
  • War of the Roses
  • Hearts of Iron IV Sign-up
  • Europa Universalis III Complete
  • The Showdown Effect
  • Warlock 2: The Exiled
  • Stellaris
  • 500k Club
  • Stellaris Sign-up
  • Europa Universalis IV: El Dorado
  • Prison Architect
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Common Sense
  • Stellaris: Ancient Relics
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Golden Century
  • Cities: Skylines - Green Cities
  • Imperator: Rome
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV
  • Tyranny: Archon Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars
  • Imperator: Rome Deluxe Edition



Today we're going to talk about the improvements we made to the existing event system.

First all, you'll be happy to know that now events can have an unlimited number of action, we are no more bounded by a maximum of 4 choices. You can create an event with as many action as you want, you're only bundled by the size of your screen. :)

But this is just the beginning. Perhaps the greatest improvement we made to the event system is the introduction of triggers in action and commands. This means that a trigger can be associated to an action and that action will be displayed and selectable only if its trigger is satisfied. The same happens for commands: a single command can have a trigger and that command will be executed only if its trigger is satisfied. This change opens a whole new dimension for event writing because with only event you'll able to attain results that previously required many different events (or where altogether not reachable!). Let us give you a few simple examples of this feature.
Example 1 - you can have different actions based on the government:
Code:
action = {
	trigger = { government = democracy }
	command = { ... }
}
action = {
	trigger = { government = communist }
	command = { ... }
}
action = {
	trigger = { government = nazi }
	command = { ... }
}
Example 2 – a command can be executed only if the trigger is satisfied (surrender of France):
Code:
action = {
	command = { type = secedearea which = GER value = "Bourgogne_Champagne" }
	command = { type = secedearea which = GER value = "Lorraine_Alsace" }
	command = { type = secedearea which = GER value = "Pas de Calais" }
	command = { type = secedearea which = GER value = "Paris" }
	command = { type = secedearea which = GER value = "Normandy" }
	command = { type = secedearea which = GER value = "Loire" }
	command = { type = secedearea which = GER value = "Brittany" }
	command = { trigger = { control = { province = 87 data = ITA } } type = secedeprovince which = ITA value = 87 } # Nice
	command = { trigger = { control = { province = 86 data = ITA } } type = secedeprovince which = ITA value = 86 } # Toulon
	command = { trigger = { control = { province = 90 data = ITA } } type = secedeprovince which = ITA value = 90 } # Grenoble
	command = { trigger = { control = { province = 91 data = ITA } } type = secedeprovince which = ITA value = 91 } # Chambery
	command = { trigger = { control = { province = 94 data = ITA } } type = secedeprovince which = ITA value = 94 } # Corsica 
}
As you can see, now you don't have to write action_a, action_b, action_c and action_d anymore, but a simple action is enough. Obviously the old syntax is still valid, as we always said we want to keep compatibility with HOI2 Armageddon mods.

This change also required a new system to calculate the ai_chance. We therefore created this new set of rules:
- sum of AI chances of all valid actions could be any positive number (removed fixed sum = 100 prerequisite);
- invalid actions are skipped in AI chances calculations;
- actions without specified AI chances are ignored by the AI if there is at least one valid action with AI chance set;
- if no AI chance is set for valid action, random action is chosen from all valid actions (removed increased chance to pick 1st action);

Another feature we introduced are the so called one-action events. This means that when this option is selected (by writing one_action = 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 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.
An example is perhaps worth more than many words: the effects of the attack on Pearl Harbour can be written as a one_action event, so that neither the Japan nor USA can choose the amount of losses inflicted on the American fleet.
Code:
event = {
	id = 1122334455
	random = no
	country = USA
	one_action = yes

	name = "Attack on Pearl Harbour!"
	desc = "4062desc"

	action = {
		ai_chance = 10
		name = "We suffered very heavy losses"
		...
	}
	action = {
		ai_chance = 50
		name = "We suffered heavy losses"
		...
	}
	action = {
		ai_chance = 15
		name = "We suffered light losses"
		...
	}
	action = {
		ai_chance = 5
		name = "We suffered very light losses"
		...
	}
}
When this event is triggered, only one action is displayed to the player and the probability of a single action is based on the ai_chance. The same rules explained above apply here, so it is not necessary to have the sum of ai_chance equal to 100. So the second action ("We suffered heavy losses") has a probability of being chosen equal to 50/(10 +50 +15 + 5) = 62.5 %.

Fianlly, the last feature we're going to talk about today is the events with saved date. It is possible to save the date in which an event fired and then use it as a trigger in another event, for example to make an event fire at least 100 days after another event fired.
Example: the first event will have save_date = yes:
Code:
event = {
	id = 1234567890
	random = no
	save_date = yes
	country = GER
	...
}
The second event will have:
Code:
trigger = { 
	event = { id = 1234567890 days = 100 }
}

Darkest Hour Complete will make full use of these new features, but some of the mods currently being ported to DH will use them too! Wait&See! ;-)

Here are a couple of screenshots from our Development Team:

 
Last edited by a moderator:

MannheimCouncil

Major
37 Badges
Dec 25, 2008
733
1
  • Hearts of Iron II: Armageddon
  • 500k Club
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sengoku
  • Semper Fi
  • Europa Universalis: Rome
  • Victoria: Revolutions
  • Lost Empire - Immortals
  • Heir to the Throne
  • Arsenal of Democracy
  • Crusader Kings II
  • Darkest Hour
  • Deus Vult
  • Europa Universalis III Complete
  • Divine Wind
  • For the Motherland
  • Hearts of Iron III
  • Age of Wonders: Planetfall Deluxe edition
  • Europa Universalis III Complete
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Premium edition
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Rise of Prussia
  • Pride of Nations
  • 200k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Stellaris: Synthetic Dawn
This is looking better and better. With a bit of luck I won't need to play HOI3 anymore ^^
 

chepaeff

Absolutely heretical
5 Badges
Aug 9, 2009
1.180
1.478
  • Darkest Hour
  • Crusader Kings III
  • 500k Club
That's really nice improvements. No wonder so much mods were announced on DH
 

Cybvep

Field Marshal
May 25, 2009
8.465
124
Sounds great!

How will you exactly represent Pearl Harbour? Will the event remove random ships, even if they are stationed elsewhere, or maybe USA will get a negative modifier for X amount of time?
 

Tankist/45

Major
10 Badges
Jul 1, 2009
678
86
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • Darkest Hour
  • Hearts of Iron III
  • Iron Cross
  • Semper Fi
  • 500k Club
  • Stellaris Sign-up
  • Stellaris: Synthetic Dawn
  • Stellaris: Megacorp
All this is awesome. Will modding part 4 and 5 (and maybe 6) diaries be published before release?:)
 

FOARP

Field Marshal
49 Badges
Sep 10, 2008
6.076
3.647
  • Crusader Kings II
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sword of the Stars
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Naval War: Arctic Circle
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III
  • Gettysburg
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Arsenal of Democracy
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Hearts of Iron IV: Expansion Pass
  • Steel Division: Normandy 44 -  Back to Hell
  • Steel Division: Normand 44 - Second Wave
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Steel Division: Normandy 44
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Way of Life
  • Mount & Blade: With Fire and Sword
  • Mount & Blade: Warband
  • 500k Club
  • Warlock: Master of the Arcane
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV