Jump to content

[RELz] Run For Your Lives


Recommended Posts


A small mod that makes citizens in a village or city run indoors during a dragon or vampire 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 Stendarr, 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]


AFK Mods
TES Alliance

Installation Requirements

Official Skyrim patch or greater.

Debug & Status MCM requires SKSE 1.7.1 (or higher) and SkyUI 4.1 (or higher) in order to use them.
These menus are not necessary for the mod to run if you don't have SKSE and SkyUI.

Installation - Wrye Bash BAIN

Drop the archive into your Skyrim Mods\Bash Installers folder, then install as usual.
Make sure the mod is active in the Wrye Bash mods tab.

Installation - Manual

Drop the Run For Your Lives.esp and Run For Your Lives.bsa files into your Data folder.
Activate the mod using whatever management tool suits you.


Remove the two files from the Data folder.

This mod has no continually updating scripts so the contamination of your save game will be minimal.

Known Issues

Detection of combat start events is inherently unreliable with dragons. Every effort has been made to ensure that when a dragon lands on the ground (yes, that has to happen before a combat detection can occur) that the quest to protect NPCs from dragons will run.

The new system can only manage up to 5 dragons in a single area through alias tracking. They should cycle out as dragons are killed and the survivors trigger new registrations, but this cannot be guaranteed.

Some NPCs may insist on entering combat with a dragon. Unfortunately Skyrim's AI system may not be entirely up to the task of making them follow the orders the mod is giving them. Efforts have been made to force NPCs to stop combat when the AI packs are running. Further efforts have been put in place to prevent bleedout NPCs who insist on being stupid from dying as a result. Please do not complain about NPCs who won't cooperate. I've done all I can here.

A bad navmesh in an attack location can severely impact the ability of NPCs to clear the area. If you see any getting stuck and acting like they can't move, this is probably why. If the area is modified, you'll need to take this up with the author(s) of the mod(s) affecting the area. If the area is NOT modified (ie: totally vanilla) then please report such events so that I can pass them along to the USKP tracker to investigate.

If an attack location has more than 150 NPCs to protect, only the first 150 will fill the quest aliases. After that, any leftovers are on their own and can still be killed! 150 NPC slots is enough to protect all of Solitude running Open Cities Skyrim with 60 slots left open. That ought to be more than enough. If it's not, there's nothing more I can do. Too many aliases in a quest leads to severe degradation in performance. I had to strike a balance somewhere.

The alias fill casts a very wide net, do not be surprised if you see Khajiit from the caravans come in to seek shelter from an attack, the carriage drivers, or other NPCs who commonly live outside of a major city and have no assigned interior homes.


Tested and confirmed to work in all vanilla cities, towns, villages, and smaller settlements.
Tested and confirmed to work with Raven Rock and the other smaller settlements on Solstheim.
Tested and confirmed to work with all DLC added dragon types.
Tested and confirmed to work with Open Cities Skyrim.
Tested and confirmed to work with Immersive Citizens - AI Overhaul.

Should be fully compatible with all user made dragon related mods, so long as the attacking dragon has MGRitual05DragonScript attached.

Mods which alter the following scripts will not be compatible without a patch:

Dragons Diversified requires a patch due to replacing MGRitual05DragonScript with its own. The patch can be acquired here: https://www.nexusmods.com/skyrim/mods/50844

A Note About Immersive Citizens - AI Overhaul

Several people have asked over the last few months if this mod is still needed if they are using ICAO. The answer to that question is YES.

ICAO sets up its aliases at the moment it is installed into your game. If you later install more mods that add NPCs to population areas, like Interesting NPC, Inconsequential NPCs, Cutting Room Floor, or other similar mods, then ICAO will not protect those NPCs. The only way it's at all possible to account for doing so on a consistent basis is if the protection for the NPCs is triggered on demand at the time of the event. That is what Run For Your Lives does.

If someone advises you to uninstall RFYL because you're using ICAO - don't listen to them. The advice is uninformed at best.

Troubleshooting Problems

In order to debug any problems that may occur with the mod, some information is REQUIRED - without it, there's nothing I can do. Comments reporting problems with the mod will be ignored unless this information is supplied.

In order to make this slightly easier to gather, I've updated the package with a global debug toggle that will turn on the log messages on demand.

You will obviously need to make sure your ini file has the following section:


Enable the mod's debug log:


Open the menu for the mod, select options, enable the "Script Debugging" option, and then close the menu. This menu will also tell you if the quest is running too.

Without MCM

Open the console with the ~ key and type:

Set ARTHRFYLDebugGlobal to 1

The Log Files

Your Payrus logs will begin tracking any and all activity generated by the system. While playing, if you run into a problem (folks running inside for no apparent reason etc) then I will need the following from that play session:

