Skip to main content

Float Mask

Float masks store arrays of floats:

Mask T

IndexMask
00.0
12.0
21.0

Modifying Loot Tables

You can use float masks to modify loot tables' weights or counts at runtime:

For the examples below, suppose we have this loot table1:

Loot Table A

IndexWeightCount
010010
120010
230010

Loot Table A (After Multiplying Mask T to Weight)

IndexWeightCount
0010
140010
230010

Loot Table A (After Multiplying Mask T to Count)

IndexWeightCount
01000
120020
230010

Common Uses

Filtering

Float masks can be used to filter rows from a loot table or distribution. This is commonly achieved using a mask of zeroes or ones:

Suppose we have Loot Table A and this mask:

Mask U (Filtering)

IndexMask
00.0
11.0
21.0

You can apply this mask to Loot Table A's weights using the ApplyMaskToWeights function, using Multiply:

Loot Table A (After Multiplying Mask U)

IndexWeightCount
0010
120010
230010

This would effectively filter out row 0, because its weight would be 0.

note

In the ARPG Loot Generation guide, we use filtering masks to remove affixes that have already been sampled.

Scaling

Often times you want to increase the weight of certain rows but keep the weight of others the same. This can be achieved using a scaling mask:

Suppose we have Loot Table A and this mask:

Mask V (Scaling)

IndexMask
01.0
12.0
21.0

Loot Table A (After Multiplying Mask V)

IndexWeightCount
010010
140010
230010
note

In the ARPG Loot Generation guide, we use scaling masks to increase or decrease affix probabilities.

Combining

The real power of masks comes from combining them together. Most commonly, combining masks involves multiplying them:

Suppose we have Mask U and Mask V from above; we can multiply them together to get the result of applying both masks:

Mask W (U * V)

IndexMask
00.0
12.0
21.0

Loot Table A (After Multiplying Mask W)

IndexWeightCount
0010
140010
230010

Restocking

Prior to Stoch 1.4.0, distributions with counts had the concept of restocking their items, or returning them back to their original counts. This could be used to reset a distribution after sampling (i.e., if you want to reuse it). However, the same can be achieved by applying a float mask to counts instead:

Mask X (Counts)

IndexMask
0100.0
1100.0
2100.0

In this case, instead of multiplying the mask, we will assign it:

Loot Table A (After Assigning Mask X)

IndexWeightCount
0100100
1200100
2300100

Mask Generators

Mask generators allow you to get data from a loot table's sources2 and store it into float masks in the loot table template. These masks can be accessed at runtime to manipulate the loot table. See the Mask Generators page for more details.


  1. The references have been omitted because they are irrelevant.
  2. The Data Table Row(s) or Data Asset(s) being referenced by your loot table.