Composition
This doc refers to the new method of composition introduced in version 1.4.0. To convert from the previous method, see the upgrade guide.
Use Composition to combine multiple loot table templates and their float masks into a single loot table at runtime.
Mechanics
Composition appends the data of each table in the order received. E.g., if you pass {A, B, C}, it will compose into A, then B, then C.
The tables must share the same Source Data Type
and Distribution Type
to be composed. Otherwise, composition will use the first table's Source Data Type
and Distribution Type
and it will ignore incompatible tables.
Float Masks
You can opt to compose float masks with the table(s). This will append each float mask in order similarly to the tables' data. You can opt to compose based on rules (Union or Intersect) or manually define which masks should be composed.
For the examples below, suppose we have these tables:
Table A
Index | Weight | Ref Asset | Mask X |
---|---|---|---|
0 | 100 | G | 1.0 |
1 | 100 | H | 1.0 |
2 | 100 | I | 1.0 |
Table B
Index | Weight | Ref Asset | Mask X | Mask Y |
---|---|---|---|---|
0 | 200 | G | 2.0 | 2.0 |
1 | 200 | H | 2.0 | 2.0 |
2 | 200 | I | 2.0 | 2.0 |
Union
Composes unique masks from ANY table. Tables which don't have a mask will receive ValueForMissingRows for each of their rows. If composing tables {A, B}
above with Union{0.0}
, we will create:
Index | Weight | Ref Asset | Mask X | Mask Y |
---|---|---|---|---|
0 | 100 | G | 1.0 | 0.0 |
1 | 100 | H | 1.0 | 0.0 |
2 | 100 | I | 1.0 | 0.0 |
3 | 200 | G | 2.0 | 2.0 |
4 | 200 | H | 2.0 | 2.0 |
5 | 200 | I | 2.0 | 2.0 |
Intersect
Composes masks shared between ALL tables. If composing tables {A, B}
above with Intersect
, we will create:
Index | Weight | Ref Asset | Mask X |
---|---|---|---|
0 | 100 | G | 1.0 |
1 | 100 | H | 1.0 |
2 | 100 | I | 1.0 |
3 | 200 | G | 2.0 |
4 | 200 | H | 2.0 |
5 | 200 | I | 2.0 |
Manual
Manually define which masks will be composed. If compose tables {A, B}
above with Manual{(Mask X, 0.0), (Mask Y, 3.0), (Mask Z, 4.0)}
, we will create:
Index | Weight | Ref Asset | Mask X | Mask Y | Mask Z |
---|---|---|---|---|---|
0 | 100 | G | 1.0 | 3.0 | 4.0 |
1 | 100 | H | 1.0 | 3.0 | 4.0 |
2 | 100 | I | 1.0 | 3.0 | 4.0 |
3 | 200 | G | 2.0 | 2.0 | 4.0 |
4 | 200 | H | 2.0 | 2.0 | 4.0 |
5 | 200 | I | 2.0 | 2.0 | 4.0 |
Usage
Use the blueprint function Compose Loot Table:
Performance
Composition performance has been greatly improved with version 1.4.0; Performance cost should be negligible in most cases.
See the LV_Performance level from the example map for demonstrations.