Show / Hide Table of Contents

Class StaticNPC

Attached to every static NPC in the game and maintains two kinds of information:

  1. From static layout data read from game files (RMB/RDB block data)
  2. From instantiation context (in a dungeon, a building, etc.) This behaviour helps solve the problem of layout classes not knowing (or needing to know) about runtime quest state, and vice versa. It also decouples NPC information from Billboards. Other uses include Questor injection, hiding relocated NPCs, and disabling NPCs that have been permanently removed by quest system.

Notes:

  • Static NPCs only exist inside buildings and dungeons, these are not the wandering NPCs in towns.
  • This behaviour will be used to ultimately decouple NPC information from Billboards.
  • Any NPC replacers (e.g. to 3D models) will need to assign this behaviour with original layout data.
  • Correct NPC name seed is currently unknown, using offset position in layout data for now.
Inheritance
Object
Object
Component
Behaviour
MonoBehaviour
StaticNPC
Namespace: DaggerfallWorkshop.Game
Assembly: Assembly-CSharp.dll
Syntax
public class StaticNPC : MonoBehaviour

Properties

| Improve this Doc View Source

Data

Gets serializable data pack about this NPC.

Declaration
public StaticNPC.NPCData Data { get; }
Property Value
Type Description
StaticNPC.NPCData
| Improve this Doc View Source

DisplayName

Gets display name of NPC from individual faction data or random seed.

Declaration
public string DisplayName { get; }
Property Value
Type Description
String
| Improve this Doc View Source

IsChildNPC

Checks if this is a child NPC using texture or faction.

Declaration
public bool IsChildNPC { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

AssignQuestResourceBehaviour()

Assigns a new QuestResourceBehaviour component if this is a Questor NPC. Can happen either at runtime or during scene layout.

Declaration
public void AssignQuestResourceBehaviour()
| Improve this Doc View Source

GetPositionHash(Int32, Int32, Int32)

Creates a hash from fixed-point layout position.

Declaration
public static int GetPositionHash(int x, int y, int z)
Parameters
Type Name Description
Int32 x
Int32 y
Int32 z
Returns
Type Description
Int32
| Improve this Doc View Source

GetRaceFromFaction(Int32)

Return the race corresponding to a given faction ID.

Declaration
public static Races GetRaceFromFaction(int factionId)
Parameters
Type Name Description
Int32 factionId
Returns
Type Description
Races

The faction race if available, otherwise the race of the current region.

| Improve this Doc View Source

IsChildNPCData(StaticNPC.NPCData)

Check if a known child NPC.

Declaration
public static bool IsChildNPCData(StaticNPC.NPCData data)
Parameters
Type Name Description
StaticNPC.NPCData data
Returns
Type Description
Boolean

True if NPC data matches known children textures or faction.

| Improve this Doc View Source

SetLayoutData(DFBlock.RdbObject)

Sets NPC data from RDB layout.

Declaration
public void SetLayoutData(DFBlock.RdbObject obj)
Parameters
Type Name Description
DFBlock.RdbObject obj
| Improve this Doc View Source

SetLayoutData(DFBlock.RmbBlockFlatObjectRecord, Int32, Int32)

Sets NPC data from RMB layout flat record. (exterior NPCs) Requires mapID and locationIndex to be passed in as layout may occur without player being in the location.

Declaration
public void SetLayoutData(DFBlock.RmbBlockFlatObjectRecord obj, int mapId, int locationIndex)
Parameters
Type Name Description
DFBlock.RmbBlockFlatObjectRecord obj
Int32 mapId
Int32 locationIndex
| Improve this Doc View Source

SetLayoutData(DFBlock.RmbBlockPeopleRecord, Int32)

Sets NPC data from RMB layout.

Declaration
public void SetLayoutData(DFBlock.RmbBlockPeopleRecord obj, int buildingKey = 0)
Parameters
Type Name Description
DFBlock.RmbBlockPeopleRecord obj
Int32 buildingKey
| Improve this Doc View Source

SetLayoutData(ref StaticNPC.NPCData, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int64, Int32, Int32, Int32)

Declaration
public static void SetLayoutData(ref StaticNPC.NPCData data, int XPos, int YPos, int ZPos, int flags, int factionId, int archive, int record, long position, int mapId, int locationIndex, int buildingKey)
Parameters
Type Name Description
StaticNPC.NPCData data
Int32 XPos
Int32 YPos
Int32 ZPos
Int32 flags
Int32 factionId
Int32 archive
Int32 record
Int64 position
Int32 mapId
Int32 locationIndex
Int32 buildingKey
| Improve this Doc View Source

SetLayoutData(Int32, Int32, Int32, Genders, Int32, Int32)

Sets NPC data directly.

Declaration
public void SetLayoutData(int x, int y, int z, Genders gender, int factionID = 0, int nameSeed = -1)
Parameters
Type Name Description
Int32 x
Int32 y
Int32 z
Genders gender
Int32 factionID
Int32 nameSeed
| Improve this Doc View Source

SetLayoutData(Int32, Int32, Int32, Person)

Sets NPC data from quest Person resource.

Declaration
public void SetLayoutData(int x, int y, int z, Person person)
Parameters
Type Name Description
Int32 x
Int32 y
Int32 z
Person person

Extension Methods

MBExtensions.Invoke(MonoBehaviour, Action, Single)
MBExtensions.Invoke<T>(MonoBehaviour, Action<T>, T, Single)
MBExtensions.Invoke<T1, T2>(MonoBehaviour, Action<T1, T2>, T1, T2, Single)
MBExtensions.Invoke<T1, T2, T3>(MonoBehaviour, Action<T1, T2, T3>, T1, T2, T3, Single)
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX