Table of Contents

Class NPCSpawnableSettings

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Per-spawner overrides for an NPC prefab: which attributes it rolls, which brain it runs, what it knows how to cast, and how big it is.

[Serializable]
public class NPCSpawnableSettings : SpawnableSettings
Inheritance
NPCSpawnableSettings
Inherited Members

Remarks

The point of putting these on the spawner rather than the prefab is that one prefab can then serve a whole zone's worth of variants. A single "orc" prefab becomes a weak orc in the starting valley and an elite orc at the dungeon entrance by changing an attribute database and an archetype here, instead of duplicating the prefab — which matters enormously for the pooling above, because each duplicate prefab is its own pool bucket and its own fixed slice of the map's memory budget.

Everything is applied in OnSpawned(NetworkObject, ObjectSpawner), which runs after the object leaves the pool and before ServerManager.Spawn — that is, before OnStartServer() rolls attributes and learns abilities, and before the spawn payload is written to clients.

Fields

AdditionalAbilities

Abilities granted in addition to the prefab's own list.

[Tooltip("Abilities granted on top of the prefab's own list.")]
public List<AbilityTemplate> AdditionalAbilities

Field Value

List<AbilityTemplate>

Remarks

Additive rather than replacing, so a spawner can hand an elite variant one extra signature ability without having to re-list everything the species already knows.

ArchetypeOverride

Optional AI archetype override — the NPC's whole brain in one asset.

[Header("Behaviour")]
[Tooltip("Replaces the prefab's AI archetype. Leave empty to use the prefab's own.")]
public AIArchetypeTemplate ArchetypeOverride

Field Value

AIArchetypeTemplate

Remarks

Lets one prefab be a passive critter at one spawner and an aggressive hunter at another without touching the prefab. Applied before InitializeOnce() reads its state slots.

AttributeBonusOverride

Optional attribute database override. When assigned, replaces the NPC prefab's default AttributeBonuses at spawn time, allowing per-spawner attribute variation.

[Header("Attributes")]
[Tooltip("Replaces the prefab's attribute database. Leave empty to use the prefab's own.")]
public NPCAttributeDatabase AttributeBonusOverride

Field Value

NPCAttributeDatabase

CorpseDecayDurationOverride

Optional corpse decay duration override. When greater than zero, overrides the NPC prefab default. Set to 0 to use the prefab default.

[Tooltip("Corpse decay duration in seconds. 0 = use prefab default.")]
public float CorpseDecayDurationOverride

Field Value

float

EmptyCorpseDecayDurationOverride

Optional empty-corpse decay override. When greater than zero, replaces the NPC prefab's EmptyCorpseDecayDuration. Zero uses the prefab's own value.

[Tooltip("Empty-corpse decay duration in seconds. 0 = use prefab default.")]
public float EmptyCorpseDecayDurationOverride

Field Value

float

Remarks

Useful where a placement's corpse density differs from the creature's norm — a dense grinding camp wants its emptied bodies gone sooner than the same creature standing alone on a road.

FactionOverride

Optional faction override, so the same prefab can be hostile in one zone and neutral in another.

[Tooltip("Replaces the prefab's race template / faction source. Leave empty to use the prefab's own.")]
public RaceTemplate FactionOverride

Field Value

RaceTemplate

LootTableOverride

Optional loot table override, so the same prefab drops zone-appropriate loot.

[Tooltip("Replaces the prefab's loot table. Leave empty to use the prefab's own.")]
public LootTableTemplate LootTableOverride

Field Value

LootTableTemplate

Remarks

The counterpart to AttributeBonusOverride: a spawner that makes one orc prefab into an elite is also the spawner that should decide the elite drops elite loot. Leave empty to use whatever the prefab carries.

MaximumScale

Maximum uniform scale applied to the spawned NPC.

[Tooltip("Maximum uniform scale. Must be at least the minimum to take effect.")]
public float MaximumScale

Field Value

float

MinimumScale

Minimum uniform scale applied to the spawned NPC. 0 or 1 leaves the prefab scale alone.

[Header("Appearance")]
[Tooltip("Minimum uniform scale. 0 or 1 leaves the prefab scale unchanged.")]
public float MinimumScale

Field Value

float

Remarks

Visual variety within one pool bucket. Deliberately uniform: a non-uniform scale would desynchronise the NavMeshAgent's radius and height from the collider.

ReplacePrefabAbilities

When true, AdditionalAbilities replaces the prefab's list instead of extending it.

[Tooltip("Replace the prefab's ability list rather than adding to it.")]
public bool ReplacePrefabAbilities

Field Value

bool

Methods

OnSpawned(NetworkObject, ObjectSpawner)

Injects spawner-specific overrides into the spawned NPC before OnStartServer() runs.

public override void OnSpawned(NetworkObject nob, ObjectSpawner spawner)

Parameters

nob NetworkObject

The instantiated network object to configure.

spawner ObjectSpawner

The spawner that created this object.

OnValidate()

Validates the settings, and reports scale ranges that cannot produce a value.

public override void OnValidate()

ResolveRespawnTimeRange(out float, out float)

Resolves the respawn delay range, preferring this spawner's override and falling back to the NPC prefab's own cadence.

public override void ResolveRespawnTimeRange(out float minimum, out float maximum)

Parameters

minimum float

Receives the shortest respawn delay in seconds.

maximum float

Receives the longest respawn delay in seconds.

Remarks

MinimumRespawnTime and MaximumRespawnTime are OVERRIDES here, not the values themselves. Leaving both at zero — which is what an author who has not thought about respawn timing leaves them at — means "use whatever the prefab says", so a creature keeps its own cadence at every spawner that can produce it and only differs where someone deliberately said it should.

Zero is the unset marker rather than a separate toggle, matching CorpseDecayDurationOverride. It costs the ability to author a genuinely instant respawn, which is degenerate for an NPC and was previously the accidental default for every spawner that left these blank.

Only the maximum is tested for "set". A minimum of zero is a legitimate override — "any time between now and thirty seconds" is a real cadence — whereas a maximum of zero cannot describe a range at all.