Table of Contents

Class NPCRelationship

Namespace
S1API.Entities
Assembly
S1API.dll

Modder-facing wrapper for an NPC's relationship data. Provides safe access to relationship values, unlock state, connections, and convenience helpers which bridge to the base game's NPCRelationData. Relationship configuration must be done in ConfigurePrefab(NPCPrefabBuilder).

public sealed class NPCRelationship
Inheritance
NPCRelationship
Inherited Members
Extension Methods

Remarks

Use this to manage NPC social connections, unlock states, and relationship levels with the player and other NPCs. Subscribe to OnChanged and OnUnlocked events for dynamic relationship interactions.

Properties

ConnectionIDs

Returns the IDs of current connection NPCs (safe across Mono and IL2CPP).

public List<string> ConnectionIDs { get; }

Property Value

List<string>

Delta

Current relationship delta, clamped to [0, 5]. Setting invokes the game's SetRelationship.

public float Delta { get; set; }

Property Value

float

IsKnown

True if the NPC is known to the player (directly or via mutual connections).

public bool IsKnown { get; }

Property Value

bool

IsMutuallyKnown

True if the NPC is known via mutual connections even if not directly unlocked.

public bool IsMutuallyKnown { get; }

Property Value

bool

IsUnlocked

True if the NPC has been unlocked (known) to the player systems.

public bool IsUnlocked { get; }

Property Value

bool

Normalized

Normalized relationship delta in [0, 1].

public float Normalized { get; }

Property Value

float

Type

The way this NPC was unlocked. Setting attempts to assign the base game's UnlockType via reflection without unlocking.

public NPCRelationship.UnlockType Type { get; set; }

Property Value

NPCRelationship.UnlockType

Methods

Add(float, bool)

Adds to the relationship delta (optionally networked).

public void Add(float delta, bool network = true)

Parameters

delta float
network bool

SetUnlockType(UnlockType)

Sets the underlying unlock type without changing locked state. Use Unlock(UnlockType, bool) if you intend to unlock as well.

public void SetUnlockType(NPCRelationship.UnlockType type)

Parameters

type NPCRelationship.UnlockType

Unlock(UnlockType, bool)

Unlocks this NPC with the specified type.

public void Unlock(NPCRelationship.UnlockType type = UnlockType.DirectApproach, bool notify = true)

Parameters

type NPCRelationship.UnlockType
notify bool

UnlockConnections()

Unlocks all connected NPCs (recommendation unlocking).

public void UnlockConnections()

Events

OnChanged

Subscribes to relationship change events. Callback receives the change amount. Best-effort under IL2CPP; silently no-ops if delegate bridging is unavailable.

public event Action<float> OnChanged

Event Type

Action<float>

OnUnlocked

Subscribes to unlocked events. Callback receives unlock type and notify flag. Best-effort under IL2CPP; silently no-ops if delegate bridging is unavailable.

public event Action<NPCRelationship.UnlockType, bool> OnUnlocked

Event Type

Action<NPCRelationship.UnlockType, bool>