Package Stack

From the CreationKit Wiki
Revision as of 15:02, 9 November 2011 by imported>Henning
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Actor Package List

A Package Stack is the term used to describe the stack of packages that "live on" an actor reference.

This stack is formed by adding Alias Package Lists to the top of Actor Package Lists which are added on top of default package lists.

After processing all the packages' schedule and conditions and removing ones which are available during the current day/time or whose conditions evaluate to false, the actor picks the top most package left on the stack.

This is a very powerful (if at first confusing) way to organize an actors set of behaviors, because you don't have to poke an actor every time he needs to do something else. The dynamic stack of packages is constantly updating based on schedules and conditions of individual packages causing them to be removed or returned to the stack.

The basic approach is to put "default" or fall through behavior, like "HangOutAtHome," at the bottom of the stack. And put very specific things like "EscortPlayerToDungeon" on top of the stack. In this method, you use conditions to turn off the specific things, and use the bottom of the stack to make sure the actor has something to do at all times that makes sense.

Example of Package Schedule
Example of Package Conditions

Example of stack

For example, a stack might look like:

  1. Escort Player to Dungeon : IF QuestStage MyQuest == 120
  2. Eat at tavern : 12:00 for 2 hours
  3. Sleep in bed : 20:00 for 8 hours
  4. Sandbox at home : no conditions or schedule

So no matter what, if MyQuest is stage 120, he will run the Escort Player to Dungeon package, otherwise if it's lunch time he'll be eating at the tavern, or sleeping at night, and if all else fails, will be hanging out at his house.

Various Stacks

In Oblivion and Fallout, each actor only had a single stack of packages that lived on his base NPC form. In TESV an Actor form has a stack of packages, but also, an actor's reference can pick up packages from any quest Alias he happens to be in at the time.

Quest Alias Package Stacks sit on top of an Actors base package list, and if an Actor is in multiple Aliases at the same time, the alias a package stacks are arranged according the quests' priority data field. (Higher priority quest's have their alias package stacks sitting higher up on the actor's package stack)

Additionally, and actor has a "default package list" which is a FormList of packages that acts as a package stack. This sits underneath the actor form's AI Packages stack. And below that, lives a default default package stack which is defined by the Default Object "Default Pack List" which in the shipped game is set to the Form List named "Default MasterPackageList"

And lastly, on top of everything, sit any packages that are running on the actor because he is in a Scene.

Stack Order Overview

Actor Package List
Alias Package List
Actor Default Package List
Default Default Package List


So the stacking order of the various package lists that will ultimately live on an actor reference is as follows (see images to right):

  1. Packages in currently running Scene Actions.
  2. Quest Alias Package List (if multiple aliases, use quest priority to sort)
  3. Actor Form AI Package Tab main list
  4. Packages in the Form List selected in the AI Package Tab's "Default Package List" drop down
  5. Packages in the Form List set to be the Default Object "Default Pack List"


Best Practice

Because packages can be dynamically added at run time via quest aliases, it's best practice to put all important quest packages inside alias package lists, rather than directly on an actor, so that the quest priority data can assist in determining which packages are on top of the stack. This is also why it so important to carefully conditionalize quest aliases so you don't grab someone important who might be busy doing something else and why it's so important to reserve your aliases in your quests. See Category: Radiant Story for more information on aliases.