Stronghold 2 has introduced a huge range of new scripting elements and features which can be daunting to anyone entering the mission editor for the first time. This tutorial is merely an introduction to the scripting capabilities of the map editor and includes details on which types of map can contain scripting, an overview of the mission editor and trader setup as well as setting building availability and using the event editor. We've also listed every single trigger and action (when combined these form an "event") with brief details of what every single one of them do...
Submitted by LordBritian and Aubergine
Note: This tutorial was written using Stronghold 2 with Patch 1.20 applied. Later patches may alter various things - should this be the case, and you spot anything, please post in our fourms. The main map editor screen allows you to choose the type of map to make, define estate ownership, set the start date for the first mission, edit missions and edit the map terrain and castle buildings. This tutorial will focus on the scripting aspects of map making so the minimap (estate ownership) and the terrain/castle editor will not be covered in this article. Hardware Requirements! Before getting started with any form of scripting, it's essential that you have a mouse with one of those little scroll wheels on top - otherwise you won't be able to change the settings for a vast number of the available scripting elements. If you don't have a mouse with a wheel in it, and you want to script your Stronghold 2 maps, you need to go and buy a new mouse right now! Scriptable Map Types As we're focussing on scripting, the first thing we need to know is which types of map allow scripting and to what extent: - Kingmaker maps are designed for multiplayer use, thus no scripting can be made.
- Free Build maps don't allow for scripting, but starting resources and gold can be set by scrolling the "mouse wheel" (so you'll need a mouse with a scroll wheel on it) while the mouse cursor is over the "gold" button near the "Edit" button. You can also set the starting goods, which we'll discuss later in this tutorial.

- War Custom and Peace Custom maps can have multiple missions and allow all forms of scripting. The majority of this tutorial will focus on mission and script editing for these two map types. All triggers and actions are available for both types.

