The Auto-garrison feature

From AGEWiki

(Redirected from AutoGarrison Feature)
Jump to: navigation, search

Auto-garrisoning is a feature presents in all AGE engine game. In a nutshell, it is the automated creation (during the hosting phase, without player intervention) of units in some structures you own, depending of certain conditions.


The AG feature comes in two flavors (three if you count you can disable it): None (value 0), Simple (1), Advanced (2). The rule level can be changed by altering the variable rulAutoGarrison in the GameRules.opt file

Beware: changing a game to use another rule if the data are not meant to support the rule will result in a
rapid crash of the game.

You cannot have both Simple and Advanced systems active in the same game installation,
as the choice is set in a game parameter that is defined when you load the game.


Simple Mode

The simple (the first one created) rule creates permanent units at day 0 of hosting (i.e before any move but after you received/bought replacements) in structures, depending of how the AG is defined for your faction. For a nation, the scenario makers will have to set the AG with the script command AddGarrison. The command allows to define for each area of your liking what are the units to place, for each Structure Type. The quickest way to set AG for a faction would be to use the whole map and say that all structures have the same garrisoning unit. This would need but one command. You can define with more finesse the AG by splitting the garrisons types by area and structures. For example in Africa the British can have a colonial garrison. Or in Forts, the garrison is a mixed unit with infantry and fortress guns, etc.

In Simple AG rule, there are several conditions to be met before the Hosting Module will create a garrisoning unit in a given structure, these are:

* The Faction must have a garrisoning unit defined for the given structure and area, with AddGarrison.
* Enough replacements of the first element of the unit which will be created must be in stock.
* No other garrisoning unit must already be in the region.
* The military control of the region must be 51% or more.
* There must be at least 20 supply points in the region (in advanced supply only).
* The structure must not be besieged.


Advanced Mode

In advanced rule, the garrison are transients. They will be created on the fly when an enemy enters the region, will remain as is until there is no more enemy, then will be removed. The advantage of the system is that the AGE engine can at last have forts defended by artillery when the structure is attacked and only if attacked (the units can help the defender already there, nothing more comforting for a single battered militia to know that the garrison made of 4 siege battery will pop-up if there is an attack!).

The rule is a bit more complex to set in place. The AddGarrison command is still used, but slightly differently. The command will want a Structure Family identifier and not a Structure Type. This finer granularity is necessary for the system, as you really don't want to have a Christian Mission to get the same defense (if any!) than a Military Outpost (both colonial structures of the Structure Type various in VGN).

Also, in advanced mode, there is no need for replacement to have the rule works (in the AddGarrison command, the ChanceRPL parameter can be ignored). We assume that the cost of the structure factored the cost to recruit units (this is a rationalization of a game logic problem related to prioritizing replacements).

In Advanced Mode, to have a garrison appear for a given structure, these conditions must be met by the faction:

* The Faction must have a garrisoning unit defined for the given structure and area, with AddGarrison.
* No other garrisoning unit (of the same faction) must already be in the region from a previous turn.
* There must be at least 20 supply points in the region (in advanced supply only).

     Note: The requirements stated for Simple Mode DO NOT APPLY in Advanced Mode


In addition to defining as in Simple Rule the AG with AddGarrison, the following data must also be set in place:

  1. You must define Structure Family aliases, then give to your structures a family (Family = xxxx in the .stc of each structure).
  2. Each structure that can generate a garrison must have other entries added to the Structure file:
a) Garrison = xxx
This will be the probability of the number of units (in hundredth) to generate. Example 110 means one unit plus 10% chance of a second. The rule will check all valid structures, so in the end a region can be defended by an hefty number of garrisons.
Forts are also a special case, the number generated will be times the level (not true for any other structures)
b) OnGarrisonLossChanceLoseLvl = xxx
c) ChanceLoseLvlModPerLevel = xxx
Now, if the AG is destroyed, there is still a chance to:
1) lose one level if the structure is above level 1
2) be destroyed if the structure is at level 1
This chance is OnGarrisonLossChanceLoseLvl , modified by (level-1) x ChanceLoseLvlModPerLevel
Example: if OnGarrisonLossChanceLoseLvl = 70 and ChanceLoseLvlModPerLevel = -10, then there is a 20% chance
that a level 5 city loses one level if its AG is destroyed. And level 7+ city will never lose a level.
 Note: these apply ONLY in cases where an AutoGarrison under the Advanced AG rule is destroyed. 
Any garrison placed in setups, events, etc. will NOT trigger these probabilities.
Also, if an AG unit surrenders prior to combat, the level reduction will not take place.



And that's it. It can be a bit misleading to realize that the garrisoning units themselves are not defined at the structure level but with AddGarrison. This is on purpose because AddGarrison is a script command, so can be altered by event. e.g at start of the game the garrisons are made of muskets and then later change armaments. Also, as garrisons can be defined by area, it is simply not possible to indicate an unit type in the structure file.

Note: the garrison is made of a single type of unit. You'll have to create custom units with infantry and artillery most of the time in the DB for garrisoning purpose.


Garrisons are automatically removed when there is no enemy in the region (more precisely when their strength is zero). They won't be recreated or regenerated while there is an enemy also, except in the case they are completely destroyed. in this case, the condition of the availability of supply is meant as a safeguard. If there is still some supply, then we assume there was men in reserve to recreate a garrison (this is also a slight engine limitation...).

Forums