NPC Behavior & Ambushes

Table of Contents

Skywind Default Master Package

All Skywind actor base objects should have 00SkywindDefaultMasterPackageList as their Default Package List (or, they should inherit this from their template).

So long as there are no valid packages in the NPC's package stack, the Skywind Default Master Package will govern NPC behavior.

The Skywind DMP lets you apply an array of simple behaviors to NPCs. It is not appropriate for scheduling, for instance, the behavior of a town, but will be good for bandits, mines, tombs, creatures, etc... 

To use the Skywind DMP you will need to know how to apply LinkedRefs to NPCs. See the Level Design Coding guide if you don't know how to do this.

This guide will cover all the things you can do with the Skywind DMP. There are examples of all these things in the cell zKMTestDefaultPackages.

I want my NPC to...

Sandbox where I placed them in the Creation Kit.

Nothing. Literally don't do anything, and this is what they will do.

Sandbox near a specific point.

Place an xMarker at that point, and link your NPC to it.

Stand at a specific point.

Place an xMarkerHeading at that point, and link your NPC to it.

Use a specific piece of furniture.

Place the furniture, and link your NPC to it. 

Use a specific idle marker.

Place the idle marker, and link your NPC to it.

Follow another NPC.

Link the follower to the leader.

Patrol in a loop.

Place xMarkerHeadings and/or idle markers, and link them into a loop. Then, link your NPC to whichever marker you want them to start their patrol at.

Patrol back and forth.

Instead of making a loop with the xMarkerheadings/idle markers, just have the chain end at some point. Then, link the NPC to where you want them to start.

Aside: What is "Sandboxing"?

"Sandboxing" is a behavior meant to make an NPC appear active by letting them interact with their environment. A sandboxing NPC will variously:

Using a sandbox procedure is an easy way to make an NPC appear "alive" without needing to directly control what they are doing and when they do it.

Because the DMP is meant more for bandits and the like than NPCs with actual schedules, the Skywind DMP by default will not allow NPCs to sleep. However, you can change this for specific NPCs if you want---just read to the next section.

What if I also want...

My NPC to run instead of walk?

Add the script fbmw_DefaultMasterPackageScript to your NPC (the placed NPC, not the base object), open the Properties window, and set the value of the SpeedRunning property to True instead of False (the default value is false).

My NPC to have their weapon drawn?

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of the WeaponDrawn property to True (the default value is false).

To let my sandboxing NPC be able to sleep?

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of the AllowSleeping property to True.

To stop my sandboxing NPC from wandering? (I want them to be working, not walking aimlessly!)

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of the NoWandering property to True.

My NPC to only wander and not sandbox?

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of the NoSandboxing property to True.

My NPC to stand exactly where I put them in the CK and not sandbox at all?

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of NoWandering to True AND the value of NoSandboxing to True. That said, you'd really be better off placing an xMarkerHeading and linking your NPC to it.

None of this is exactly right/I want something else entirely.

You probably need a custom package for this, rather than the default ones! Get in touch with the coding department for help.

Extra Notes on Patrols

Extra Notes on NPCs Following Other NPCs

How do I set up an ambush?

What is an ambush?

Ambushes are special combat encounters where an "Ambush NPC" waits outside of combat, typically in special furniture (the Creation Kit object type, not always literally furniture). The level designer can then control when and how the NPC gets up and starts attacking the player. 

In Skyrim, think of things like Draugr or Dragon Priests bursting out of sarcophagi, Dwemer spiders and spheres rolling down out of ports, Falmer climbing out of holes in the wall, Spriggans materializing out of trees, and so on. In Skywind, these are used for skeletons and bonewalkers, ancestral ghosts, Dwemer creatures, and so on.

What NPCs can I use for an ambush?

Technically, you can make any type of actor into an ambush NPC, but generally you will want to use the ones that have already been created in the CK. In the object window, filter for 1_Ambush_ for unleveled ambush creatures and 1_Lvl_Ambush_ for leveled ambush creatures. (Remember to read Skywind Creatures for creature naming conventions.) Packages require special NPC AI/Behaviors, so unless you really know what you're doing, try to stick to the premade ones.

What are the types of ambush?

