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

dharper

Dei Gratia author
86 Badges
Aug 7, 2002
20.705
2.371
  • Victoria 2: Heart of Darkness
  • Majesty 2
  • March of the Eagles
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Knights of Pen and Paper +1 Edition
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Humble Paradox Bundle
  • Europa Universalis IV: Common Sense
  • Stellaris: Necroids
  • Divine Wind
  • Cities in Motion
  • Crusader Kings II
  • 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
  • Europa Universalis III
  • Europa Universalis III Complete
  • Arsenal of Democracy
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
  • Heir to the Throne
  • Impire
Having struggled with writing events and seeing the many posts asking for help with them, I have decided to write a troubleshooting guide with the problems (and solutions) I have come across. I hope this will help others who are trying to write events. If anybody has other problems they have come across, I welcome their addition! :D

First of all, before you do anything else, go read Havard's Event Scripting Bible if you haven't already.

Now, without any further ado...
 
Error message problems

PROBLEM: 'unknown lhs' error message

CAUSE: One of your events has an open {...that is, a 'left hand side' (lhs) without a matching right hand side (}).

SOLUTION: You probably received several error messages at the same time if you pressed ignore. All of them deal with the same event. You may be able to tell which event it is from the line number (if your software supports that) or from one of the commands or names. If not, try manually triggering each event in the game (hit 'ignore' to get into the game) until one of them doesn't happen. The event before it is probably the cause. Look for it, especially at the end of a trigger or an action. No events after this in the same file will trigger, as the game stops reading it after an error.

CAUSE 2: If you've looked and you can't find any unmatched parentheses, your problem may be an unexpected space. The game treats spaces as code, but this problem can be hard to find!

EXAMPLE 2:
command = { type = stability value = - 1 }
should be
command = { type = stability value = -1 }

SOLUTION 2: When you get the error message it usually tells you the line immediately after the line with your mistake. Look for this line and go over it with a fine-toothed comb for any mistakes. The smallest mistakes are often the worst.



PROBLEM: 'file = ...held sway.' error message (or a similar file = ...text)

CAUSE: One of your events has a description that goes beyond the game's limit of 255 characters.

SOLUTION: The easiest solution is to do a search for the text shown in the error message, then edit that description to be shorter.

SOLUTION 2: If you absolutely must have a long description, you can change the event so it uses the 'EVENTDESC' format that Paradox uses in the text.csv file (in the config directory). There is no theoretical limit to the text you can use in this file - but you should still be careful, as some users have reported that they can't scroll down an event description (especially with the 'At the Walls of Paris' event ending the French Wars of Religion).




PROBLEM: 'unknown command' error message

CAUSE: The game doesn't understand one of your commands. Probably you have omitted or misspelled a critical word.

EXAMPLE:
command = { domestic which = innovative value = 1 }
should be
command = { type = domestic which = innovative value = 1 }

SOLUTION: Do a search for the unknown command and correct it. You may want to repeat the search, since I know I have a habit of repeating the same stupid mistake several times.



PROBLEM: 'database mismatch' error message.

CAUSE: Two events have the same ID number. The game can only accept one event for every unique ID.

SOLUTION: Luckily for you, there is an almost inexhaustible source of IDs for you to use. Numbers 1-15000 are reserved for Paradox use. If you're using a number in that range you may well have hit a Paradox event. Otherwise, you've probably just written the same one twice, perhaps while copying and pasting. If you have dozens of events, you may want to test to see which event is the problem by triggering them manually (in F12 mode) in your scenario to see which ones work.

CAUSE 2: This error also comes up if an event refers to itself - that is, event A triggers or sleeps event A. You'd expect that this would cause an infinite loop of events, but it doesn't; the game only allows the event twice.

SOLUTION 2: Check to see which event is causing the problem and give it the proper reference. In general, make sure that you change any embedded events when you change event IDs!
 