Map Start Date Although not essential to scripting, it's useful to set the start date for your map to make it different from all the other maps. The start date settings are available in all map types and are found below the minimap (also known as "Radar Map"). This start date applies to the moment the player first starts playing your map so for custom War and Peace maps, that means it's the date when they start Mission 1. To set the month, move the mouse over the month setting (shown above as "Aug" for August) and then use the mousewheel to scroll through the months. To set the year, click on the button (shown as "1030" above) and enter the desired value. We've not done too much research in to the year setting at the time of this tutorial so we don't know what the maximum and minimum limits are (eg. we don't know if you can have a negative starting year). Mission Editor As stated earlier, you can only have missions in War Custom and Peace Custom maps. A default "Mission 1" will be present when you create a new map and inside it there will be a a default event of 'Lose when Lord dies'. To edit or delete a mission, you must first highlight it and then use the appropriate button below the mission list. If you want to add a new mission, just click the "Add New Mission" button and a new mission will be added to the end of the list (you can't insert a new mission between existing missions at the time of writing this tutorial). You cannot assign names to missions and their numbering is automatic. At the time of writing this tutorial, you cannot alter the order of missions either - if you wanted Mission 3 to be the second mission, you would have to delete Mission 2 loosing all the scripting contained within it. When you edit a mission, you will be presented with the Mission Editor screen as shown below:
The mission number is shown at the top of the screen and below it are buttons for adding, deleting and editing events which we'll discuss later in this tutorial. The majority of the screen is used for the event list for the mission you are editing. The columns in that display are as follows: - Months - the number of months (eg. "+12" being 1 year) from the start of the mission to when the event becomes active. By default, all events are "+0" meaning they are active from the very start of the mission.
- Action - a brief description of the action that will be taken when the event is triggered.
- Trigger - a summary of the trigger (ie. conditions) required for the action to happen.
Below the event list, there are buttons for setting up the trader, start goods and building availability. Everything on this screen relates specifically to the mission being edited. However, anything you don't explicitly set will be carried over from any previous mission (unless you are on the first mission in which the game defaults will be used unless you specify otherwise). For example, if you had set "Gong Production" to high in the previous mission, then it will remain high in subsequent missions unless you set it otherwise, overriding the previous setting. Before getting in to the event editing, let's take a look at the more basic settings for a map... Trader Setup Only available in War Custom and Peace Custom maps, the "Trader" button (found in teh mission editor) will display the "Tradable Resources" screen:
The sale and purchase of each resource can be set to one of the following settings by moving the mouse pointer over the setting and using the mouse wheel to scroll through the options: - On - The resource can be bought and sold at the market
- Off - The resource can not be bought or sold at the market
- 1Q - The resource can only be bought and sold at the market after the successful completion of the first quest within the mission (and all subsequent quests)
- 2Q - The resource can only be bought and sold at the market after the successful completion of the second quest within the mission (and all subsequent quests)
- 3Q - The resource can only be bought and sold at the market after the successful completion of the third quest within the mission
Although we can't configure the ability to buy or sell a particular resource seperately, the ability to link trade of each resource independantly to mission quests is hugely important - for example, the player might need to stockpile 200 iron ingots in order to complete Quest 1 and in doing so that could then enable trade of iron ingots at the market. If you are unsure as to what a resource is, click on it and you'll see it's description appear in the box near the bottom right of the screen. Start Goods You can edit start goods in Freebuild maps and also Custom War and Custom Peace maps: - For Freebuild maps, click the "Start Goods" button on the main map editor screen. The allocated goods will be given to the player when they start the map.
- For Custom War and Custom Peace maps, edit a mission then click the "Start Goods" button on the resulting mission editor screen. The allocated goods will be added to any existing goods when the player starts the associated mission. For example, if the player had 10 apples at the end of mission 1 and you have allocated 5 apples to the start goods in mission 2 then the player will have 15 apples when they start mission 2. The exception to this rule is popularity which we'll discuss in a moment...
The screen looks similar to the trader setup screen only here you are setting the quanties of goods that the user will be given when they start the map or mission:
Although the screen indicates that you can click a value and enter the text in the box, this is not possible at the time of writing this tutorial - you can only use the mouse wheel to change the values. Furthermore, different types of resource allow different "batch sizes" when increasing or decreasing their allocated value. For example, you can increase or decrease the amount of wood in batches of 5 planks wheras you can increase or decrease the the amount of ale allocated by one barrel at a time. The batch sizes are indicated on the picture above for each reasource. As mentioned earlier, you can also set the popularity level - this will override any existing popularity level the player has and the colour of the face (red "sad face" below 50, green "happy face" above) will indicate whether the setting will result in peasants leaving or arriving at the castle respectively. A popularity of 50 indicates that no peasants will leave and that no new peasants will arrive. It should be noted that all these settings can be set using various actions within events, allowing you to control resources, gold and popularity based on player actions in the game or mission. Building Availability Only available in War Custom and Peace Custom maps, the building availability screen allows you to define which buildings the player can create on their map. Edit the desired mission and then click the "Building availability" button to display the following screen:
The list shows the availability setting for each of the buildings - the building on the left and it's availability on the right: - No - The building can not be built in this mission
- Yes - The building can be built throughout the entire mission
- 1 Quest Complete - The building can only be built after the successful completion of the first quest within the mission (and all subsequent quests)
- 2 Quest Complete - The building can only be built after the successful completion of the second quest within the mission (and all subsequent quests)
- 3 Quest Complete - The building can only be built after the successful completion of the third quest within the mission
To change the setting, simply click on the building name in the list repeatedly until you get the desired option. To save time, there are two additional buttons below the list of buildings - 'All on' and 'All Off' which do exactly what you would expect them to do. Events Only available in War Custom and Peace Custom maps, the event editor is what the rest of this tutorial will concentrate on. An event is defined as: Event = Triggers --> Action The triggers set the conditions required for the event and the action defines what happens when the conditions have been met. As we discussed earlier, you have to enter the Mission Editor screen in order to alter the events for that mission. Your options are: - Add New Event - this will add a new event and immediately take you to the "Edit Event" screen (see later)
- Edit Selected Event - Having first selected an event from the list, clicking this button will take you to the "Edit Event" screen (see later)
- Delete Selected Event - Having first selected an event from the list, clicking this button will delete it. Be warned that there is no confiramtion screen - the event will be immediately deleted with no way to get it back!
Event Editor When adding or editing an event, you will be presented with the Event Editor screen as shown below:
Each Event consists of one or more Triggers (listed at the top) and only one Action (listed at the bottom). The current triggers and the action will be highlighted in the list of available choices. To add a trigger, simply click on it and one of two things will happen: - If the trigger has no options, it will become highlighted indicating that it is now active.
- If the trigger has options (many of them do), then a panel will appear allowing you to set the options. When you click the "OK" button, the options will be saved and the trigger will be highlighted indicating it is now active.
If you set multiple triggers, then all of them are required before the action will happen. For example, you might say that the player has to stockpile 10 stone and 10 iron before they can build a market. To delete a trigger, click on a highlighted trigger at which point one of two things will happen: - If the trigger has no options, then it will no longer be highlighted indicating that it's no longer active.
- If the trigger does have options then they will be displayed again - simply press 'Remove' button (or sometimes the button with a trash can on it) to delete the trigger, removing it's highlight to indicate that it's no longer active.
As you've probably guessed, you can edit triggers containing options by clicking on them, making the changes and then clicking the "OK" button. To add an action to the event, click on the desired action in the list. Any previously selected action will be disabled because you can only have one action per event. As you can probably imagine, one of two things will happen when you click on an action: - If the action doesn't have any options, it will simply highlight to indicate that it's the define action for the event.
- If it does have options, a panel will appear allowing you to change the options. Most of these panels have an "OK" button to store the changes, but some (such as "Invasion") just have a "back arrow" in the bottom left corner which does the same thing. To edit actions with options, just click them again and the options will be redisplayed allowing you to make changes.
Now, you'll also notice that there are two other settings at the bottom of the screen... - Months - This represents how many months into the mission until the trigger becomes active. The event will not check the triggers until the specified number of months has elapsed. If you desire that the trigger should happen at any time during the mission, then do not place a number in the 'Months' counter (leave it as "+0").
- Delay - This defines how many months the game will wait after the event is triggered before performing the action. For example, the player has obtained 50 apples as required by the triggers in an event, however the action will not take place for another 5 months, etc. This is helpful when you want one trigger to cause many events to occur, but at different time intervals - just place a different delay on the later events.
The events shown in the mission editor are listed in order of when they become active (increasing 'Months' settings) so the 'Months' counter should be used instead of the 'Delay' counter whenever possible to make it easy to see what is happening. To finish this article we'll provide a quick listing of all the triggers and actions available in the event editor. This is not an exhaustive treatise for each trigger or action, but a quick reference sheet of what they do. In addition, there are several special triggers and actions that are not normally available in the event editor, which we hope to discuss in later tutorials. Triggers There are currently 47 triggers available in the event editor. We have listed them in the same order as they appear in the event editor: | Trigger Name | Notes | | Always | As indicated, action will always be triggered regardless of what else is happening on the map. This trigger should be used on it's own and if possible, don't use the "Delay" setting as things will get confusing. There are a few other special features of this trigger: - If coupled with the Defeat Action, a 'Time until Defeat' timebar will be displayed in the game.
- If coupled with the Win Action, a 'Time until Victory' timebar will be displayed in the game.
| | Goods Acquired | Set any combination of goods that the player is required to obtain. | | Gold Acquired | Set a quantity of gold to be acquired by the player. | | Honor Acquired | Set a quantity of honor to be acquired by the player. | | No Food In A Granary | Set a flag marked estate to watch if the granary is empty. | | No Gong In Your Estates | No options, will trigger when no gong is present in all of the player's estates. | | No Rats In Your Estates | No options, will trigger when no rats are present in all of the player's estates. | | No Criminals in Your Estate | No options, will trigger when no criminals are present in any of the player's estates. | | Enemy Goods Acquired | Set any combination of goods to be acquired by the indicated AI Lord. | | Enemy Gold Acquired | Set a quantity of gold to be acquired by the indicated AI Lord. | | Enemy Honor Acquired | Set a quantity of honor to be acquired by the indicated AI Lord. | | Attain Population | Set a population that the player must attain in the castle estate. Try not to set this too high. | | No People Left | No Options, will trigger when the player has no people (peasants and workers) in their castle estate. | | No Enemy on Map | No Options, will trigger when no enemy units are on the map. | | No Enemy Troops on Map | No Options, will trigger when no enemy troops are on the map. | | No Enemy or Invasions Left | No Options, will trigger when no enemy troops are on the map and no more invasions are scripted to occur (in the current mission). | | All Your Troops Dead | No Options, will trigger when the Player has no troops on the map. | | Percent of Troops Lost | Set the percentage of troops lost by one of the AI lords, all the AI Lords or by the player. | | Recruit Archers | Set the number of archers to be recruited by the player. | | Your Lord Dies | No options, triggers when the player Lord dies. | | Lord Damaged | Set the percentage of damage to a selected AI Lord. Useful for triggering reinforcement invasions for that lord. | | All the enemy Lords are Dead | No options, triggers when there are no enemy Lords left on the map. A useful Win condition. | | Enemy Lord Dead | Select which AI lord must die. Who kills the lord is not relavent. | | Rescue Lord | Select which AI lord must be rescued. To rescue a lord, the players' troops must get close to him and usually kill any nearby enemy troops. | | Multiple Lords Dead | Select which AI Lords must die. Multiple picks allowed. Who kills the lord is not relevant. | | Player Kills Lord X | Select which AI lord the Player must kill. | | Other Lord Kills Lord X | Select which AI lord must be killed by troops controlled by an AI lord. | | Lord X Kills Lord Y | Select which AI lord's troops must kill the specified AI lord. | | Destroy Outlaw Camp | No Optionn, seems the destruction of any bandit camp will accomplish the task although some people have reported that all bandit camps must be destroyed. | | Breach Enemy's Castle Walls | Select which AI Lord's castle walls must be breached (meaning that their keep is no longer enclosed). Some AI lords never enclose their Keep (eg. William) so you have to test this thoroughly. | | Get Troops onto Enemies Walls | Select which AI Lord's castle walls to have troops on. | | Get Some Troops Close to Enemy Lord | Select which AI Lord to have some troops near. | | Get Many Troops Close to Enemy Lord | Select which AI Lord to have some troops near. The difference between "some" and "many" is not clear. | | Lift Siege | Select the siege controlled by an AI lord to be lifted. Obviously, a siege of the Lord must have already been scripted. | | Enemies are near a marker | Select a flag market location and a radius of that flag that any enemy must be near. | | Current Quest Status | Select any combination of completed or not completed for the three mission quests, A, B and C (which relate to quests 1, 2 and 3). | | Quest Not Complete | Select which quest is not complete. | | Single Quest Complete | Select which specified quest is complete. | | Number of Quests Complete | Select the number of quests completed, 0, 1 or 2. (Undetermined if these should be displaying 1, 2, or 3). | | Quest Failed | Select which quest has failed. | | After Briefing | No options, will trigger after exiting the mission briefing screen. See the "Enter Briefing" action later. | | No Messages Playing | No options, triggers when there are no messages (eg. scribe messages, etc) playing. | | Building Site Complete | No options, which site is selected, if multiple, is undetermined - it's best to have only one building site at any given time. Will display Build Beacon, Build Ruined Bridge, Build Ruined Keep, Build Ruined Monastery, or Build Wooden Bridge depending on which site it selects. | | Building Site Percent Complete | Set the percentage of the site to be completed. Which site is selected, if multiple, is undetermined. Will display Rebuild Beacon, Rebuild Ruined Bridge, Rebuild Ruined Keep, Rebuild Ruined Monastery, or Rebuild Wooden Bridge depending on which site it selects. | | Control a number of Estates | Set the number of estates the player must control, from 1 to 20. | | No Bears Left on the Map | No options, happens when there are no bears left on the map. | | No Wolves Left on the Map | No options, happens when there are no wolves left on the map. |
Actions There are a whopping 60 actions to choose from! Remember that you can only have one action per event. Here's a summary of all 60 actions: | Action | Notes | | Win | No options, simply a Win event that ends the mission in Victory. | | Lose | No optinos, simply a lose event that ends the mission in failure. | | Invasion | The invasion event with any combination of troops and siege equipment. Can pick invasion, siege, movement only, and if the Lord accompanies the army. Flag markers are used to assign where the invasion will appear and where it will target and to whom the army belongs and who the army will attack. Also has repeat and frequency options. The type of warning to be given can also be changed.Stop Invasions - Options to 'Stop Repeating' or 'All Invasions' for a particular AI Lord. | | Bear Attack | Will spawn bears at a flag location, from 1 to 40 bears per event. The message displayed is "Villagers have seen bears roaming free my lord, it is most distressing for them." | | Create Criminals | Will spawn criminals in the Players castle estate, from 1 to 100. | | Wolf Invasion | Will spawn wolves at an invasion flag, moving to a target flag and with repeat and frequency options. "Wolves are abroad in the land my Lord. The peasants are troubled." | | Set Wolves To Defensive | No options, wolf packs will not move looking to attack. They will lie down until attacked by the player. | | Bad Weather | No options, event that withers all crops. The message displayed is "Bad weather has ruined the crops my lord, our farms will be set back for some time." | | Wheat Disease | No options, event that withers wheat fields. The message displayed is "Wheat Rust has been found on our wheat crops, Sire. The crop is ruined." | | Apple Blight | No options, event that withers the apple orchards. The message displayed is "Apple Blight has stuck our orchards my Lord, apple supplies are temporarily halted." | | Hop Weevil | No Options, event that withers the hops fields. The message displayed is "Hop weevil has decimated the crop My Liege, hop production is at a standstill." | | Vine Rot | No Options, event that withers the vineyards. The message displayed is "Oh dear , Vine Wither has set in Sire, we will not be seeing any new deliveries of grapes for a while." | | Swine Fever | No Options, event that causes pigs to die. The message displayed is "Swine fever has struck my lord, our pig herd has been wiped out." | | Mad Cow Disease | No Options, event that causes cows to die. The message displayed is "Our cows suffer terribly my lord , the madness disease is on them again." | | Lost Sheep | No Options, event that causes sheep to disappear. The message displayed is "Ovine Amnesia has struck the Shepards Sire, once again they have lost their flocks." | | Maintain Minimum Food Level | Set the minimum food level for the player's castle estate granary - if the food stocks go below this level, more food will automatically be added to maintian the desired level. | | Plague of Rats | Will spawn a number of Rat Packs, from 1 to 20. | | Rat Invasion | Will spawn a number of Rat Packs, from 1 to 40, at an assigned flag invasion point. Whether this will affect the estate in which the flag is placed or affect popularity in the player's castle estate is not clear. | | Gong Infestation | Will spawn a number of gong piles, from 1 to 40, at an assigned flag point. | | Start Fires | Will start a number of buildings on fire in the Player's castle estate, from 1 to 20. The message displayed is "Castle buildings are aflame my Liege, hopefully our well workers can control the inferno." | | Set All Buildings on Fire | Sets all player buildings on fire at the same time (as used in the PoP) - don't kniow if this is just for castle etate or all owned village estates. | | Witchcraft | No options. This event will cause a one time -70 popularity effect. The message displayed is "A black cat has been sighted sire and once more our peasants mutter witchcraft, they are deeply troubled." | | Peasants Revolt! | Select the number of peasants that will revolt, up to 50 at a time. The message displayed is "Our peasants are inflicted with Foot Rot my lord. They are protesting and have gone on strike for a week." | | Bumper Harvest | No Options, increases production of crops. "The good weather has led to a bumper harvest my lord, we can soon expect to see our farmers delivering extra crops ." | | Redirect Village Output | Will redirect the production of the flagged village to be sent to the flagged Target Estate. | | Stop Resource Production | Toggle on/Off any of the resource industries. Can select if all estates, a flag marked estate or all estates of a particular Lord's are affected. | | Cap Resources | Cap the resources of estates. Can select if all estates, a flag marked estate or all estates of a particular Lord's are affected. If Off then no cap will be set. Gold can also be capped. The calendar setting is possibly how many months the resources will be capped for. | | Give Resources | Give resources to estates. Can select if all estates, a flag marked estate or all estates of a particular Lord's are supplied with the resources. The calendar setting is possibly how many months the resources will be given for. | | Set Allies | Set AI Lords as Friends, Enemies or as Neutral. | | Move Lord | Chose which lord move and to which target flag. Also an option for them to leave the map or not. | | Take Enemy's Castle | Pick which enemy Lord's castle will become the Player's new castle. Player's old castle will become a friendly castle. | | Convert Estate To Village | Converts the flag marked castle estate into a village estate. Useful if you want the castle of a defeated lord to turn in to a village estate like in Kingmaker maps. | | Quest Complete | Marks the selected Quest as Complete. Either 'A', 'B' or 'C'. | | Quest Failed | Marks the selected Quest as Filed. Either 'A', 'B' or 'C' | | Enter Briefing | No options, enter the Briefing screen. Useful if you change mission objectives part way through a mission. | | Set Available Troop Types | Each troop type can be turned on or off, or set to become available after 1, 2 or 3 Quests are completed. | | Gong Production | Set the production rate of Gong at the Player's castle estate at Off, Very Low, Low, Normal, High or Very High. | | Rat Production | Set the production rate of Rats at the Player's castle estate at Off, Very Low, Low, Normal, High or Very High. | | Frequency of Disease | Set the production rate of Disease at the Player's castle estate at Off, Very Low, Low, Normal, High or Very High. | | Crime Rate | Set the production rate of Crime at the Player's castle estate at Off, Very Low, Low, Normal, High or Very High. | | Outlaw Production | Set the production rate of Oulaws at Off, Very Low, Low, Normal, High or Very High. Also can select which estates are affected: All Map, Own Estate, Neighboring Estates, Own and Neighoring Estates, or Human Estate. | | Wolf Spawn Rate | Set the production rate of Wolfs at Very Low, Low, Normal, High or Very High. Unknown where they appear. | | Limit Weapon Production | Set if bows, crossbows, spears, pikes, maces and swords should be allowed to be made or not. | | Set Num of Campfire Peasants | Set the maximun limit of peasants at the campfire of the flag marked estate | | Building Sites | Set whether the building site is active or not (ie. whether there are builders working on it) and also the percentage complete or no change. | | Give Lord Full Peasants | Give the indicated Lord Full peasants immediately. only affects the castle estate of the Lord. | | Kill off all Wolves | No options. Kills all wolves on the map. | | Kill Off All Lords Troops | Choose which Lord's troops will be killed, on the entire map. | | Control Lords AI | Enable or Disable the Lord's AI. A Disabled AI will not build buildings, create troops or attack/defend. Already established buildings will keep functioning if peasants are available. | | Control Gatehouses | Set Open or Closed the gatehouses of a particular Lord. Can set to all or a flag marked gate. | | AI Troops Charge If Aggressive | Set a Lord's troops to charge when in the aggressive stance. | | AI Troop Retreat | Order a Lord's troops to retreat to a flag marked location. Also can set to leave the map or not. | | Pause Sieges | Either set to Pause or Resume the siege of a particular Lord near a flag marked location. | | Make Troops Super Aggressive | Set a particular Lord's troops near a flag marked location to Super Aggressive. Exact meaning is uncertain, but we assume they will suddenly rush to attack enemy troops regardless of how far away they are. | | Set Rank | Set the Rank of the Player. | | Set Honor | Set the Honor of the Player. | | Give Honor | Give Honor to the Player, from 10 to 2000, in increments of 10. | | Give Gold | Give Gold to the Player, from 10 to 2000, in increments of 10. | | Move Ship | Move a ship in between 5 flag marked locations. Can set a pause at each location. Mark options to leave the map or crash, and if a trader ship or a viking ship. | | Time until final invasion | No options, creates the 'Time until Final Invasion' time bar in game, regardless of whether there are any invasions before or after that time (or at all!) |
Well, as you can see, Stronghold 2 provides more scripting features than all the earleir versions of the game put together! Don't be put off by the number of options. Just get a brief understanding of them and experiment with the options you want to use before you start developing your map (eg. create small test maps first to test the various options). We've done our best to give accurate information above, but as you can see there's LOTS of options and we may have missed something or misinterpreted something. Have fun!
|