Encounters are special triggers which essentially spawn a group of creatures onto the map when stepped on.
They use the UTE filetype.
The encounter system has the encdifficulty.2da loaded which contains the contents:
2DA V2.0
LABEL STRREF VALUE
0 VeryEasy 5543 0
1 Easy 5544 1
2 Normal 5545 2
3 Hard 5546 5
4 Impossible 5547 9 |
This 2da links the VALUE column to be some kind of modifier for what it spawns when something enters it.
At their simplest (one trigger and one spawn point) a create that is hostile to the encounter will make the encounter spawn. EG: You can have a "Defender" encounter which is actually triggered by a walking "Hostile" creature. Generally most encounters are set to Hostile and are triggered purely by PCs.
Apparently the spawn point chosen should be the one furthest from the triggering creature. There may be some LOS checks done for it.
You have an encounter with a variety of monster CR's, "Unique" flags and the like, so what actually spawns and why?
Calculating the "Party level" would be done (probably things in a certain distance) then it likely compares it to the monsters available and figures out a good fit for spawning with some randomness built in.
How many creatures spawn? Tellingly in the GFF document it has this note: "Recommended number of creatures. Maps to "Min Creatures" field in toolset, but is not a true minimum, because it is actually possible for the encounter system to spawn fewer than this number of creatures if it cannot find enough creatures to fit the level of the encounter."
As mentioned the spawn points govern this and usually the furthest one from the triggering creature is chosen.
A note on the GFF says: "The SpawnPointList is only saved out if the encounter has spawnpoints defined for it in the toolset.Spawn points define a set of locations at which the game may spawn in creatures belonging to the Encounter. If an Encounter has no defined spawnpoints, then the game will try to spawn creatures out of visible range of the creatures that fired the Encounter."
There are some special properties of creatures spawned from encounters. At the very least since encounters can potentially "respawn" the encounter is told whenever a creature dies/is destroyed so it can repopulate the encounter.
A few script commands can be used on encounters as detailed on the lexicon. Sadly a lot of the information that is stored in-game about encounters is unavailable to access or change (eg; when encounters are spawned, the state of the encounter spawn pool, etc.).
The GFF contains a number of fields in the blueprint/copy in the area which are mostly exposed in the toolset itself.