Note that changing the tags will almost certainly result in the export-to-EU2 function crashing.
CK events are quite different that any previous game's events and it takes some time to become handy at scripting them. You will want to devote some time to reading through existing events to get the general flavour of them, and then use the ...\ck\db\events\event effects.txt file as a reference for most of the available triggers, conditions and effects. There are a few others that the beta team requested that were implemented but aren't documented in the event effects file, and there are some aspects of some of the triggers/conditions that are rather tricky to understand at first and may vary depending on what type of event you're scripting.
Important thing to grasp: there are
three different event types:
- character events - these are events that happen to characters and the game engine tests each character in the game for each of these events on a dynamic basis.
- province events - these are events that effect provinces and the game engine tests each province for each of these events on a dynamic basis.
- province_x_province events - these are the spread events that the game engine tests for pairs of provinces. These are tested for each province, taking each neighbour in turn until either an event successfully triggers or the province runs out of neighbours (at which point it moves on to the next province). Again, these are tested dynamically.
The character events have their own unique triggers/conditions/effects that are (in most cases) different from the ones that are province-related (which apply to both the province and province_x_province events). DO NOT mix up the triggers or effects since the odds are that they won't work!
Also, some triggers behave differently for province events than they do for province_x_province events. Example: "same_religion" in a province event checks to see whether the province religion is the same as its ruler's religion; whereas "same_religion" in a province_x_province event checks to see whether the two neighbouring provinces have are the same religion.
"Dynamic" testing means that each character and province is
not tested for all events every day (or even every month) since that would result in a massive performance hit - particularly since expanding the number and range of events is high on the to do list for both the developers and some of the betas. The best rule of thumb (athough not strictly an accurate one) is to assume that during any given year of game play each character and each province will be tested about 3 or 4 times for every event.
Available ID ranges:
- Event IDs below 5000 are reserved for Paradox use only. Do not use an ID in this range if you're scripting events.
- Event IDs in the 5000-9999 range are reserved for beta testers and are being "booked out" in blocks of 100 event IDs. Do not use these IDs since it's likely that most will get used during the upcoming months. (That's a handy way to see who wrote events
)
- Event IDs from 10000 up are "reserved" for public use (that means you!) so you can use any of those that you wish without fear that it will later conflict with either a developer or beta event that will be in future DEMs. As a community, you may wish to "parcel" these for specific large scale projects so you don't conflict with one another, and I think you'll understand that Paradox will not support any bugs or CTDs caused by events in this range.
Very important concept: MTTH (=mean_time_to_happen)
Events are tested based on their probability to happen, not on a specific set-in-stone date (although date may be a component of the event trigger). Loosely, this is based on a statistical concept used in materials testing and analysis called "mean time to failure". A web search will show you some of the complexities of this system for those who are mathematically inclined but may need to bone up on their statistics.
Each event is assigned a MTTH value in either days, months or years. It is recommended that you avoid using very large or very small numbers since in testing we have observed some "clipping" due to processor rounding. This assigned value is plugged into a hard-coded formula that determines the odds of an event firing and then compared to the result of a RNG to see if it fires in any particular instance. This means that events are
not tracked to see how many times it has been tested for someone (or some province) and frees up vast amounts of CPU and memory for other game functions.
The net effect is that assigning a MTTH of 1 year
does not mean that the event will fire in 1 year. It means that the mean time to happen is one year, but the formula being used has a rather long head and tail so it could fire in a matter of days, or it could fire years from now (or never) depending on what number the RNG produces. Think of it as predicting the results of a die roll. You can calculate the odds of a certain result, but you can't
guarantee that any given test will produce it. You could, theoretically, have a test that *never* produces the result - although the odds of this happening are staggeringly small.
Further, there are currently (as of 1.00 and 1.01) some hard-coded "cheats" being used as part of the processor optimization process that are helping to keep the game performance as high as possible but are resulting in some slightly negative effects on "real" MTTH as opposed to statistically determined MTTH. This is being worked on, but for now I would recommend using a lower MTTH value than would be empirically calculated in order to have your events trigger when you want them to, and then test your event repeatedly in a controlled environment to determine if its frequency is roughly what you desire. My personal rule of thumb - and this is a personal reccomendation, not an official one - is to use an MTTH value that is about 25% lower than the one you would normally expect to use.
Example: if I want something to have a *real* MTTH of 10 years I would usually set the event MTTH to about 7.5 years. To repeat an earlier caveat, though, this doesn't guarantee that the event will fire in 10 years - it merely results in the effective event MTTH being about 10 years and repeated testing will probably produce a mean firing frequency of 10 years. It could fire in a day, or it could fire 100 years from now. I conducted several thousand controlled statistical tests on both the advances_discovery and advances_spread events when I scripted them to ensure that they were WAD with the MTTH values I'd assigned them, and I would recommend that anyone doing "critical" event scripting conduct similar testing.
Some more tips:
Don't forget to use MTTH modifiers since they tend to make events more interesting and more "fun" for the players - and decrease the average person's ability to guess roughly when an event will fire. In particular, use monarch or kingdom stats in tiers (i.e. apply different modifiers depending on how good or bad the martial skill is), or power settings in tiers. In character events, don't forget to throw in some traits modifiers to increase the importance/effect of having a certain trait. There is plenty of fun to be had with these!
Caveat: don't forget, when scripting, that all modifiers that are valid (i.e. the condition test results in "true") are multiplied together to produce a modified MTTH. This is a common error that can be made when scripting tiers.
In province_x_province events, don't forget that you *must* specify either "to" or "from" in almost every trigger, condition and effect. For the few that you don't have to specify, either the "to" province is used or the condition is a comparison between the two provinces.
There are probably more tips, but those are the ones that spring to mind right now.
Have fun!
![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)