Examples of Scripted Events

by Wahnsinniger

Basic Concepts of Triggers/Actions/Events/Missions

First, there is the “Map”. If the map is a “War Custom”/”Peace Custom” then it can have any number of “missions” (Kingmaker and Free Build maps do not have missions). Missions are like chapters in a book. The map is preserved in-between missions, thus any buildings you build in “Mission 1” will be there in “Mission 2”. This holds true for ANY estates you or the AI take during a mission (they all roll-over to the next mission).

Next, missions consist of “Events”. Events define what happens in a mission. They set the winning and losing conditions. They also control basically EVERYTHING else. Thus knowing and loving events is the key to making any good war/peace map.

Events consist of “Triggers” and “Actions”. Exactly the same as “Cause” and “Effect”. An event can have ANY number of triggers, but it can have only ONE action. EVERY trigger you specify must be true for the given action to happen.

Example 1
Action: ‘Win’ Trigger: ‘No Wolves left on Map’ & ‘Recruit 20 Archers’
For you to win this map, you must have eliminated ALL the wolves on the map AND recruit 20 archers. If you killed all the wolves, but have only 10 archers, you will not win.

Now, what if you want one or the other?

Example 2
Action: ‘Win’ Trigger: ‘No Wolves left on Map’
Action: ‘Win’ Trigger: ‘Recruit 20 Archers’
If these are two separate events, then either one has to happen for you to win. Either you can kill all the wolves, or you can recruit 20 archers. You do not need to do both.

Advanced Concepts of Triggers/Actions/Events/Missions

Events can also happen only once. Say you have an event that will give you 500 gold if you gather 50 wood. You gather 50 wood, and you get 500 gold. Then you build a couple buildings, bringing your wood down to 20. Soon, your wood jumps back up over 50 again. The event will not occur again. You don’t get more gold. It will only occur once.

Top-Down Hierarchy: This is more complex, and you probably will not run into this on your very first map (I’d hope). Say you have two events listed one after the other. They both have the same trigger(s). However, the first event causes the trigger to turn off. The second event in the list will not occur.

Example 3
Action: ‘Win’ Trigger: ‘No Wolves Left on Map’
Action: ‘Wolf Invasion 10’ Trigger: ‘No Wolves Left on Map’.
Let’s examine. If you wipe out all the wolves on your map, you win. The wolf invasion would not happen because the game would go to “win” before it ever tries to activate the wolf invasions.

Let’s see a counterexample.

Example 4
Action: ‘Wolf Invasion 10’ Trigger: ‘No Wolves Left on Map’
Action: ‘Win’ Trigger: ‘No Wolves Left on Map’
At first glance, you might assume this would work just like the previous example. WRONG. Because events occur in a hierarchical order, this has a vastly different effect. Once you wipe all the wolves out, the game will first trigger the wolf invasion because it is higher up on the list. Next the game will check the second event. Since there are now 10 wolves on the map, the trigger ‘No Wolves…’ is no longer valid. Thus you don’t win! (Luckily, this is not a never-ending loop. Since an event can only happen once, all you need to do is to kill the 10 wolves that just invaded, and you will win, since the wolf invasion can only happen ONCE.)

Quests: quests are a way to add a small measure of more versatility to missions. You could use them to subdivide a mission into several parts, each using some sort of quest which unlocks things when it is completed. They are really just a way to group together your events into easier-to-read pieces. In fact, that’s about ALL they do. There are 3 quests that you can assign. They are appropriately called A, B, & C.

Quests have 3 possible states too. They are either ‘Complete’, ‘Not Complete’, or ‘Failed’. You can use the two actions provided to set quests to either ‘Complete’ or ‘Failed’. Some triggers act on whether quests are “Complete” or “Not Complete”. In these cases, “Not Complete” also includes if a quest has Failed.

Let’s look at some basic functionality.

Example 5
Action: “Quest A Complete” Trigger: “No Wolves left on Map”
Action: “Win” Trigger: “Single Quest A Complete”
This is a complicated way of saying “Win” when “No Wolves left on Map”.

Let’s look at their more powerful uses.

Example 6
Action: “Quest A Complete” Trigger: “No Wolves left on Map”
Action: “Quest B Complete” Trigger: “No Enemy Troops left on Map”
Action: “Win” Trigger: “Current Quest Status B” (Not A)
Suppose the map designer wants Quest B to cause a “Win”, but not if the player has killed all the wolves. You could use the 3rd event to test if the player has done both, in which case it will not occur. However, if the player only kills all the enemy troops, and not the wolves, then he would win.

Quest requirements are also displayed in the briefing screen. This can be nice (or not nice, if you want them to be “hidden” quests).

An interesting note: A quest status is not absolute. What this means, is if a quest is “Completed”, another event can change it to “Failed”. Also true is that “Failed” quests can be changed to “Completed”. This can be useful. This can also be bad. Suppose you want to have some sort of event cause the quest to fail permanently.

Example 7
Action: “Quest A Failed” Trigger: “No Wolves left on Map”
Action: “Quest A Complete” Trigger: “No Enemy Troops left on Map”
Action: “Win” Trigger: “Single Quest A Complete”
Let’s examine. If the player kills all the wolves, then the quest is considered failed. If, then, he/she kills all the enemy troops, the quest is switched to complete. The player wins the map. Now, if the map designer wanted the death of all the wolves to permanently keep the player from winning, he would have to use the design from the previous example. This can be bad, however, since there are only three quests available, and this solution uses up two of them.

Time-Delays: You may notice when you are editing events, there are two little Calendar/Number things at the bottom right. These deal with time delays and such. I don’t know their names, so I’ll call them the “Left number” and the “Right number”.

The “Left number” corresponds to how long you have until the specified event is activated.

Example 8
+72 Action: “Lose” Trigger: “Always”
This is how you set a “Time until Defeat” thing. The +72 is what you set the ‘Left number’ to. The player will lose after 72 months have passed. Hopefully before then they will have done something to win.

The “Right number” is just a delay. The event happens when it is triggered, but it will be X amount of months until it actually occurs.

Example 9
Action: “Win” Trigger: “No Wolves left on Map”
Action: “Wolf Invasion 10” Trigger: “No Wolves left on Map”
Now, if you set the win’s ‘Right number’ to 2, then an interesting thing happens. When you wipe out all the wolves on the map, the first event triggers. You win…in 2 months. Next, the second event triggers. 10 wolves invade your map. Luckily, this does not deactivate the “Win” event. After 2 months have passed you will win, whether or not you defeated the invasion.