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

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

^_AC_^

Field Marshal
86 Badges
Feb 24, 2009
5.728
421
  • 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
  • Crusader Kings II: Conclave
  • 500k Club
  • Stellaris
  • Europa Universalis IV: El Dorado
  • Imperator: Rome Deluxe Edition
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Imperator: Rome
  • Europa Universalis IV: Common Sense
  • Stellaris: Ancient Relics
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Cossacks
  • Hearts of Iron IV: Cadet
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Stellaris Sign-up
  • Stellaris: Megacorp
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV
  • Europa Universalis IV: Rights of Man
  • 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
  • Crusader Kings II: Holy Fury



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:
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?