1. A copy of "C:/Users/<USERNAME>/Documents/My Games/Skyrim/Logs/Script/Papyrus.0.log"
2. A copy of "C:/Users/<USERNAME>/Documents/My Games/Skyrim/Logs/Script/Script/AliasDump/AliasDump.0.log"

Archive these files and put them on something like DropBox, or paste the contents to Pastebin.com, then provide a link to where I can get these.

One thing - don't bother if you're one of those people who has altered your Papyrus memory settings. Any logs I see in which this has taken place will be dismissed. Altering those settings is bad for the game and leads to malfunctions in scripting that can cause all sorts of unwanted behavior. If you're not using default vanilla Papyrus memory settings, I don't want to hear from you.

How to Make it Work With Your Mod

For Town/Village/City Mods

In order for the system in place to work with a mod added location, a few things need to be set up.

1. A location record (LCTN in TES5Edit) should be established with the keyword LocTypeHabitation.
2. This location requires a marker with its location reference type set to LocationCenterMarker. This only works outdoors, and is best placed as close to the geographic center of your area as possible.
3a. If your settlement has an inn, you can have that become usable by flagging the inn's location as LocTypeInn. It must be set as a child location of the location in step 1.
3b. If you do not have an inn, then you need at least one interior location with the LocTypeDwelling keyword set. It must be a child location of the location from step 1.
4. In the interior from step 3, a marker with its location reference type set to LocationCenterMarker must be placed. This is the target the AI packs will look for.
5. Place some dragon perches around on the tops of your buildings. These give them places to land which will increase the chances of a good detection.

When all 4 steps are complete, nothing further needs to be done. When a dragon attacks your village, settlement, city, or whatever, the citizens will flee. Where they go depends on a few things:

A. If they are already indoors, they will be made to stay there for the duration of the attack.
B. If they are outside, have a home in the city that is marked as LocTypeDwelling, and their editor location is inside the home, they will go there.
C. If the city has an inn, any non-residents and local NPCs whose editor locations are outdoors will go there.
D. If none of the above are true, the game will select a random interior from your area matching the LocTypeDwelling keyword and the NPCs will flee there.

For example, in Falkreath, the city has an inn. Any NPCs in the area who don't have a home flee there consistently.

In a place like Darkwater Crossing, where there is no inn, the NPCs have two choices. Either the mine or the one house. More often than not, the game would choose the mine.

An easy way to test the system is to use the console and type: set winextdragon to 0

This tells the dragon spawning system you're ready for one, and it should spawn shortly and move toward the area.

Alternatively, you can hand spawn one with the console and test the results wherever you happen to be standing. Such a test may be skewed by the fact that the dragon will become immediately hostile and will be on the ground already, so detection would be automatic. This method cannot simulate an approach from outside the area unless you yourself spawn the dragon far enough away from a town.

For Dragon Mods

In order for your dragons to be recognized by the combat detection, it will be required that they have the script MGRitual05DragonScript attached. This is considered normal for all dragons in the official content so that they can be used to harvest heart scales from them for the College of Winterhold. There are no properties to set. The modified script uses GetFormFromFile() to populate the needed data.

Even if your dragon is not appropriate to skin for the College quest, this script needs to be attached (ie: mechanical dragons) or they will be able to reek havoc on a population center without restriction.


This mod is not made, guaranteed, or supported by Nicrosoft, Zenimax, Bethesda Game Studios, or any of their affiliates.

Link to comment
Share on other sites

Gotta love how people go nuts over the little things for Skyrim. I've got two people already who have featured this in a video on Youtube :)

Link to comment
Share on other sites

It's an excellent little mod. Really fills a need. In my games, it wasn't the dragon that killed the citizens - it was me as they ran in front of my spells. So now I don't need to listen to "I saw what you did" for the rest of the bloody game when I kill some woman's husband!

Link to comment
Share on other sites

I feel like I'm the only one that doesn't have this problem. :lmao: A couple of guards may get killed here and there but no citizens.


Super idea though. It is these little ideas that have a big impact.

Link to comment
Share on other sites

Version 1.1

Expanded the coverage on the quest that runs the flee package to make all NPCs run for the inn instead of their editor locations. This now allows for NPCs who are stuck outdoors and would otherwise act even dumber than the farm animals.
Moved the trigger point for the attack quest back to the first dialogue spoke by the guards so that the citizens will have more time to flee to make up for the distance and possible traffic jams before the dragon reaches the location.
Raised the quest priority slightly to provide better coverage in the event other quests are being too assertive, and possibly causing unintended NPC deaths.
Modified the citizen selection aliases to prevent player teammates and dismissed followers from fleeing the fight.
The AI package has been changed to a "FleeTo" package since this will play the "duck and cover" anims while the NPCs make their way to the inn.
The AI package has also been modified to block anyone currently in combat from fleeing to the inn until their fight is over.
On the off chance there may be some within range of the attack, bandits and forsworn will not be covered by the system.
Members of The Companions and/or Vigilants of Stendaar will not be covered by the system as these two factions would be considered fit to fight.

