Skip to content

Call Loot Table

Call Loot Table

Evaluates a loot table and adds the resulting items and equipment to the party's inventory.

Note: The loot table is evaluated using the specified chance evaluation method and number of attempts, then the results are added directly to the inventory.

Properties

System

Name Explanation Type
Evaluation Method The chance evaluation method used when rolling the loot table. Chance Evaluation Method
Loot Table The loot table to evaluate. Variable or Value
Maximum Attempts The maximum number of attempts to roll the loot table. Variable or Value
Minimum Attempts The minimum number of attempts to roll the loot table. Variable or Value
Result The variable to store the number of items generated by the loot table. Variable or Value
Store Results When enabled, the number of items generated is stored in a variable. Toggle

Chance Evaluation Method

Name Explanation
Singular Only one item will result. Calculates the total sum of all chances and picks a single result from the weighted range.
Cumulative Each roll is evaluated against the total of all rows. Can generate every result, using a single random number against the cumulative sum.
Reroll Each row is independently re-evaluated with its own random roll against the maximum chance. Can generate every result.

Examples

Roll Loot Table 5 with 1 to 3 Attempts

Evaluates loot table index 5 somewhere between 1 and 3 times using the default reroll method, adding any generated items and equipment directly to the party's inventory.

call_loot_table(5, 1, 3);
{"Data":{"ChanceEvaluationMethod":"Reroll","LootTableIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"MaximumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"3","VariableIndex":0,"Metadata":null},"MinimumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.CallLootTableCommand"}

Roll a Variable-Indexed Table and Store the Result

Evaluates the loot table whose index is stored in Global Variable 1, rolling exactly 5 attempts using the cumulative method. The number of items generated is stored in Global Variable 0.

$gv[0] = call_loot_table($gv[1], 5, 5, cumulative);
{"Data":{"ChanceEvaluationMethod":"Cumulative","LootTableIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":1,"Metadata":null},"MaximumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"MinimumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":true,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.CallLootTableCommand"}

Single Singular Roll of Loot Table 2

Evaluates loot table index 2 exactly once using the singular method, which selects at most one entry based on weighted chance.

call_loot_table(2, 1, 1, singular);
{"Data":{"ChanceEvaluationMethod":"Singular","LootTableIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"2","VariableIndex":0,"Metadata":null},"MaximumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"MinimumAttempts":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.CallLootTableCommand"}