Jump to content

Scripting Invasions

Recommended Posts

** This was originally taken from Stronghold-Knights.com. **


There is also an attached word document below - this is on scenario design and eye candy taken from stronghold heaven.


Have you ever scripted an invasion o?nly to see the enemy troops just stand there and do nothing? Most map makers will have probably encountered problems with getting AI controlled troops to mount an agressive invasion o?n the player castles. This tutorial covers signposts, sprite limits, terrain considerations and much more in the hope of solving many of the common problems associated with lazy invasion forces...


Submitted by Aubergine, Brave_Sir_Robin, Jalis, Earl_Listibald, Talos_911, UnikUnok, SimRPGplayer, GeneralMatthew, Dragonheart_Killer



What is a Lazy Invasion Force?


Put simply, a lazy invasion force is o?ne that appears at the signpost and then never really gets round to attacking your castle.


There are a wide variety of things that leads to this problem, some of them are caused by bugs or limitations in the game and some of them are caused by your map design.


Place a Signpost


In order for scripted invasions (or even o?n-demand invasions from the menu in Freebuild games when you press the "F1" key) to arrive o?n the map, there must be at least o?ne signpost.


To place a signpost o?n your map, go in to the terrain editor and then select the Features pallete. Click o?n the signpost and then click your map to place it:



You can place multiple signposts o?n your map and invasions will randomly choose which o?ne to use, but they seem to prefer the first placed signpost.


Avoid Erasing Signposts


There have been several reports that the game sometimes remembers the location of signposts that were erased in the map editor. As such, we reccommend saving your map before placing a signpost so that if you want to get rid of it you can reload the saved map without it rather than erasing it.


Access to the Signposts


When an invasion arrives o?n the map, they start at the edge and walk to the signpost. Your signpost needs to be accessible from the edge of the map!


You should test this in the map editor - place a military unit at the edge of the map closest to the signpost and then instruct them to walk to the signpost - if they can't get there then neither will the invasion force!


Within reason, invasion forces will be prepared to make quite a treck to get to the signpost. In some maps we've seen careflully placed signposts and terrain that force the invasion force to appear at the opposite side of the map and walk a long distance to get to their signpost.


Place Signposts Away from Your Castle!


As our tutorial o?n Signpost Exclusion Zones shows, putting a signpost in your castle is not a good idea! While that might convince the enemy troops to head stright for your castle, it will instantly destroy most of your castle before they even get there!


In most maps, any player owned building within 35 tiles (in all directions) of the signpost will be destroyed when an invasion arrives. In Freebuild and Economics maps, the exclusion zone is 12 tiles (in all directions) of the signpost.


It should be noted that you can sometimes put a signpost in an enemy castle and no buildings will be destroyed when the enemy arrives. This mainly relates to Stronghold Crusader but there are reports of it workin o?n Stronghold 1 as well.


The Sprite Limit


This is a very common problem for new map makers - it's caught all of us out at some stage of our map making career!


Basically, the game can o?nly display a limited number of things o?n a map at any given time. If you exceed this limit, all kinds of things start going wrong and the gameplay suffers terribly!


Let's take a look at the known sprite limits within the game:


Trees and shrubs are grouped o?n their own with a limit of 2000

People (military units, workers, peasants) and land animals are grouped with a limit of 1500

Things in the air, like arrows, flags, birds, etc. have a limit of 2000

Buildings and ruins (for all players inclusively) have a limit of 1000


Reaching any of these sprite limits will either cause your invasion force not to show up (or be reduced in size) or cause problems with their agressiveness. So, what are the likely culprits that lead to sprite limit problems?


Trees - Trees will spawn in the map editor and those small woods you placed may now be huge rainforests! You can pause the map editor by pressing "Alt"+"H" to stop trees from spawning while you complete your map. The easiest way to deal with trees is to script a Tree Fungus event a year before invasions - this will kill off many trees and make the game far more responsive. Alternatively you can require the player to gather lots of wood o?n their stockpile and let their woodcutters solve the problem.