Link to comment
Share on other sites

  • 2 weeks later...

Version 1.1.1

Had to change the system somewhat. It now checks for "Habitation" locations and sends the NPCs to a "Dwelling" within that location. It was dumb to see NPCs flee Darkwater Crossing trying to run all the way to Kynsegrove when they have a perfectly good house and mine to hide in.

Link to comment
Share on other sites

  • 3 weeks later...

Version 1.1.2

Small modification to the AI pack to only affect NPCs who are currently outdoors. If an indoor NPC steps outside, they should quickly end up back inside.

Link to comment
Share on other sites

Ok, so I just downloaded and installed this due to a little incident I mentioned over at BGS. After that incident I quit without saving.Loaded up a previous save, went to Falkreath again, dragon attacked again, nobody ran. Runil, Solaf, Indara, Mathias, Lod all wanted to help. Runil ended up dead again.Is it just me and my luck?

Link to comment
Share on other sites

Could be, because Falkreath was where I did the bulk of my testing.Keep in mind, the city guards are necessary to trigger the event. If the guards are not around for some odd reason, the warning to get inside never happens and the NPCs will not respond to it. There's no other way to go about it without ending up incompatible with every dragon mod under the sun.

Link to comment
Share on other sites

There were definately guards around .... not sure but I don't remember that first cry going up. I was standing in front of the Inn as were most people. Could it be if a guard at the village entrance did the warning that the NPC's didn't hear it?I'll test it again.

Link to comment
Share on other sites

Nobody actually has to hear it, including yourself. It just needs to be delivered, which is dependent on the guard gaining line of sight with the dragon first. So it is conceivable that the ones who fill the aliases don't see the dragon in time for it to be delivered properly.

Link to comment
Share on other sites

  • 1 month later...

Version 1.1.3

The protection quest is no longer triggered by the guards. The scene proved unreliable and so the quest now initiates when WIChangelocation09 hits stage 1.

The AI for the flee packages has been updated to allow NPCs to retreat to the inn if the attack location has one.

The system can now protect up to 150 NPCs in a given area.

Skyrim patch is now required for the mod to run.

Link to comment
Share on other sites

  • 3 weeks later...

Version 1.2

Added support for random wilderness Player vs Dragon events (WE04 quest).

Found and removed some rogue data which could have prevented the protection quests from launching.

Link to comment
Share on other sites

  • 2 months later...

Version 1.2.1

The script event for dragon attacks near settlements (WIChangeLocation09) will now trigger the flee response regardless of whether guards have line of sight on the dragon or not.

Link to comment
Share on other sites

  • 1 month later...

Version 1.2.2

The cultists from Dragonborn should no longer be caught in the safety net. dunPrisonerFaction is now considered exempt, which the cultists are a member of.

No, Dragonborn is not required for this, the faction is in vanilla Skyrim.

Link to comment
Share on other sites

I keep forgetting to add this in, and since I just decided to replay Dawnguard, I better get it.

Link to comment
Share on other sites

  • 1 month later...

Version 1.2

Added support for random wilderness Player vs Dragon events (WE04 quest).

Found and removed some rogue data which could have prevented the protection quests from launching.

I just encounter such event in Falkreth when I was on my way to Shriekwind Bastion or to be more specific to South Shriekwind Bastion where the word of wall can be found in one of Arngeir's random word a of voice quests.


Furthermore there were not only one dragon it was two dragons that attacked Falkreth at the same time and some NPC did try to hide, but other NPC's didn't do that instead they fight back with only daggers or with their fists.


This picture shows the outcome of this battle.

Link to comment
Share on other sites

Two dragons is not a normal occurrence. Strongly suggesting you're using dragon related mods. Also, if you managed to drag the one down from the word wall into the city, that will do nothing since there's no way to detect this happening without jamming up Papyrus with a constantly running script.

Link to comment
Share on other sites

Two dragons is not a normal occurrence. Strongly suggesting you're using dragon related mods.

I agree.  It's unusual to fight two dragons at the same time, but I'm not using any dragon related mods.


My loadorder are pretty the same when I posted my in-game "scripting running to slow" message a few days ago except that I removed Hi-Res Pack, UHRP and More Dynamic Injuries, but I installed 1-2 of Hana's mods.


* 00 Skyrim.esm [CRC: C665FD56]

