Skywind NPC Schedules & AI

NPC Scheduling

Basic Guidelines

  • Keep this page bookmarked for technical information: https://www.creationkit.com/index.php?title=Category:Packages. This guide only covers goals and conventions, not the technical side of creating and implementing NPC packages.

  • The fundamental goal is that we want cities to feel actually alive, with NPCs roaming around, doing various activities, etc...

  • Generally, every NPC should at least have: two meals, a work "shift", and a sleep "shift". Ideally they will have some free time as well, but this is not necessary for certain busybody NPCs (shopkeepers, guild stewards, caravaners).

  • For some NPCs the work shift will be whatever store they own. For others it might be going and using a particular idle furniture (i.e farming, reading, moving stuff, etc). For many in-town NPCs, you will probably have to make up a job for them. Check their class and look for any unique dialogue they have to determine what their "job" should be.

      • "Job" is used loosely here. Generally it just means "thing they do throughout the day." Being a lazy bum is a completely valid profession in Morrowind; just make sure the NPC is visibly lazy, not just hiding in their house all day.

  • To help with variation, NPC free time activity can vary with day of the week. For instance, an NPC could visit a pub one or two days of the week, go for a walk another day, and sandbox at home during free-time otherwise. Perhaps once a week they could take a break from their work to visit the town's market or temple. (if there is one).

      • This is more important in major settlements (Balmora, Ald'Ruhn, Sadrith Mora, Ebonheart, Vivec) where we expect the player to spend a lot of time. In places the player will visit less often (e.g. Khuul or Dagon Fel), day-of-the-week variations in NPC behavior won't be as noticeable.

  • Giving an NPC a few things to do and letting them sandbox or patrol between them is a good way to make the NPC feel more "alive", compared to using a single piece of furniture or idle marker all day long.

  • Feel free to place things like idle markers and (invisible) furniture as needed to give NPCs things to do.

  • There should be some degree of variation in schedule between the NPCs in a town. For instance, we do not want every townsfolk to wake up at the same time, eat at the same time, work at the same time, and go to sleep at the same time. Make some people nightowls or early risers. Let them eat at different times, take breaks from work at different times, and so on.

  • When possible, make use of existing packages for NPC behavior. Filter packages for _Default for vanilla Skyrim default packages and for 0Default for Skywind default packages. These are easy ways to get scheduled eating, sleeping, and sandboxing behavior without needing to make a custom package.

  • Most NPCs have some very rudimentary scheduling (generic eat/sleep/sandbox near editor location). This is a hold over from very early on in Skywind (or possibly Morroblivion), and can be discarded as you see fit.

Specific Requirements

  • Please us the naming convention _[City][Person or Location][Short description][Start Time x Duration] for any packages you make.

  • Most towns (interiors & exteriors) have "scenes" between different NPCs (i.e. two NPCs having a conversation with each other). To make sure these scenes can take place, NPCs involved in scenes must sandbox near each other at some time during the day. You can find what NPCs have scenes together on this spreadsheet or by looking through scene quests in the Creation Kit. (These quests have a naming convention of "0Dialogue[City][Cell][NPC1][NPC2]".) You don't have to set up the scenes themselves; just make sure the NPCs sandbox near each other at some point during the day.

  • Shopkeepers should have a KeepAnEyeOn package to make sure the player doesn't go snooping through their things during work hours.

      • Exception: If the shop has a guard inside, then the guard should have the KeepAnEyeOn package instead.

  • Make sure that the door locking system works: NPCs should lock their doors when they go to sleep at night, and then open it when they wake up. They should get angry about trespassers at night.

  • Remember to account for NPC behavior during rainstorms and ash/blight storms (ash/blight storms use the IsSnowing condition). Most NPCs should run or walk inside when it starts to rain (slaves, outdoor merchants, other laborers may stay outside---use your judgment). All NPCs (except guards) should run inside when there is an ash storm.

      • Note: Ash storms only occur in ashy regions (Ashlands, Molag Amur, Red Mountain).

  • The "HoldPosition" procedure is meant for combat override behavior and is not appropriate for scheduling. If you want an NPC to stay at a certain spot, just use a travel package.

  • PLEASE do not move NPCs out of their original location. Skywind's dialogue system is heavily based on NPC editor location. Moving them to a new location will break this! It is okay to move them between cells, so long as the location stays the same. If the new location has the old location as it's parent, make sure the new location doesn't add any dialogue changes.

      • But really, just play it safe and don't move them.

Persist Location

  • NPCs must have a "Persist Location" set that covers the farthest-away location their packages will take them to.

  • For example, imagine an NPC "Bob" that lives in Vivec's St. Delyn Canton. If he never leaves the waistworks, his persist location would be _VivecStDelynWaistworksLocation. If he never leaves the canton, his persist location should be _VivecStDelynLocation. If he travels between cantons but doesn't leave Vivec, his persist location must be _VivecLocation. If he makes a weekly trip to visit Pelagiad, then the persist location should be _AscadianIslesLocation. If he makes a weekly trip to Balmora, then it must be _VvardenfellLocation. If, for some godforsaken reason, he is making a regular trip to Solstheim or further, then it would be TamrielLocation.

  • Typically, an NPC's persist location will just be the town they are in, e.g. _BalmoraLocation, _SeydaNeenLocation, and so on.

  • Consider the possibility of having some NPCs travel between cities. However, this only applies to non-quest NPCs. You can find a list of non-quest NPCs in this spreadsheet.

      • This is on hold until world encounters are complete and we can gauge how much more we need the roads to feel "alive".

Quest NPCs

  • Make sure we account for quest NPCs, so they don't end up too far from expected location (read: original Morrowind location). Not every player will choose to use quest markers, so we need to make sure that in-game directions to NPCs remain valid.

  • "Important" characters like guild stewards should not wander very far from their default location --- They should always be easy to find without quest markers. Similarly, shopkeepers should not be moving around very far during shop hours.

  • You will normally only be working with the package stage on the Actor Base object, but really NPCs have 5 package stacks they go through: First, a scene package stage. These are rare, and you don't have to worry about them for scheduling. Next, the Alias package stack, which are any packages applied to a quest alias that is filled with this NPC. If an NPC is in multiple aliases, the order they are evaluated will depend on the quest's priority. The Alias package stack should be used for NPC behavior while a quest is running, but not before or after. If there is no valid scene or alias package, then the engine will evaluate the regular package stack you see on the Actor window's AI Packages tab. If there's no valid package there, then the NPC will evaluate the "Default Package List", a formlist of packages for when the scene, alias, and regular package stacks have no valid packages. Finally, if there is no valid package on the selected Default Package List, the NPC will default to the "Default Pack List" default object.

  • Quest-related NPCs should have packages on their quest alias to keep them in their expected location while the relevant quest is active. For example, consider the Unsanctioned Training quest: We want Only-He-Stands-There to be in the South Wall Cornerclub basement for the duration of this quest. So, we can place a package on the quest alias to that keeps him there, and it will run so long as the quest is active.

  • Quest-adjacent* NPCs should have packages on their base object to keep them in their expected location while their quest is active, however this is not strictly required.

      • *: A "Quest-Adjacent" NPC is a generic character who offers information or commentary on a quest. For instance, for the Writ for Feruren Oran quest, we would want the vanilla Morrowind characters to be present in the inn, as their dialogue offers commentary on the player killing Feruren Oran. However, you don't need to make these NPCs wait in the bar 24/7. Instead, just have them hang out there a few more hours than usual.

Troubleshooting

  • It is highly recommended that you download and use either More Informative Console or Package Debug Helper to assist with debugging. These will both tell you what package an NPC is running currently, MIC through the console and PDH through spells you can cast on the NPC.

  • If you implement a package on an NPC and they don't seem to be using it,

      1. Check the NPCs persist location. It may be that they aren't loaded and so the game won't process their packages.

      2. Check that Navmesh is correct. If doors aren't connected through finalized navmesh, NPCs won't use them.

  • NPCs sometimes might not use idle markers in cells they do not own. (This is most common in inns/pubs.) To get around this, you can make the idle marker owned by "_PublicFaction" and add all relevant NPCs to _PublicFaction. This will allow them to use the idle while sandboxing in owned cells.

  • Similarly, if an NPC is using an idle marker or piece of furniture that you want them to avoid, you can use ownership to make them stop using it. For instance, you will want to make sure that only slaves use farming idle markers on a plantation---to do this, you could make the farming idle markers owned by a slave faction.

Default Master Package

Cell Data & Locks

This sections is guidelines for how to set up cell ownership, interior data, and NPC locking/unlocking behavior.

Cell Common Data

  • Every building in a town should have its own location, rather than simply by set to its town's location.

    • The naming convention for locations is _<Cell ID>Location. For instance, the BalmoraTsiyasHouse cell would have a location _BalmoraTsiyasHouseLocation.

    • Connected cells may share a location, for instance Drarayne Thelas's house and storage cells can both use _BalmoraDrarayneThelasHouseLocation.

  • The cell's location must have the town location as its parent location. For instance, _BalmoraTsiyasHouseLocation should have _BalmoraLocation as its parent.

    • Alternatively, there may be an intermediary between the cell and the town location. For example, _AldRuhnLlethriManorLocation has a parent of _AldRuhnSkarLocation, which in turn has a parent of _AldRuhnLocation.

  • The cell should have appropriate keywords, namely location type keywords (both vanilla Skyrim, starting with LocType, and Skywind, starting with 0LocType).

Cell Interior Data

  • All cells should have an owner, save for perhaps things like the Vivec Waistworks.

    • Ownership may be individuals or factions. Factions are only necessary if more than one NPC needs to inhabit the cell.

  • Guildhalls, inns, barracks, and similar locations should be flagged as Public Areas.

    • Worker housing, slave shacks, company offices, and so on, can be considered public areas. Anywhere that reasonable has high traffic of NPCs.

  • NPC homes and stores should not be flagged as public.

    • If a cell must be public for the purpose of a quest, the SetPublic() papyrus command can be used to dynamically alter this flag. The default, however, is to be not public.

  • "Off Limits" and "Can't Wait" are for special cases. For the purpose of scheduling towns, these should be unchecked.

  • If the cell is a Public Area, then the cell does not need a Lock List.

  • Otherwise, the cell's Lock List should match the cell's owner.

    • This means that if the cell has a faction owner, you need to make a formlist of NPCs corresponding to that faction.

Locking/Unlocking Behavior

  • Cells are locked/unlocked using the LockDoors and UnlockDoors procedures

  • When an NPC unlocks their doors, the player will be able to enter the cell without trespassing.

  • When an NPC locks their doors, the player will be considered trespassing if they enter the cell.

  • Locking happens automatically when an NPC leaves a cell, per https://www.creationkit.com/index.php?title=Locking_and_Unlocking_Doors

  • Locking must be specifically called for to lock doors while an NPC is in a cell (such as when going to bed).

    • Package templates often include this already, so, a good reason to use templates!

  • Unlocking must be specifically called for to unlock doors while an NPC is in a cell (such as waking up in the morning).

    • Again, package templates often include this already. Make sure to have it checked!

  • All NPCs who own a non-public area (i.e. regular townsfolk and shopowners, but not NPCS living in an inn or guildhall) need to lock their doors when they sleep at night, and unlock them when they wake up in the morning.

    • Optionally, you may make NPCs lock their doors early or unlock them late if you so choose, but they should be accessible most of the day.

Guard Scheduling

General Notes

  • Guards need patrols and/or positions so they're not just standing in one place. Some towns/cities have them set up, but they need improvement.

  • When making patrols, only use PatrolIdleMarker if you intend to have the guard stand at that spot for some time. If the guard is simply walking through that point or stopping only briefly, use an XMarkerHeading instead.

  • Towns may have Day and Night Guards, so the other can patrol while the other sleeps. However, there is a performance and level design burden to having so many extra NPCs, so this is not strictly necessary.

    • In-shop guards should not have day/night alternates and should be constantly-awake & in-place.

    • Vivec City will have always-awake Ordinators due to how many NPCs the city needs loaded already.

Default Town Guard Package Template

The package template 0DefaultTownGuardTemplate has been created to simplify the process of guard scheduling. The package 0DefaultTownGuardPackage is an unconditioned instance of the template. Guards using this package/template can automatically be made to patrol, stand post, follow & watch the player, or just wander, all based on linked ref keywords. The advantage of using this package/template is that 1) you need fewer guard base actors variants for a town and 2) there will be no linked ref conflicts with other functions.

To use, place a guard with this package somewhere in the world, and then link it to an Idle Marker/Furniture/xMarker/etc... with one of the following keywords:

  • LinkGuardKeepAnEyeOn - Guard will "keep an eye on" the player, waiting near the linked ref.

  • LinkGuardPost - Guard will stand at the linked ref. Can be an idle marker, furniture, xmarker, etc...

  • LinkGuardPatrol - Guard will patrol along the linked patrol path.

  • LinkGuardWander - Guard will wander around the linked ref.

  • LinkGuardSandbox - Guard will sandbox near the linked ref.

  • If none of the above keywords are used, the guard will sandbox near their editor location.

  • The package evaluates in the above order, i.e. if a guard has both a LinkGuardKeepAnEyeOn link and a LinkGuardPost link, the Keep An Eye On behavior will take precedence. The package template offers bools to change this behavior when it is used to make new packages.