Rabbits - These pesky critters have a habbit of multiplying at alarming rates! The problem is that you can't script a cure to this problem, you have to convince the player to deal with it. If you've placed rabbits o?n the map then make sure there are economical goals relating to wheat, bread, hops and ale - rabbits will munch through wheat and hops so the player will have good reason to kill them. Alternatively, just don't place any rabbits! If you want to use the rabbit explosion event then try to use it after invasions rather than before and use it sparingly!

Wolves - When left alone, wolves can sometimes breed rather quickly! Luckily there are scripting conditions that detect if there are any wolves o?n the map - use these to provide various incentives that make the player determined to kill off the wolves.

Seagulls and Crows - Just like rabbits and wolves, too many of these and your map will run slowly. Seagulls can o?nly be killed in the map editor - we have a tutorial that shows how to do that. As for crows, chopping down the tree (or erasing it) or deleting the "skull o?n a spike" will remove any crows associated with it.

Buildings - We all like to build big castles with big economies o?nce in a while, but if there are too many buildings the game will not perform so well. The best solution here is to not place too many buildings in the map editor and make it economically difficult for the player to place loads of buildings. In some cases you might even want to script fires to destroy some buildings!

Military Units - A common mistake is to place literally hundreds of military units (player or AI) in the map editor. While this looks really cool, it will eat away at the sprite limit for military units. Where possible script invasions or custom reinforcements to try and avoid having too many pre-placed units o?n the map.


If you've got lots of things o?n your map and the invasions appear to be lazy, always check for sprite limit issues first!


Place a Keep


The primary target for the enemy is to get to your Keep (as that is where your Lord is likely to be). If they have to destroy castle walls or buildings o?n their route to the keep then they will do so - and this is exactly what we want!


If you don't pre-place a keep for the player, then they will be forced to place o?ne when the game starts. Although this will ensure that a keep has been placed, it's often better for you to choose where the keep will go in oder to fine-tune what your invasion forces do. Thse size and type of the keep does not matter. Any castle walls between the signpost and the Keep will become a target for the enemy troops - unless there is a gap in the castle walls in which case they'll head for the gap!


Make the Castle Accessible


If it's impossible for the enemy troops to get to your castle, they will be more than reluctant to attack! There are many ways in which castles become "inaccessible" and some of them are not so obvious.


Two very common problems are illustrated below:


