it068

Major
35 Badges
Oct 29, 2011
521
2
  • For the Motherland
  • Europa Universalis IV: Pre-order
  • Cities in Motion
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Iron Cross
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Darkest Hour
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Dharma
  • 500k Club
  • Europa Universalis IV: Golden Century
  • Prison Architect
  • Prison Architect: Psych Ward
  • Island Bound
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV Sign-up
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
Hi all, I've adapted the following event to core the Polish provinces for WW2 Germany after annexing the area, but it doesn't work? I'd like it to trigger about 5 years after 'owning' the concerned provinces.

Here's the event (credit to Kaiserriech for the original template). Basically, could this event be improved? What does 'style' mean? What does 'offset' mean?

event = {
id = 9300162
random = no
country = GER
style = 2

trigger = {
NOT = {
core = { province = 235 data = -1 }
}

owned = { province = 235 data = -1 }
control = { province = 235 data = -1 }
}
name = "The integration of Poland"
desc = "Poland is now firmly integrated into the Greater German Riech."

picture = "militaryparade1"


date = { day = 1 month = january year = 1936 }
offset = 100
deathdate = { day = 29 month = december year = 1963 }

action_a = {
name = " Great!"
command = { type = addcore which = 236 }
command = { type = addcore which = 228 }
command = { type = addcore which = 246 }
command = { type = addcore which = 237 }
command = { type = addcore which = 243 }
command = { type = addcore which = 239 }
command = { type = addcore which = 233 }
command = { type = addcore which = 234 }
command = { type = addcore which = 232 }
command = { type = addcore which = 252 }
command = { type = addcore which = 235 }
command = { type = dissent value = 5 }
}
}
 

Rohi

Sergeant
24 Badges
May 13, 2015
59
76
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Way of Life
  • Victoria 2
  • Europa Universalis IV: Wealth of Nations
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Darkest Hour
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
In Darkest Hour there should be a folder titled, "Modding documentation" located here:
..\Darkest Hour\Modding documentation

Within the "Modding documentation" folder, there is a file named "event commands.txt."
Will now attempt to respond to the questions in this thread by referring to the aforementioned Darkest Hour Modding documentation, on the assumption that the province IDs are correct.

What does 'style' mean?
If recalling correctly, style refers to the position of the image within the event display box. Might be a legacy feature from Hearts of Iron 2, that remained in Darkest Hour.
Note the following comment from "event commands.txt":
Code:
style = 0
#Not currently used can be omitted.
Notice that "style" in the file is located after "Picture", suggesting that the two were related.

What does 'offset' mean?
The "offset" syntax refers to the time measured in days the event trigger will be reviewed once within the specified period.
Here is the reference from "event commands.txt":
Code:
offset = x
# X = number of days. Means the event trigger will be checked once per X days period.

I've adapted the following event to core the Polish provinces for WW2 Germany after annexing the area, but it doesn't work?
Since the event is not working, has the "savedebug.txt" file been checked for any error comments? Have noticed that errors in the savedebug.txt file appear located near the bottom of the file.

If there are no errors, take note of the offset's 100 days:
Have noticed cases where it appear as though an event is not working, but this is because the event takes a while to initiate -- the reason being a lengthy offset time period.

Note the following comment regarding "offset" to provide more clarity here:
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."
Reference: "Event Making Guide for Darkest Hour"

Offset comment aside, while reading the event discussed in this thread, noticed something peculiar with the event's trigger and the instructions within "event commands.txt":
Code:
trigger = {
NOT = {
core = { province = 235 data = -1 }
}

owned = { province = 235 data = -1 }
control = { province = 235 data = -1 }
}

Since the event has been designated to trigger for GER as specified within the event's header, then the event trigger's "data = -1" is referring to GER. However, within the "event commands.txt" file, the following is mentioned:
Code:
core = { province a [data = tag] }
# checks if that province is core for TAG (or country in question, if not specified)

owned = {province = a [data = tag] }
# checks if province is owned by country x. If data = -1 or no data then it's for country receiving event; -2 is Enemy; -3 is allied (war or diplomatic) or event receiver

control = { province = a [data = tag] }
# checks if province is controlled by country x. If data = -1 or no data then it's for country receiving event; -2 is Enemy; -3 is allied (war or diplomatic) or event receiver

Note that the " -1 " option is not mentioned for the "core" trigger, but it is for the "owned" and "control" trigger. It is possible the above distinction could have been an oversight by the author of the file. Nevertheless, it's worth considering the distinction here. So, perhaps change the "-1" associated with the "core" trigger to "GER"...?

So then, here are some items to consider based on the above:
  • Review the savedebug.txt file for error comments;
  • Modify the offset period to a shorter time and test the event;
  • Change the " -1 " from the "core" event trigger, to "GER";
Perhaps someone more experienced with the topic of event writing in Darkest Hour will be around to check on this thread. Who knows.

In the meantime, here's an alternative approach to the event's objective -- the objective being to have Germany acquire cores on its Polish territories:
  • The GER war with POL triggers an event flag (such as "GER_POLCORE" or whatever);
    • The event flag may have to be added as a "command action" into a currently existing event for the GER - POL war;
      • In other words, the event that launches the GER - POL war for GER, also activates an event flag "GER_POLCORE" by a command action;
      • Of course, label the event flag by whatever name;
  • An additional event will need to be created that continuously checks whether or not POL exists and that the GER_POLCORE event flag is active;
    • Again, note the two conditions here for triggering the coring event:
      • Once POL no longer exists and the GER_POLCORE flag is active, the "addcore" event will fire (within the designated offset days, if such days are specified);
    • Once the addcore event has been initiated, the addcore event flag can be cleared by an additional addcore event command's action;
  • The reasoning associated with an event flag in this case, is that it ensures the GER- POL War event has occurred as a trigger;
    • So then, here's a summary:
      • The GER - POL War event (with the event flag edit) activates an event flag (related to GER eventually acquiring cores in Poland);
      • An additional event is created with the following triggers:
        • POL no longer exists; and,
        • GER_POLCORE flag is activated;
        • When the above two trigger conditions are set, the event initiates, and GER acquires its cores.
  • It's probably possible -- and perhaps easier -- to create the event's objective without using event flags (do not know for sure). Here, can think of using an event ID as a trigger. Broadly the concept is that one of the triggers for the GER addcore event, is that the GER - POL War event ID has occurred.
    • Although, when events concern multiple countries, event flags seem to be reasonable as checks and controls and have worked in personal cases.
The alternative approach above might be more complicated since it requires more than one event and proposes using event flags. Once again, others who are more knowledgeable on the topic of modifying Darkest Hour events may have different comments to share.
 
Last edited: