Each item that can be generated as loot has the following parameters:
- Loot Chance (relative to other items)
- Minimum difficulty
- Maximum difficulty
Loot Generation Algorithm Edit
Loot generation starts with a total value. The total value is equal to the scavenge mission's difficulty value, the higher the scavenge difficulty, the more total value of items that will be generated.
The total value is evenly distributed between several item slots. The amount of item slots depends on the total value. When the total value is higher, more item slots will be allocated, and a larger variety of items can be looted, though less of each item (since the total value is evenly distributed between all slots).
For each item slot, an item is selected from the loot options (see item selection algorithm below). The amount of each item is the value that was assigned to the item slot, divided by the item's value.
The overall loot is the sum of all items in all item slots.
Item Selection Algorithm Edit
For each item slot, an item is selected randomly based on the item's loot chance. The loot chance is relative, so if there are two items and both have a loot chance of 1, there is a 50-50 chance that each item will be selected.
Only items whose minimum difficulty is lower than the total value, and whose maximum difficulty is higher than the total value, are considered.
The same item may be selected more than once, in several item slots.
Loot sub-node format Edit
The loot sub-node is a sub-node of a world location object node, in Objects.txt, that defines the random loot generation configuration for that location.
objects.entity.supermarket.loot.0.scraps=10 objects.entity.supermarket.loot.0.wood=5 objects.entity.supermarket.loot.0.stone=5 objects.entity.supermarket.loot.200.scraps=10 objects.entity.supermarket.loot.200.bricks=5 objects.entity.supermarket.loot.200.boards=5
Each key in the loot sub-node is a number, representing the minimum difficulty level from which this loot generation configuration is used.
In the example above, the first three entries define the loot options for scavenge missions of difficulty 0-200, while the last three define the loot options for scavenge missions of difficulty 200 and higher.
The configuration itself is a list of keys and values, where the key is the item ID and value is the chance to be selected.
In the example above, the first three entries define three items: scraps, wood and stone with selection chances of 10, 5 and 5.
So for the example above, for mission difficulties up to 200, there is a 50% chance to get scraps, a 25% chance to get wood and a 25% chance to get stone. For mission difficulties above 200 there is a 50% chance to get scraps, 25% chance to get bricks and 25% chance to get boards.