About This File
A small mod that makes citizens in a village or city run indoors during a dragon attack.
This was born out of frustration at seeing the citizens all trying to be a hero and rushing headlong to their doom attacking dragons. Instead, the citizens will run to safety like smart people should when faced with the horrors of giant flying fire breathing lizards. NPCs who live in the attack location who own a home there will retreat to it. If the attack location has an inn, NPCs who don't live there will flee to the inn, along with any NPCs who live outdoors. If no inn is present the game picks a random interior from the surrounding area and those NPCs will flee there instead.
This should work for any NPCs added by mods as well, up to a limit of 150 in the area. After that, they're on their own. The NPCs chosen are first come, first serve by the game engine.
Guards, members of The Companions, Vigilants of Stendaar, and the player's followers/teammates will not run, they will stand and fight. Farm animals will not run either, because they're stupid. That includes your horse.
Spawned dragons are detected via animation events, which should allow for completely reliable detection even if the dragon never lands on something.
Hand placed dragons are detected when their combat state changes* as well as when they land on any available perch objects in the area.
* [Only after they land on the ground]
What's New in Version 2.0.6
The package used to hold an NPC inside an interior if they're already there was rooting them in place, which looked strange in most cases. This has been changed to a "sandbox near self" package that should keep them indoors but allow them to conduct normal activity.