Last edited:
Originally posted by dharper
Having struggled with writing events and seeing the many posts asking for help with them, I have decided to write a troubleshooting guide with the problems (and solutions) I have come across. I hope this will help others who are trying to write events. If anybody has other problems they have come across, I welcome their addition! :D

First of all, before you do anything else, go read Havard's Event Scripting Bible if you haven't already.

Now, without any further ado...
Great initiative! I have though of answering your PM on this, but have forgot ;)
 
In-game problems

PROBLEM: The event has a zero effect (centralization = 0, stability = 0)

CAUSE: You have used the wrong connector. When the game looks for the value, it doesn't find anything and assumes you meant zero.

EXAMPLE:
command = { type = stability which = 1 }
should be
command = { type = stability value = 1 }

SOLUTION: Go to the event in question and look at the commands. Usually the problem is use of 'which' instead of 'value' or 'value' instead of 'data'. If you're unclear what the proper wording is, try Havard's Bible.



PROBLEM: Event never triggers even when conditions are met (but the event can be triggered from F12).

CAUSE: The most likely problem is a lack of a deathdate. For events that have a trigger (instead of a date), you must include a deathdate for them to trigger.

SOLUTION: Find the event and add a deathdate.

CAUSE 2: The game only loads events it has been told to. If you make a new event file, you will need to tell the game to read that event file - just putting it in the same directory as others won't work. Some scenarios have their own event files, so check to make sure which files are being loaded by the game (this can be especially important for players of the EEP - the fantasy events are not loaded if you're playing the historical campaign).

SOLUTION 2: The events file is usually events.txt, found in the db directory. Add the file to the events.txt (or events1.txt for the EEP) file.

CAUSE 3: If neither of these is your problem, you may have written the trigger condition wrong - province numbers can be tricky and if you're cutting and pasting from another event you may have left in something that shouldn't be there.

SOLUTION 3: Check the trigger in the event text. Especially check any province numbers (an easy way to do this is to search for the number in province.csv, but a faster way is to download the EU2 Provinces Lookup program). Other triggers could be events that you removed or altered or a mistyped date.



PROBLEM: Event flashes when player receives it and disappears almost immediately.

CAUSE: The event has no effect on the player. This occurs if there are NO valid effects from choosing any action.

EXAMPLE: France receives a message indicating a revolt in Provence. However, France does not control Provence.

SOLUTION: Change the trigger so this event only occurs if there will be an effect (with this example, that France owns Provence).

SOLUTION 2: Add a minor effect to every choice that always has an effect. Lots of events can have almost negligible effects. One of the easiest is to add or subtract VP for a choice, but monarch ability, stability, domestic policy sliders, or commands using random provinces or random countries always work as well.



PROBLEM: AI treats a multiple-choice event as a single-choice event. When the player triggers the event him- or herself, the event flashes and disappears.

CAUSE: One or both of the choices have no effect and so are disregarded. See previous problem.

EXAMPLE: France receives an event which forces it to accept a stability drop or lose the province of Provence. France does not control Provence - therefore it automatically loses stability.

SOLUTION: See previous problem.



PROBLEM: Event crashes when you place the mouse pointer over a choice.

CAUSE: There are no effects for the choice.

SOLUTION: Never create a choice with no game effects. See the previous 2 problems.



PROBLEM: The event title and text are replaced with an error message, but the event works fine.

CAUSE: You do not have any text whatsoever in the description.