This can mean a few different things, so I'll go over all the different distinctions here.

Standard vs. GroundFX vs. Runner

This is the first prefix after Ambush on the creature ID. 

OnDetect vs. OnTrigger

All ambush NPCs must must be activated before they will come out of their trigger. Prior to being activated, they will ignore combat and either wait ("sleep") at their ambush furniture, or do whatever else it is their packages tell them to do.

The next question is, what do they do when activated?

Furniture Types

Actually, there's no different types here. Skeleton/bonewalker alcove ambushes; wisp ground ambushes; Dwemer centurion ports; mechanically these are all identical. The type of furniture you want to use has no bearing on how the ambush NPC is named or how their packages are set up.

How do I set up an ambush?

Let's go through this in different steps.

Note: You may need to review the Level Design Coding guide if you aren't familiar with Linked Refs, Activate Parents, and placing Trigger Boxes.

Step 1: What does the NPC do while waiting?

Step 2: Does anything else need to be activated when the NPC is triggered?

Step 3: How is the NPC triggered?

How do I make a custom ambush NPC?

That depends on how custom. The easiest way is to make your new NPC templated off of an existing ambush NPC. Make sure to inherit Scripts, AI Packages, AI Data, and Default Packages. Anything else can be changed. Also, make sure to follow the naming scheme described in Skywind Creatures

If you need to make a completely new ambush NPC, then these are the things that are required for the ambush to work correctly. 

How can I keep my NPCs out of combat?

First things first: 

With that said, if your NPC isn't an ambush NPC, then read on...

A common complaint from level designers is that it's hard to keep NPCs from jumping into combat too early. You want separate fights in separate rooms, but the entire dungeon converges on the player at once as soon as the first fight breaks out. The Skywind DMP has a built-in solution for this. You can use it to make NPCs ignore combat until  released by script. This section will tell you how to set this up.

Step 1

Add the script fbmw_DefaultMasterPackageScript to your NPC, open the Properties window, and set the value of IgnoreCombat to True. This step tells the NPC to ignore combat.

Step 2

Place a 0_dun_AllowCombatTriggerbox triggerbox into your cell. When the player enters this triggerbox, it will allow NPCs linked to it to enter combat again. So, place it in an appropriate spot for this, e.g. just outside the door to a room where the creatures inside are being held out of combat.

Step 3

Link the triggerbox to all the NPCs you want it to be able to release for combat. The first link does not need a keyword, but after the first, you will need to use LinkCustom## keywords when linking to NPCs. In other words, the 2nd NPC should be linked to with the LinkCustom01 keyword; the 3rd NPC with the LinkCustom02 keyword, and so on.

Step 4 (optional)

By default, any NPC entering the triggerbox will release the linked NPCs for combat. If you want to change this so that only the player can release them, set the PlayerOnly property on the triggerbox's script to True.

Step 5 (optional)

If you want, you can delay the release of linked NPCs by filling in the ReleaseDelay array (a property on the triggerbox's script). The first value in the array is the delay between the player entering the triggerbox and the first NPC being released; the second value is the delay between the first and second NPC being released, and so on. For instance, if the array was [1.00, 1.00, 1.00], then: The NPC with no keyword on their link would release 1 second after the player enters the triggerbox; the NPC with the LinkCustom01 keyword would release after 2 total seconds (1 second after the first NPC), and the NPC with the LinkCustom02 (and all other linked NPCs) would release after 3 total seconds (1 second after the second NPC).

Final Notes

"Runner Type" NPCs

This was a special request from Squally and isn't technically a part of the Skywind DMP , but it works pretty similarly to it so I'm putting the guide on it here.

A "Runner Type" NPC has the following behavior.

NPC behavior is affected by the fbmw_DefaultMasterPackageScript when applicable:

To set this up:

Procedure Tree Details

This section describes the exact hierarchy that the package goes through to determine what behavior to use. The first valid behavior on the list is what the NPC will do.

Sandboxing Stack: This is reused several times so I'm only going to write it once. NoSandboxing, NoWandering, and AllowSleeping are encoded in the Variable04 actor value, where AllowSleeping uses Bit 1, NoWandering uses Bit 2, and NoSandbox uses Bit 3. Then:

 Where X is some location,