Class StaticNPC
Attached to every static NPC in the game and maintains two kinds of information:
- From static layout data read from game files (RMB/RDB block data)
- 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.
Namespace: DaggerfallWorkshop.Game
Assembly: Assembly-CSharp.dll
Syntax
public class StaticNPC : MonoBehaviour
Properties
| Improve this Doc View SourceData
Gets serializable data pack about this NPC.
Declaration
public StaticNPC.NPCData Data { get; }
Property Value
Type | Description |
---|---|
StaticNPC.NPCData |
DisplayName
Gets display name of NPC from individual faction data or random seed.
Declaration
public string DisplayName { get; }
Property Value
Type | Description |
---|---|
String |
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 SourceAssignQuestResourceBehaviour()
Assigns a new QuestResourceBehaviour component if this is a Questor NPC. Can happen either at runtime or during scene layout.
Declaration
public void AssignQuestResourceBehaviour()
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 |
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. |
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. |
SetLayoutData(DFBlock.RdbObject)
Sets NPC data from RDB layout.
Declaration
public void SetLayoutData(DFBlock.RdbObject obj)
Parameters
Type | Name | Description |
---|---|---|
DFBlock.RdbObject | obj |
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 |
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 |
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 |
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 |
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 |