Jump to content

[RELz] Run For Your Lives


Arthmoor

Recommended Posts

run-for-your-lives-logo.jpg

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]

Downloads

AFK Mods
Bethesda.net - PC +XB1

Installation Requirements

Skyrim Special Edition 1.6.1130 or greater.
Unofficial Skyrim Special Edition Patch 4.3.0 or greater.

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

DO NOT extract the contents of the BSA file into your Data folder as loose files, or let your mod manager perform an equivalent function on the contents of the file. Doing so will cause things to load in the wrong order and break the game. Skyrim is intended to load a BSA alongside it's ESM/ESP file. Circumventing this causes issues which I will not provide support for. If you insist on going against this advice, you will receive no support for the problems you generate as a result of this.

Installation - Wrye Bash BAIN

Drop the archive into your Skyrim Special Edition 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, Run For Your Lives.bsa, and Run For Your Lives - Textures.bsa files into your Data folder.
Activate the mod using whatever management tool suits you.

Uninstall

Due to the nature of Skyrim mods, especially those adding scripts, it is strongly discouraged to attempt uninstalling a mod from your active game. Any mod that is more than pure mesh or texture replacements has the possibility to leave behind permanent changes to your save that you may not want. This is not something modders can correct for. It is how the game was designed by Bethesda. No support will be provided for anyone who uninstalls this mod from an active game and continues on with that save.

To remove the mod: Delete the Run For Your Lives.esp, Run For Your Lives.bsa, and Run For Your Lives - Textures.bsa files from your Data folder. Then reload your game as usual.

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 USSEP 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.

Compatibility

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:

MGRitual05DragonScript
DragonPerchScript
 
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:

[Papyrus]
bEnableLogging=1
bEnableTrace=1
bLoadDebugInformation=1
bWarnOnFillAliasFailure=1
bShowEventHandlingOutput=1

Enable the mod's debug log:

In MCM

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.

Disclaimer

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

  • Like 2
Link to comment
Share on other sites

I love this and the other mod to save NPC characters on PC! Question though, any chance we can see this for Xbox? This mod is ever more important on the consoles.

 

Thank you so much for these mods.

Link to comment
Share on other sites

  • 4 weeks later...

Version 3.1.0

Added combat override packages to the citizen aliases that should keep them out of the battle even if the game puts them into combat mode.

Link to comment
Share on other sites

Version 3.1.1

Repaired some data corruption that caused aliases to lose their scripts and the detection event to fail when it should have come up.

Link to comment
Share on other sites

  • 6 months later...

I was kinda surprised when I saw that you hadn't merged When Vampires Attack into Run For Your Lives for SSE. It's just for my curiosity, but why is that?

Link to comment
Share on other sites

No reason. Just didn't think of it is all. I may still end up doing that though.

Link to comment
Share on other sites

  • 2 months later...

Version 4.0

Merger with When Vampires Attack. Both mods will now continue development within this unified package.

This has been a popular request for some time, so I figured I'd get it done. As you may notice I've aggressively removed downloads for When Vampires Attack since the content is now entirely within this mod. Please remove WVA if you have it installed before updating to this release or you'll end up with some truly nasty surprises that can't be fixed.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

Just curious.  I read the description in the OP and I wonder about the five Papyrus lines in the Skyrim.ini.  I assume this one only needed to copy them and paste into the existing Skyrim.ini then save.

After doing that I took a quick look at the SkyrimPrefs.ini and notice the "bEnableStoryManagerLogging=1", which was set to 0 before I change it to 1.  Is it recommended to set it to 1?

On 2017-11-28 at 5:44 AM, Arthmoor said:

(God I hate that new layout so much)

Actually, I kinda like the new layout, once one get used of it.

Link to comment
Share on other sites

No, the story manager one is only needed if you're trying to debug a story event. The debugs in this mod only need the normal Papyrus stuff. So unless you're debugging those events in another mod you can turn that one back to 0.

Link to comment
Share on other sites

  • 9 months later...

Version 4.0.1

Dragons entering combat at more than 25000 units distance (more than 6 cells away) from the player will no longer trigger the protection quest. This fixes an edge case where for some reason dragons occasionally set off the system from the opposite side of the map.

Link to comment
Share on other sites

Version 4.0.2

Adjusted MGRitual05DragonScript to account for a vanilla bug fix.

Link to comment
Share on other sites

  • 2 months later...

Version 4.0.3

Another adjustment to MGRitual05DragonScript for a vanilla bug fix. (USSEP 4.2.3 Bug #28845)

Link to comment
Share on other sites

Version 4.0.4

Synced with fixes for recent USSEP updates.

Link to comment
Share on other sites

  • 6 months later...

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...