EXAMPLE:
event = {
id = 15800
name = "The German Confederation"
desc = ""

SOLUTION: Add a description.





PROBLEM: Event title or description reads 'EVENTDESC101' or similar.

CAUSE: The event is looking for its title or description in the text.csv file (in the config directory) and either it has not been added, or it has a different name, or is missing some syntax.

SOLUTION: Check the text.csv file, or simply write the title and description in the events file yourself. Note that you can write semicolons (;) in the events file but not in text.csv.



PROBLEM: An event meant for the AI has happened for the player.

CAUSE: This happens when an event has no country listed. Such events are chosen by the human player automatically.

EXAMPLE:
trigger = { owned = { province = 312 which = -1 }
The player, playing the Cherokee (far, far away from Europe) receives the event.

SOLUTION: You must put a country in the event if you want it to be triggered by the AI. Yes, this may mean copying the event several times if you want several countries to be affected by it. Sorry, but it's the way things work.

SOLUTION 2: You can get away with not adding a country by making an event random. Random events can still have specific triggers so only certain countries will get them (e.g. all countries of a single religion). However, random events seem to happen about once a year per country and there is no guarantee that a country will receive your particular random event...ever. This is obviously not a solution for every event, but it works for those with no time constraints.



PROBLEM: An event written for every nation of a particular religion fails to work.

CAUSE: Same as previous problem.

SOLUTION: Same as previous problem.



PROBLEM: An event works fine the first time, but it never triggers again.

CAUSE: This is a design feature, not a bug. The game is set up so that an event will not happen if it has already happened once - otherwise, you could get events like the War of the Spanish Succession twice!

SOLUTION: There really aren't many ways around this. The best solution is to write the event once for every time you want it to trigger. For best results you will need to give it slightly different trigger conditions each time - perhaps simply a different offset time - to avoid all the events happening at the same time.

SOLUTION 2: Random events can occur many times over the course of the game, and they can be set to a single country. The downside to this is that you can't control when a random event will appear, and it simply may never appear at all if you're spectacularly unlucky. The only way around this would be to erase all the random events in the game (not tested).



PROBLEM: The event triggers correctly, but some or all of the effects don't happen at all.

CAUSE: The most obvious cause is that the country receiving the event doesn't own the provinces affected. If an event command is set to affect numbered provinces (or countries) but these provinces (or countries) don't exist, nothing will happen. Exception: the COT and provinceculture comands still work!

EXAMPLE: An event creates a rebellion in Flanders, but Holland ceded it to France earlier.

SOLUTION: If the location is not important, use the -1 (random) code instead. If the location is important, you can either set the trigger so it only pops up when it's possible, or you can write two events (with each other as NOT triggers) that cover two possible countries that could possess the province in question.

CAUSE 2: Be very careful with syntax when you're scripting events. Sometimes the syntax changes and in some cases, the game will simply ignore the command entirely.

EXAMPLE 2:
command = { type = provincereligion which = protestant value = -2 }
should be:
command = { type = provincereligion which = -2 value = protestant }

SOLUTION 2: All I can say is, check your syntax! Havard's guide is irreplaceable in this regard. I keep it handy whenever I'm writing events.



PROBLEM: The event works fine and there are no error messages, but not all the options show up!

CAUSE: Each option must have a different option letter, from a to d - and the game doesn't like more than four options.

EXAMPLE:
action_a = {
name = "Kill them all!"
command = { type = revoltrisk which = 100 value = 60 }
}

action_a = {
name = "Let them live."
command = { type = VP value = 5 }
}

SOLUTION: Make sure that each action has a different letter. (Also remember that regardless of the order, action A is the 'historical' action that is chosen by the AI about 85% of the time.)
 
Last edited:
Specific problems with effects not covered above

PROBLEM: An event gives a nation a huge number of ships, causing them to go bankrupt.

CAUSE: The event gave them a negative number of ships at a location where they had fewer than that number present. When this happens, the game can't understand the negative number and starts again from the top - with hundreds of them.

SOLUTION: Never use a negative value for ships.



PROBLEM: An event makes a nation change to 'exotic' (worst) techgroup when it wasn't supposed to.

CAUSE: The orthodox techgroup is spelled 'torthodox' (only Paradox knows why). If you type in 'orthodox' instead, the game defaults to exotic. No, I don't know why that is, and yes, it seems a bit strange to me, too.

SOLUTION: Change 'orthodox' to 'torthodox'.
 
Last edited:
Re: Re: Event Troubleshooting Guide (or: Why doesn't my event work?)

Originally posted by Havard
Great initiative! I have though of answering your PM on this, but have forgot ;)

Havard, your event scripting Bible singlehandedly saved me from going insane about a dozen times! If I hadn't had it, I would have given up on scripting a long time ago. I figured the least I could do to return the favor was to help other people...
 
Re: Specific problems with effects not covered above

Originally posted by dharper

PROBLEM: An event makes a nation change to 'exotic' (worst) techgroup when it wasn't supposed to.

CAUSE: When the computer can't read the techgroup it replaces it with 'exotic', the default group. The most likely cause of this is the orthodox tech group, which is spelled 'torthodox'. No, I don't know why that is, and yes, it seems a bit strange to me, too.

Are you sure about this one?

When I was checking this I found that while using 'orthodox' instead of 'torthodox' indeed change to exotic any other misspelled name (like 'ortodox') would give an error message...
 
Re: Re: Specific problems with effects not covered above

Originally posted by Havard


Are you sure about this one?

When I was checking this I found that while using 'orthodox' instead of 'torthodox' indeed change to exotic any other misspelled name (like 'ortodox') would give an error message...

You're probably right. That's the only techgroup error I've ever seen, so I extrapolated from it. I'll change it so I don't mislead anybody.

Thanks for pointing that out! :)
 
Great stuff.

Suggestions
-for the 'no country' problem, an event can always be made random so that it WILL affect all countries.
-I have a feeling the ship error happens with troops too (i.e., command = { type =INF which = -1 value = -5000} ). Though not with the desertion command. I haven't checked this, anyone know?
-vps are always a good "filler' command
 
Re: Specific problems with effects not covered above

Originally posted by dharper
PROBLEM: An event gives a nation a huge number of ships, causing them to go bankrupt.

CAUSE: The event gave them a negative number of ships at a location where they had fewer than that number present. When this happens, the game can't understand the negative number and starts again from the top - with hundreds of them.

SOLUTION: Never use a negative value for ships. This may also be the same for troops (not tested), but there is a simple solution: the desertion command, which deals with negative numbers of troops by reverting to zero seamlessly.



PROBLEM: An event makes a nation change to 'exotic' (worst) techgroup when it wasn't supposed to.

CAUSE: The orthodox techgroup is spelled 'torthodox' (only Paradox knows why). If you type in 'orthodox' instead, the game defaults to exotic. No, I don't know why that is, and yes, it seems a bit strange to me, too.

SOLUTION: Change 'orthodox' to 'torthodox'.
 
Originally posted by Isaac Brock Suggestions
-for the 'no country' problem, an event can always be made random so that it WILL affect all countries.
-I have a feeling the ship error happens with troops too (i.e., command = { type =INF which = -1 value = -5000} ). Though not with the desertion command. I haven't checked this, anyone know?
-vps are always a good "filler' command

Good ideas. I've gone and edited my suggestions to include these. I've also added two more of my own, but I think this is it from me...

Dave
 
Added the 'database mismatch' error message.
 
Originally posted by nelly644
I think this should be stickied.
In addition to that I'd like to add it to the Scripting Bible. With proper credit of course :) ("dharpers's Event Troubleshooting Guide"?).

If it's ok for dharper, that is... :)
 
Originally posted by Havard
In addition to that I'd like to add it to the Scripting Bible. With proper credit of course :) ("dharpers's Event Troubleshooting Guide"?).

If it's ok for dharper, that is... :)

I'd be more than happy to add it to the guide. :D That's the first place I'd look for help on scripting an event, and I think other people will think so, too. Consider it yours! I don't need credit.
 
event in an existing game

I just created an event for Byzantium (as a test, I just found out that you can make your own events). To test it, I've tried it out on a saved game but it doesn't trigger :(
Is it possible that you have to start from scratch ?
 
Added two more problems to the in-game problem section: one or more actions doesn't show up; and some or all of the effects of an event don't happen.
 
Re: event in an existing game

Originally posted by stapper
I just created an event for Byzantium (as a test, I just found out that you can make your own events). To test it, I've tried it out on a saved game but it doesn't trigger :(
Is it possible that you have to start from scratch ?

I've had new events appear when I reverted to a saved game...actually a little annoying since on day 1 suddenly twenty events popped up. That was when I realized the value of deathdates...;) But I'm pretty sure it's possible to do.

Is it possible that something else is the problem?

1. Where is your new event? If it's in a new file that the game didn't load, this is the problem. Try moving it into one of the other files, or add the file name to the events.txt file. If you're playing the EEP or MKJ scenario you'll need to make alternative arrangements.

2. What are the event triggers? It's so easy to make a mistake with these - I ended up spending an hour trying to figure out why none of the German states were suffering my Peasants War events, only to discover instead of telling them to revolt in countries with high serfdom, I'd told them to revolt only in countries that had the lowest serfdom possible. :D Then there was the time that I had Luther coming back from his trial a year before the trial started, thanks to a typo in the date trigger...so check that, too.

3. An obvious question - are you getting any error messages when you load the event? If so, this is your problem right there. An error in or before your new event will cancel alllll the other events in your file. In my case, that's a LOT.

4. If these don't work, try posting the full text of the event. Sometimes there's something else present.

Hope that helps...
Dave
 
Re: Re: event in an existing game

Originally posted by dharper


I've had new events appear when I reverted to a saved game...actually a little annoying since on day 1 suddenly twenty events popped up. That was when I realized the value of deathdates...;) But I'm pretty sure it's possible to do.

Is it possible that something else is the problem?

1. Where is your new event? If it's in a new file that the game didn't load, this is the problem. Try moving it into one of the other files, or add the file name to the events.txt file. If you're playing the EEP or MKJ scenario you'll need to make alternative arrangements.
At the end of your savefile there is a list of all the event files included in the savegame. Your event need to be in one of those files. You can either add a new filename to the list or put it into an existing file.

Placing the new filens in events.txt will help for new games.
 
1. Where is your new event? If it's in a new file that the game didn't load, this is the problem. Try moving it into one of the other files, or add the file name to the events.txt file. If you're playing the EEP or MKJ scenario you'll need to make alternative arrangements.

I put it in a new flavor event (for not disturbing the mayor file for BYZ). I also added the name and path in the text.csv.

2. What are the event triggers? It's so easy to make a mistake with these - I ended up spending an hour trying to figure out why none of the German states were suffering my Peasants War events, only to discover instead of telling them to revolt in countries with high serfdom, I'd told them to revolt only in countries that had the lowest serfdom possible. Then there was the time that I had Luther coming back from his trial a year before the trial started, thanks to a typo in the date trigger...so check that, too.

The triggers where : exist = BYZ and exist = BYZ owned = { province = 361 data = -1 } owned = { province = 359 data = -1 } owned = { province = 475 data = -1 }
I've found out that the style = 1 doesn't go wel with date { year = 1700 } (that as for testing in my current game).

I restarte a game and got my events nice and propperly. More hoinest is to admit that I got 9 error messages but after correcting : whauw :)

But I had testet almost every command and found out that to add core provinces, you have to put them at the top of the list of commands. Also, he refuses to give several gainbuildings in one province (he gave me twice a shipyard instead of a shipyard and a barrack). Neither is he very happy with gainmanifacture after gainbuilding.

In every case THX for the nice hints and tips here. O wil the Ottomans, Mamelucs and Persian headens quiver for the midght of the renewed power of the second Rome :D

# Fixed the 'size' tags. ~Havard
 
Last edited by a moderator:
Originally posted by stapper

I put it in a new flavor event (for not disturbing the mayor file for BYZ). I also added the name and path in the text.csv.

You need to have this flavor_byz.txt (or whatever you called it) included in event.txt.