Float Mask
Float masks store arrays of floats:
Mask T
Index | Mask |
---|---|
0 | 0.0 |
1 | 2.0 |
2 | 1.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
Index | Weight | Count |
---|---|---|
0 | 100 | 10 |
1 | 200 | 10 |
2 | 300 | 10 |
Loot Table A (After Multiplying Mask T to Weight)
Index | Weight | Count |
---|---|---|
0 | 0 | 10 |
1 | 400 | 10 |
2 | 300 | 10 |
Loot Table A (After Multiplying Mask T to Count)
Index | Weight | Count |
---|---|---|
0 | 100 | 0 |
1 | 200 | 20 |
2 | 300 | 10 |
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)
Index | Mask |
---|---|
0 | 0.0 |
1 | 1.0 |
2 | 1.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)
Index | Weight | Count |
---|---|---|
0 | 0 | 10 |
1 | 200 | 10 |
2 | 300 | 10 |
This would effectively filter out row 0, because its weight would be 0.
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)
Index | Mask |
---|---|
0 | 1.0 |
1 | 2.0 |
2 | 1.0 |
Loot Table A (After Multiplying Mask V)
Index | Weight | Count |
---|---|---|
0 | 100 | 10 |
1 | 400 | 10 |
2 | 300 | 10 |
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)
Index | Mask |
---|---|
0 | 0.0 |
1 | 2.0 |
2 | 1.0 |
Loot Table A (After Multiplying Mask W)
Index | Weight | Count |
---|---|---|
0 | 0 | 10 |
1 | 400 | 10 |
2 | 300 | 10 |
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)
Index | Mask |
---|---|
0 | 100.0 |
1 | 100.0 |
2 | 100.0 |
In this case, instead of multiplying the mask, we will assign it:
Loot Table A (After Assigning Mask X)
Index | Weight | Count |
---|---|---|
0 | 100 | 100 |
1 | 200 | 100 |
2 | 300 | 100 |
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.