* 01 Update.esm [CRC: 9D4C690E]

* 02 HearthFires.esm [CRC: B73E6C1E]

* 03 Dragonborn.esm [CRC: 100EFFB2]

* 04 ApachiiHair.esm [CRC: 783F7167]

* 05 Unofficial Skyrim Patch.esp [Version 1.3.2c] [CRC: 1D6506EC]

* 06 Unofficial Hearthfire Patch.esp [Version 1.1.0] [CRC: 7F7F4F60]

* 07 Unofficial Dragonborn Patch.esp [Version 1.0.4] [CRC: F42F2CF3]

* 08 Chesko_Frostfall.esp [CRC: A86681B4]

* 09 Better Dynamic Snow.esp [CRC: 4A46A8A7]

* 0A randomthunder.esp [CRC: 1058BBB4]

* 0B Economics of Skyrim.esp [CRC: 6E2B0731]

* 0C Ars Metallica.esp [Version 1.2.0] [CRC: DAA0CB0A]

* 0D Ars Metallica - Hearthfire.esp [Version 1.2.0] [CRC: 4D46526A]

* 0E Ars Metallica - Dragonborn.esp [Version 1.2.0] [CRC: B7D8828D]

* 0F Barrels and Crates.esp [CRC: 9BE22A5F]

* 10 Bring Out Your Dead.esp [Version 1.1.7] [CRC: 4C4EB7AB]

* 11 moredragonloot.esp [CRC: 6C36D066]

* 12 Point The Way.esp [Version 1.0.1a] [CRC: 4F3B7750]

* 13 SkyUI.esp [CRC: BA843F07]

* 14 HanasSkeletonStaff.esp [CRC: 495F1F8E]

* 15 Freedom of Speech.esp [CRC: BA881FCB]

* 16 Run For Your Lives.esp [Version 1.2.2] [CRC: 7764D0DD]

* 17 The Paarthurnax Dilemma.esp [Version 1.2.4] [CRC: E371E2D9]

* 18 Slof's Unique Frost.esp [CRC: D9CC88C4]

* 19 Signs and Guardians.esp [CRC: 1A7A8B32]

* 1A Open Cities Skyrim.esp [Version 1.0] [CRC: 8DDDC337]

* 1B OCS + Hearthfire Patch.esp [Version 1.0] [CRC: 6D35AFDC]

* 1C OCS + Dragonborn.esp [Version 1.1.1] [CRC: 389BB457]

* 1D SeeYouSleepByMadmole.esp [CRC: 1F27C375]

* 1E EMCompViljaSkyrim.esp [CRC: 50022D98]

* 1F EMViljaInSolstheimAddOn.esp [CRC: B62AD555]

* 20 AmazingFollowerTweaks.esp [CRC: D6C72A3C]

* 21 Alternate Start - Live Another Life.esp [Version 2.3a] [CRC: 38D04A24]

* 22 Bashed Patch, 0.esp [CRC: 4F66EF19]

Link to comment
Share on other sites

Then the only thing I can figure is that you dragged a static dragon down off his perch and into the city. RFYL can't account for this situation.

Link to comment
Share on other sites

No I haven't drag any static dragon into Falkreth, because I arrived to Falkreth by carriage from Riften and besides that was my first visit in Falkreth.  However I do suspect that something could happen in Riften which I'm not aware about.

Link to comment
Share on other sites

  • 3 months later...

Version 1.2.3

Data corruption appears to have built up over time which has rendered the aliases used by the WIChangeLocation09 and WE04 protection quests worthless. This has now been corrected by changing the form IDs on both quests and on all of the AI packs associated with them.

New protection against "Corpses in the aftermath of a dragon attack, Dog left behind" (WEJS18) has been added since this triggered event can be called up near occupied areas. One of which happens to be Falkreath.

Link to comment
Share on other sites

  • 1 month later...

I had this error in my log recently and it appears to be related to the RFYL mod (see below):

[12/03/2013 - 03:59:32PM] error: Cannot check location against a None location
[ (0001EB7D)].Location.IsChild() - "<native>" Line ?
[ (110158CB)].ARTH_PF_RFYLFleeDragonAtt_020058CB.Fragment_0() - "ARTH_PF_RFYLFleeDragonAtt_020058CB.psc" Line 12
This was a dragon attack on Winterhold (if it makes any difference). I also noticed that Malur Seloth decided not to flee into a nearby building and instead stayed outside for the duration of the attack and basically did nothing, except occasionally saying "I'm staying out of this" and "I'm getting out of here." Since it was an ancient dragon attacking, it wiped out both Winterhold Guards pretty quick;y before I could kill it (which actually isn't surprising).
(TracDown issue #14300)
Link to comment
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
  • Create New...