Scripting Invasions & Using Invasion Markers

Rated 5 out of 5 (2 votes) | 126 views | | | | | |

by Lord_Chris

Invasions are considered a complex yet necessary part of custom Stronghold 2 maps. However in reality, they aren't really that complex at all. This tutorial will teach you the basics of creating your very own invasions in Stronghold 2.

The very first thing you need to do before you create any invasions is plan out your map. For this, you must create the necessary terrain which is obviously left up to your own imagination. We do however have a guide here on how to better utilise the map editor for this.

Once you have completed your map design, and painted all estates, you need to decide where you would like your invasion. Is this going to be a simple scripted invasion to a Lord's castle, or is it going to siege it? Or is it not even going to attack anything at all and just leave the map? These details are up to you to decide. Once you've decided, you need to place some invasion markers.

Invasion markers are responsible for setting the invasion points on a map. They are found under the Estates menu in the editor. Invasion markers mark out not only where invasions on a map will occur, but also other triggered events, such as when enemies are near a certain marker.

Invasion markers come in four separate colours, Red, Blue, Yellow and Green. Each colour has a total of 8 markers, which provides a total of 32 unique possible invasion markers you can place on your map. The colour of the flags you place makes no difference. In the screenshot below, you can see how three yellow invasion markers have been placed on the map Castle Fedron by Lord Vetka. Invasions generally work off two markers: an entry point, and a target or siege point. Place those now- and remember the colours and numbers of the markers you placed!

Now it's time to take a look at the Invasion screen. Left click the arrow to return to the main editor screen and go to edit whatever mission you are currently editing. You will need a trigger and an action for every event you setup, and invasions are no different. For a full overview of all triggers and events in the editor, please see this page. We will setup the trigger to be "Always" because for the purpose of this tutorial we are only focussing on invasions, not the events which actually trigger them.

Once you have setup your trigger, you will need to select the "Invasion" action from the list of actions. Doing so will take you to the invasion screen here:

While at first glance this screen may seem daunting, it actually isn't. It's very simple to control invasions from this screen and you can do everything you need to do from this single screen. Starting from the top of this screen, you will see every military unit in Stronghold 2. You can add units to your invasion by hovering over a unit and scrolling the mouse wheel. Military units are added to the invasion in groups of 5, while Siege equipment is added one unit at a time.

Once you have selected how many troops you wish to take part in your invasion, the next thing to do is to setup the invasion point on your map. Using the same colour marker you placed earlier of where you wanted the invasion to take place, set the "Invasion Point" first box to the colour of the marker you placed, and the second box to the number of the marker. Again, you set these by hovering over them and scrolling with the mouse wheel.

Note that you can actually randomise where an invasion is placed onto the map by leaving the "Any" icon instead of selecting the marker number. This will randomise where an invasion comes from based on all of the colour flags that is highlighted. If you choose to do this, just be careful that you are fully aware of where all those colour flags are on the map, because you can easily place one specific to some other trigger that can later cause issues. If you do use the "Any" marker setting, then it's also helpful to have the target point and the siege point markers as two entirely different colours, and this is to prevent your army from entering the map at the same location they are supposed to later move to.

Next, it's time to set the target point. Using the mouse wheel again, set the target point underneath to whichever colour flag you decided should be where your invasion heads to. You will also notice that the text which says "Target Point" has an arrow on it. This has two settings: either a target point for an advancing army (i.e. a lazy invasion), or a Siege point for an army which creates a siege camp and Sieges whichever castle you decide to send the invasion to. You simply left click on this box to change the invasion type.

Both have their uses. Lazy invasions are good when you don't want to siege but just to scare a player. Note however that if you intend to siege a castle using a lazy invasion then your map may crash, particularly on the 1.3.1 Deluxe version of the game. Usually this is as a result of Gatehouses or other inpassable terrain if the lazy invasion can't reach the invasion marker they're intending to get to. If this is happening, you will either need to disable the use of gatehouses for that mission, or change your invasion to use a Siege point instead of a target point.

Next, moving along to the right, you will see that you have the option to include the Lord in your invasion of whichever player colour you are invading as. In theory this should only work if the lord is not already on the map. If the player you are invading as already has a castle on the map, then their Lord will also be on the map and this setting has no effect whatsoever. If the Lord is not already on the map, then the enemy Lord will still invade, but the lord unit will be your own Lord, not the respective enemy Lord. In the image below I scripted for Edwin to invade, but because his castle wasn't already on the map the skin of your own Lord is shown instead.

