Class LootTableTemplate
Defines what a corpse holds: a set of independently-rolled item entries and a currency range.
[CreateAssetMenu(fileName = "New Loot Table", menuName = "FishMMO/Character/Loot/Loot Table", order = 1)]
public class LootTableTemplate : CachedScriptableObject<LootTableTemplate>, ICachedObject
- Inheritance
-
ObjectScriptableObjectLootTableTemplate
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Rolled exactly once, on the server, at the moment the NPC dies — never on the client and never again afterwards. The corpse then owns concrete Item instances, so what two looters see is the same pile rather than two independent rolls of the same table.
Assigned on the NPC prefab and overridable per spawner via LootTableOverride, matching how attributes and abilities already vary one prefab across a zone.
Fields
Entries
Item lines rolled independently of one another.
[Tooltip("Item entries. Each is rolled independently.")]
public List<LootTableEntry> Entries
Field Value
MaximumCurrency
Largest currency amount a corpse may carry.
[Tooltip("Maximum currency dropped.")]
[Min(0)]
public int MaximumCurrency
Field Value
MaximumItemDrops
Hard cap on how many item stacks a single roll may produce.
[Tooltip("Maximum item stacks a single roll may produce.")]
[Min(1)]
public int MaximumItemDrops
Field Value
Remarks
Independent rolls have no natural ceiling, and the corpse's slot count is what the loot window renders — an unbounded table would produce a window of arbitrary size and a spawn payload to match. Entries are considered in list order, so the cap makes the earlier entries in a table the ones that survive it.
MinimumCurrency
Smallest currency amount a corpse may carry. Zero disables currency for this table.
[Header("Currency")]
[Tooltip("Minimum currency dropped. 0 with a 0 maximum means no currency.")]
[Min(0)]
public int MinimumCurrency
Field Value
Properties
Name
public string Name { get; }
Property Value
Methods
Roll(DeterministicRNG, List<Item>, out int, float, float)
Rolls this table into concrete items and a currency amount.
public void Roll(DeterministicRNG rng, List<Item> results, out int currency, float quantityMultiplier = 1, float currencyMultiplier = 1)
Parameters
rngDeterministicRNGRandom source. Falls back to the shared generator when null.
resultsList<Item>Receives the rolled items. Cleared before use.
currencyintReceives the rolled currency amount.
quantityMultiplierfloatScales the amount in each stack rolled, for a dungeon difficulty that pays better. 1 leaves the table alone, which is what the open world always passes.
currencyMultiplierfloatScales the currency rolled. 1 leaves it alone.
Remarks
The caller supplies the RNG so a corpse's contents can be reproduced from the NPC's own seed rather than from global shared state, which is what makes a death replayable when diagnosing a loot report.