First, most of the walls were built o?n cliffs - unless the enemy has catapults and trebuchets (which they don't always use), those walls will be virtaully indestructible as far as the AI is concerned. Make sure the enemy can get to your walls!


Second, there is o?nly a very narrow entrance to the castle. It's quite obvious that your troops, workers and enemy invasions can all see that entrance, but for some reason the invasion force will be reluctant to use it.


Many map makers have reported that a narrow entrance to a castle that would force the invasion force in to a "bottle neck" will result in the invaders attacking in pitifully small groups. To overcome the problem you have to leave plenty of room for the enemy troops to launch their attack.


The more of your castle walls that are exposed to the enemy, the better - it gives them more attack options and they will work much harder! Where possible allow the enemy to walk all the way around the castle as they like to attack from all angles.


Make the Keep Accessible


Most of us have played a map where the enemy has breeched our castle walls and then agressively charged towards our Keep!


While there are things blocking the route between the signpost and the Keep, the enemy will be in a more careful mode, trying to dig your moats, break down your walls and destroy your towers and gatehouses. Most melee troops and horse mounted troops will wait at the signpost while this takes place.


As soon as they get a clear path to the Keep, they go insane and all of them will start heading your way - a truly scary sight! They now have but o?ne objective - get to the player Lord and kill him!


So, if you want invasion forces to be super-agressive, give them a clear path to the player's Keep and watch them charge!


Agressive Bandit Attacks


These bandits (who are actually just macemen) are complete wimps! Most of the time they just stand at the signpost, admire the view and then run away!


To make them a bit more agressive, there are three key things to do...


There generally needs to be more bandits than defending troops. Nobody has ever quite worked out the exact ratio, but generally speaking if the bandits feel out-numbered then they will run away! As such, it's probably best to trigger bandit attacks early o?n in the game.


Bandits like to feel superior to the defending troops. If there are pikemen, swordsmen or knights defending the castle then the bandits won't fancy their chances and will cower in the trees! If, o?n the other hand, the defending troops are mostly archers and spearmen, the bandits will feel far more superior and therefore more likely to go o?n the rampage!


The other thing that really stops the bandits in their tracks is lack of access to your Keep! They like to just charge from the signpost straight to the Keep and if there are walls, moats, gatehouses and other things getting in the way they generally won't bother! Again, it's best to send them in early o?n in the game before the player has had enough time to establish their castle.


Bandit attacks are most devastating against small castles - as long as you can coax them in to attacking, they will destroy buildings and light troops such as archers and spearmen.


Siege Equipment Woes


Ever scripted an invasion that includes siege equipment o?nly to find that it doesn't get used? There are many reasons for this. The most obvious o?ne is that you need to include engineers in the same invasion as that which delivers the siege equipment!


Remember that siege equipment needs varying numbers of engineers (shields = 1, catapults = 2, battering rams = 4, etc). Make sure you send more than enough engieers as some may get killed by the players archers, etc.


So, we've got our siege engines and plenty of engineers but they still aren't getting used?


Another common problem is lack of construction sites! The enemy engineers like a nice flat patch of land in front of the players castle, preferably just out of range of their archers, o?n which to build the siege engines. Make sure you give them this land otherwise they will likely not bother.


Even if your siege engines get built and manned, they will still not always get used - why?! Well, they need appropriate targets...


Siege towers need sections of stright walls, not diagonal walls, and they prefer easy access to them. If in doubt, build an enemy siege tower in the map editor o?n the construction site you have provided, place some engieers and get them to man it and finally tell the tower to dock o?n the walls - did it work? Also, send at least 2 towers - o?ne will likely be destroyed by defending troops.


You also need decent troops to climb up the siege towers when they are docked against the catle walls - macemen, crossbowmen, spearmen, archers and pikemen will really cause havoc for the player!


Battering rams prefer gatehouses and towers as targets. If the player's castle has none of these then the rams will probably just sit and watch the battle rather than join in.


You should accompany battering rams and siege towers by archers and crossbowmen (and arabian bowmen and horse archers in Crusader).


Siege towers and battering rams both need to get to the castle walls - if there are moats they will be utterly useless. Send moat digging troops if you think the player might have placed a moat.


Shields have a desire to protect troops - spearmen, archers and crossbowmen seem to be the most desirable and they will often gather around catapults and trebuchets.


Catapults love to attack walls, towers, gatehouses and pretty much any building they can target! They work best when they are o?n roughly the same terrain height as the buildings or walls they are attacking and they are most devastating in large numbers.


Trebuchets like the same sorts of targets as catapults. They seem to like being built just outside the range of the defending archers so that construction site we mentioned earlier is very important to them. o?nce again, they prefer being o?n a similar land height to their targets.


Guard catapults and trebuchets with macemen, crossbowmen and knights and where possible include some shields.


Sending a good number of catapults and trebuchets is the easiest way to create a breech in the enemy walls.


Fire Ballista just love to destroy enemy troops and wooden buildings. As long as they can get close enough to target things, they'll work like a dream. If you send plenty of them they'll not o?nly create an inferno where the player's castle used to be, they'll also make short work of any player troops that get in the way!


So, are we done with this siege equipment now? No?!! Well, there are yet more problems!


If you send siege equipment as part of a large invasion force, the AI sometimes forgets to use it! To get round this problem, send the siege equipment and engineers as seperate invasions!


It may be worth having a look at our Introduction to Siege Equipment tutorial which contains lots of other information o?n siege equipment.


Pre-Placed Invasion Force


There are many occasions where you might want pre-placed enemy troops to take part in an invasion. This can often lead to a much better attack as they can come from all over the map, rather than just the signpost!


Just before saving your map, place enemy troops where you want them to attack from and then instruct them to attack player troops or parts of the player castle. You need to the map editor to be in slow mode (use the "-" key) while doing this and you need to pause and unpause (using "Alt" + "H" as discussed earlier) between giving each unit their instructions.


No matter how confused the AI is, pre-ordering enemy troops like this will lead to a much more intelligent battle!


In Stronghold 1, you can also use a little trick that will cause certain enemy troops to join in with the first scripted invasion! This can lead to a more interesting invasion because troops from different factions (colours) can take part in a single invasion and you can give the effect of the invasion force appearing all over the map and then running to their signpost.


Troop Preferences


We've already covered siege equipment, but what about all those other troops? Let's go through them o?ne by o?ne...


Archers and Arabain Bowmen are probably the most reliable invasion troops and like to congregate outside the castle and fire at the defending troops o?n the walls and in towers. They also like to target defending siege equipment such as mangonells and tower ballista. It's pretty important to send in archers to reduce the number of defending troops as this makes melee troops and siege equipment more likely to join in the fight.


Spearmen like to destroy buildings, walls and are especially keen to dig up moats. To give them a fighting chance, they need to be used in quite large numbers and should be supported by ranged attackers.


Crossbowmen like to defend siege equipment and also like to take out defending troops and siege equipment o?n the castle walls and towers. Their leather armor makes them quite durable and they can be devastating in large numbers. They prefer to attack after archers and arabian bowmen.


Macemen love to destroy good things such as gardens (you can guide them around the map with good things!) and gatehouses. They'll be more than happy to destroy buildings and towers and if you can get them o?n the castle walls (siege towers) the defending troops are in for a tough time! They aren't always too keen to dig moats but sometimes will.


Pikemen gernally o?nly get involved o?nce there is a route to the Keep. They tend to wait at the signpost otherwise. They're none to keen o?n moat digging. Sometimes, they will get borded of waiting at the signpost and will head towards gatehouses.


Swordsmen and Arabian Swordsmen are a bit like pikemen. Until they have a route to the Keep they probably won't do much. Breech the walls and they will start to show some real interest! Again, they'll sometimes get borded and head for gatehouses.


Arabian Swordsmen are a bit more agressive than their European counterparts and will usually be more willing to head for the castle before it's walls are breeched.


Both pikemen and swordsmen will usually head for the castle if there is a siege tower docked against it's walls - if they get up o?n to the battlements, the defending troops are pretty much done for! They are amongst the best troops when it comes to killing defending melee troops and the Lord.


Knights will generally attack economic buildings and defending troops. If there are moats or other things (walls, etc) blocking the route to the Keep then they will be far more lazy. Breeching the castle walls with siege equipment or melee troops is the o?nly way to get these chaps to become really agressive.


Slaves, as long as there are few defending archers, are a good way to destroy buildings! They will set fire to pretty much any economy building they can get to and this is a big problem for the player - they usually cannot get their fire fighters out of the castle as their gatehouse will be shut!


Stone thowers are generally better at defending that attacking, but if you include them in an invasion they will act in much the same way as archers. They are vaulnerable to ranged troops so it's best to send in an invasion containing archers, arabian bowmen, crossbowmen and horse archers before sending in any stone thowers.


Assassins are awesome units - although they can't cross moats, their ability to scale walls and gatehouses makes them invaluable! Add to that their stealthy ability and you are o?n to a real winner! As long as defending troops such as archers are dealt with, sending in a decent number of assassins will cause plenty of trouble for the player! Get them o?n to gatehouses and the invasion force will go in to charge mode!


Horse Archers are great units for dealing a quick blow to defending troops. In suitable numbers they can kill large numbers of defending troops o?n the castle walls and in towers.


Fire Throwers have to get very close to things before they become effective. As such, you really need to have prior invasions deal with defending troops, especially ranged units, before they start to become useful. However, if you know that there is a route to the player's Keep, you might want to send a few to see if you can create a little extra carnage!


Laddermen can somtimes be useful - if there are few defending archers then these chaps are the fastest way to get up to the castle walls. The best accompanying units are spearmen in large numbers. Laddermen are useless if there is a moat and due to bugs in Stronghold Crusader even if they do get to the castle walls it's unlikely that any troops will climb their ladders.


Tunnelers are awesome against towers and gatehouses and if required, castle walls. Make sure defending archers and crossbowmen are killed off before sending in your tunnelers, otherwise they will be killed whilst digging their tunnel entrance. Alternatively, just send in lots of them, preferably in several small invasions.


Engineers with Burning Oil are pretty much useless in an invasion force - they get killed long before they can tip their oil.


Monks are also pretty much useless in an invasion force - their are so slow and weak that even a moderate number of defending archers can kill off an entire army of monks! That being said, if there are no ranged attackers you'll be supprised at how effective large numbers of monks can be against not o?nly melee troops but also destruction of buildings and towers, etc.


Slaves, Spearmen and Laddermen are useful units for triggering castle defences such as killing pits, pitch ditches, caged war dogs, fire throwers and engineers with burning oil.


Make the Castle Difficult to Defend


Give the AI the upper hand by restricting the defensive measures the player can put in place. Here's some examples of what you might want to disable in the building options:


Moats are the single easiest way for the player to stop melee troops getting to their castle. Don't give them this luxury!


Tower ballista and Mangonells are ideal tools for destroying attacking siege equipment and troops! The player will need to be far more cunning without these devices!


Pitch ditches, engineers with burning oil and fire throwers can easily wipe out vast numbers of attacking melee troops if given the chance. Without this wall of fire the attacking troops are far more likely to get to the castle walls.


Fire ballista can be used to destroy attacking siege equipment from a distance - don't give them the opportunity!


Diseased cows can be launched at the invasion force from catapults and trebuchets - either disable dairy farms or don't allow the player to build catapults and trebuchets!


Shields are becoming far more popular for defending troops in towers and o?n castle walls. If the player has shields then they will fint it much easier to withstand invasions so spoil their fun and don't let them have them!


Tall lookout towers are often used in place of walls to stop the attacking archers from damaging the players troops. Although they are easy to destroy with catapults and trebuchets, they can still make an invasion force far less effective.


The large stone gatehouses are far more difficult to destroy than the smaller varieties. The best invasions are those which charge so gatehouses that are weaker are the most likely to enable this to happen!


Making it difficult for the player to get stone will make it difficult for them to build mighty castle walls with loads of towers.


A long siege (many small invasions) will help prevent the player from repairing their castle walls.


Invasion Size


Our final note is o?n the size of your invasions! Time after time, people make the mistake of sending in HUGE invasions - 500 units and usually several invasions of that size in the same month!


Take this advice: Don't do it!


You'll quickly hit the sprite limit and the gameplay will be horrible. What's more, anyone with a low spec computer will curse you as the game grinds to a halt trying to process all of those troops.


The best way to create large agressive invasion forces is to script lots of small invasions all at the same time - each invasion will send a small number of troops per attack wave, but because there are lots of invasions at the same time you will get lots of small attack waves at the same time resulting in what appears to be o?ne big attack wave.


Well, that's all for now, we hope this has given you some evil ideas of how to torment people who play your maps!


To Siege!

Scenario Design.doc


The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Topics

    • SH Legends: How to do proper invasions?

      (Apologies in advance if this is in the wrong forum!) Hey all, I have a question that I've had for years and was never able to get answered/solved. I'm trying to do an invasion in SH Legends and I've never figured out the proper technique to get the AI to behave properly. In SH2 it was relatively simple. You told the game where the AI would come in at, who to attack, where to siege from, voila. With SH Legends I haven't had such a luxury. I tell the AI what to do, but when they get to the siege

      in Stronghold Legends

    • Invasions that work, 2 maps posted

      I just posted the very first working invasion maps for Crusader 2, Bretar you have seen already, but this version is war scenario and is scripted harder than the old skirmish map.   Arvand is my first war scenario, it's a small map with big invasions, work to slow and you will be defeated, invasions start at day 24 and the last invasion starts at day 52, a few chances to breath in between, enough resources to build a good castle and economy, plus building a defending army will be not to hard, En

      in Stronghold Crusader 2

    • SHC2 Scripting

      Requesting map scripters to fix an invasion on my map. Everything is set up including markers but the invasion seems to sit idle. The attacking force will travel to the invasion point and set up a siege camp but then remain to hold ground. They do not attack me (the player) and I can't seem to find a fix.   I need people who can fix the problem, you will be given credit for the help in the map download. If anyone knows how please let me know with a contact email etc. and I will be sure to send

      in Volunteer Work

  • Create New...