Unfortunately there seems to be only one way to fix this- you will need to use the trick uncovered by Lord Vetka in this article. There are certain missions in the War Campaign, for example Chapter 12, which do not use this behaviour, but at present it remains unknown why this is the case. It is believed there is some form of advanced scripting made by Firefly to these chapters as to why this is the case.

Next along to the right is the option for the whole invasion to leave the map once they reach the target point. Simply left click on this option to switch between leaving the map and not leaving the map. We also have an option to provide warning to the player about the invasion, before it actually happens. The different options and what they do are shown below:


Warning type Action in game
No Warning The game does not warn the player in any capacity about the invasion.
Normal Message You will receive a message informing you about the invasion when the army invades the map.
Early Warning You will receive a message from the Constable informing you about an upcoming invasion in advance of it actually arriving on the map.
Full Warnings You will recieve a message from the Constable in advance of the invasion as well as a message at the time of the attack.

Note that the early warning message from the Constable which you receive will vary depending on the size of the attacking force. There are three distinct variations of this. The first is that a "small group" of soldiers are heading to your Castle, the second states that a "large force" of the enemy is marching towards you, and the third is that the Constable will warn you about danger from a "massive army" that will soon be upon you. Also note that you will only ever receive an early warning if the invasion is attacking your own castle.

The other setting to the right of the movement settings will dictate what the invading army actually does. You can view all of the various settings below:


Movement Type Action in game
Attacking Army The invasion will be aggressive in nature, and will move to the intended destination attacking every hostile unit on their way.
Movement Only The invasion will be neither defensive or aggressive. Instead, it will simply move from one destination to another. This is normally used when an army will leave the map on the final invasion marker.
Siege The invasion will move to the intended destination, and then siege the enemy castle where it arrives at. A Siege Camp will be setup and a formal Siege will begin.
Defensive Army The invasion will be defensive in nature, and will move to the intended destination without attacking any units unless attacked.

Underneath these settings, you will find some settings on configuring what the invasion will actually do. You can choose whose army this invasion belongs to by scrolling with the mouse wheel on the player line. Below that, you can choose whether you wish for the army to attack or reinforce the specified player to the box on the right. Again, you must left click to change whether the army attacks or reinforces, and you must scroll with the mouse wheel in the box that configures who the army attacks. Note that you cannot actually attack yourself, even if you try to make this happen. Instead, the army will simply reinforce you.

The final option on this screen is whether you intend to repeat this invasion. If you don't intend to repeat this invasion, then you can simply ignore these settings. If not, then you will have to configure how many times you wish this invasion to take place for, and what the delay between these invasions will be. Please note that you cannot set the "Repeat Count" setting until you have already set the "Repeat Time" setting.

The "Repeat Time" setting is responsible for how many game months' delay is required between when this invasion will keep occuring. You can set this by hovering over it and scrolling with the mouse wheel. Invasions are always triggered at the start of the month, so keep this in mind while scrolling. Next, when you set the "Repeat Count" set to "Always" this means that the invasions will always keep occuring. It's essentially a different type of ∞ (infinity) symbol. You can also scroll with the mouse wheel to repeat the invasion only a certain number of times.

The only way that "Always" repeating invasions will stop is if you cancel them through another event in the editor. For example you could have a player completing a certain quest or objective which will trigger an end to all repeating invasions. Note however that this may not instantly take effect. The way events are triggered in Stronghold 2 is quite complex. Essentially whenever a "trigger" occurs the event is considered triggered and will always happen. Even if you stop all repeating invasions in the meantime, because the event is considered as "triggered" by the game it will still occur regardless. This means that any events which have been triggered with a delay will trigger after the delay has taken place.

For example, the invasions are set to constantly occur on your map every six months. Three months into your map, the player completes an objective to generate 10 Honour. This objective triggers an event to cancel all repeating invasions. Because the invasion had already been triggered however, three months later one more invasion would still take place.

While invasions can be tricky to master, they're very useful in creating your own custom maps and can greatly help in adding more to the missions you make. Take a look at some examples of scripted invasions below, which may help you to gain a better understanding of exactly how they work. With a big of practice, you'll be a master at creating invasions in no time!