Events can be found as simple text files within \democracy 4\data\simulation\events. Every text file in the folder is considered to be a separate events. every 3 turns, the 'event manager' will evaluate the chances of every single event happening, and if the highest-scoring one has a value above 70%, it is triggered. The score of an event is based on a number of 'influences' that are effects from other items in the game, and once triggered the event runs a script, which effectively creates temporary effects.
The config section
The [config] section of an event has lines for Name and Texture. These are the internal name and the graphic used for display when the player clicks to see details of the event. (we recomend a 512x512 png file anywhere inside your mods 'bitmaps' folder). There is also a GUISound line, which is the name of a sound effect file that will be played while that window is active.
That section also has a line called 'OnImplement' which looks like this:
OnImplement = CreateGrudge(Unemployment,-0.080,0.650);CreateGrudge(GDP,0.030,0.880);CreateGrudge(AerospaceBoom,-0.950,0.970);
This is a 'script' which has a number of 'functions' each of which are separated by a semicolon (;). The functions are always called 'CreateGrudge', and what these do is to create a 'temporary' and hidden object called a grudge, which decays over time, but while it is active, will exert an effect on another object within the game. The Parameters to the function are as follows:
Target Object Name (Internal name for the object we wish to affect...)
Effect value (At the maximum, ie: the start of the grudge)
Decay (Actually the inverse of a decay, so a 0.97 is multiplied by 0.97 each turn. Higher numbers lead to slower decays)
There is no limit to the number of grudges an event can create. Note that most effects create a negative grudge against themselves, to prevent frequent repetition.
The influences section
This is a numbered list of inputs into the event, to determine the likelihood of it being triggered. You can have any input into these items, and also use the magic value of "_random_" which then takes a minimum and a maximum value to be calculated each time the event score is evaluated. This is used to add some random variation. See the basic modding intro for more information on the syntax of effects.
Copyright Positech Games 2020