Looting

## Overview

Looting (which is sometimes referred to as Scavenging) is the player activity of searching for and gathering Resources referred to as Loot. These Resources consist of Clothing or Armor, Weapons, and Food found in all kind of Containers within the various Points of Interest. The quality and quantity of loot you obtain by opening a previously-unopened Container is determined by your Loot Stage and influenced by your Loot Bonus. Empty containers respawn new Loot after 30 days by default. The Loot respawn can be changed in the main menu when setting up the game. On very rare occasions players will find complete items such as vehicles or robotics defense items.

## Loot Stage

As of Alpha 20, Loot Stage is a separate measure which increases similar to Game Stage, but with additional bonuses available. In addition to the Lucky Looter perk, the Lucky Goggles, and Eye Kandy, the biome, POI, and even the specific container being looted can affect Loot Stage. Unlike Game stage, the number of days the player has been alive does not affect the Loot Stage. The player's current Loot Stage is visible in the player details screen, and the console 'gamestage' command will show it as well.

If playing in a party, the highest Loot Stage of party members is used when a container is opened. (See: Party.cs, GetHighestLootstage() and LootManager.cs, LootContainerOpened() in Assembly-CSharp.dll)

## Ordinary Loot

Much of the loot in the game is not affected by Loot Stage. It can change from release to release during the alpha, and there are far too many loot groups and combinations to cover in the Wiki, but in general mundane containers (think: not safes, lockboxes, loot-room boxes, or lootables obviously designed to return armor/weapons/tools/books) will use fixed probabilities which are not affected by Loot Stage. For details, see loot.xml in the /data/config folder.

## Loot-Stage-Scaled Loot

Nearly all tiered loot (tools, weapons, and armor) as well as books, schematics, mods, ammo, recipes, and parts are affected by Loot Stage. There are four "tiers" of loot used in-game which become more or less common as your Loot Stage rises. These loot tiers generally line up directly with weapon, armor, and tool tiers, with other non-tiered items (e.g. schematics or ammo) being assigned loot tiers based on either their relationship to tiered items (e.g. 4x4 Truck parts are assigned Tier 3 for loot purposes) or simply The Fun Pimps' assessment of the item's tier.

* Tier 0 (T0) items are primitive items, usually available from the beginning of the game or very early. These include stone tools/weapons, padded and scrap armor and basic mod schematics.
* Tier 1 (T1) items are usually items made of iron, such as iron tools, weapons and armor, first proper weapons outside of blunderbuss and schematics for items in the next tier.
* Tier 2 (T2) items are the first items made from steel and consist of the best available melee weapons and armor, rarest schematics and the best food recipes.
* Tier 3 (T3) items are the best firearms, tools and vehicles in the game.

The following graph displays the *relative* loot probability of the loot tiers by Loot Stage, as of Alpha 20.2. After Loot Stage 290 there are no further changes to the probabilities. The "Tier 2 (Cap)" curve is used for Tier 2 items which have no Tier 3 equivalent, e.g. books. Using this curve for those items ensures you can still find them throughout the late game.

Since these numbers are used relative to each other (and relative to the probabilities of any non-Loot-Stage-scaled loot), you should interpret the areas where they cross as showing the relative likelihood of getting the lower or higher tier. For example, at Loot Stage 52, the curves for Tier 0 and Tier 1 cross. At this point both tiers have a probability number of about 0.27, however this does not mean "27% chance". Since they both have the same probability - and assuming these were the only two possible items to be looted - it means they have *equal chance* of being selected. Likewise, a probability on this chart of 1.0 does not mean "100% chance" - it means that loot items in that tier will be weighted 1.0 compared to any other items in the potential loot. Other items which also have 1.0 (maybe even non-Loot-Stage-scaled items which are in the same loot group) will have equal chance of being selected.

## Loot RNG Example

The loot system is quite flexible and also complex. All loot containers, loot groups, and probability tables are in /data/config/loot.xml. Below are two examples of how to interpret loot groups and how the random number generator is used to select loot. These examples are taken from Alpha 20.2 and have been simplified. The concepts should hold true for any future alpha.

### Example 1 - Simple Group with Fixed Probabilities

```
<lootgroup name="groupMedicalCommon" count="1">
 <item name="foodHoney" loot\_prob\_template="low"/>
 <item name="medicalBandage"/>
 <item name="medicalAloeCream"/>
 <item name="medicalSplint" loot\_prob\_template="low"/>
</lootgroup>

```

The group above can be broken down as follows:

* (Line 1) count="1" - this means that the game will pull from this group one time.
* (Lines 2-5) <item name="xxxx"> - these are the items which can be returned by the group.
* (Lines 2 & 5) loot\_prob\_template="low" - this tells the game to look up a loot probability template named "low". Loot probability templates are how 7D2D applies Loot Stage to the probability of an item. As of A20.2 the "low" template returns a probability of 0.2 *for all Loot Stages*. This makes it effectively a fixed probability.
* (Lines 3 & 4) No loot\_prob\_template - this means a default probability of 1.0 will be used.

The game calculates the true probabilities and selects an item as follows:

1. The probabilities of all items are added up. In the example that would be 0.2 + 1.0 + 1.0 + 0.2 = 2.4.
2. The probability of each item is divided by the total, to determine a net probability. In the example, this works out to (ignore rounding errors):
	* foodHoney = 0.2 / 2.4 = 0.083
	* medicalBandage = 1.0 / 2.4 = 0.42
	* medicalAloeCream = 1.0 / 2.4 = 0.42
	* medicalSplint = 0.2 / 2.4 = 0.083
3. The game pulls a number from the random number generator and selects an item using the net probabilities above. For example an RNG result from 0.0 to 0.082 would select foodHoney. A result between 0.083 and 0.504 would return medicalBandage.
4. If the "count" property of the group were 2, for example, another RNG number would be pulled and another item selected (maybe the same item).

### Example 2 - Group-Within-Group and Count="All"

```
<lootgroup name="groupSmallWeaponBag" count="all">
 <item group="groupWeaponsLowHighMed" count ="1"/>
 <item group="groupWeaponsHighMedLow" loot\_prob\_template="med" force\_prob="true"/>
 <item group="groupSmallAmmoMedMed" loot\_prob\_template="low" force\_prob="true"/>
</lootgroup>

```

* (Line 1) count="all" - this means that every entry in the group will be returned, however see next bullet
* (Lines 3 & 4) force\_prob="true" - this means that even though the group specifies count="all", the game is forced to test this item against its probability, which comes from a loot\_prob\_template of "med" (0.5) or "low" (0.2). Basically items with force\_prob="true" on them are treated like their own individual RNG checks, not grouped up like in the previous example.
* (Line 2) count=1 - this works just like the other "count" properties: the target group, "groupWeaponsLowHighMed" will be drawn from 1 time

Because of the count="all" and the force\_prob="true" items, this group works differently from the first example.

1. Due to count="all" every item *without* force\_prob="true" is automatically selected. In this example, that means that "groupWeaponsLowHighMed" will be processed just like in these examples. That group might be full of individual items, or yet more groups. Whatever the case, loot from that group will be returned.
2. All items with force\_prob="true" are given an independent RNG check vs. their raw probability. No grouping up like in the previous example. That works out as:
	* groupWeaponsHighMedLow has probability 0.5 from loot\_prob\_template="med". An RNG result of 0.0 to 0.5 would select this item (and run through the group just like in these examples).
	* groupSmallAmmoMedMed has probability of 0.2 from loot\_prob\_template="low". An RNG result (separate from the previous one) of 0.0 to 0.2 would select this item.
3. It is quite possible for results from all three listed groups to be returned if the RNG is favorable, due to count="all".

### Loot Stage Scaling for the Above Examples

The only thing Loot Stage scaling changes is the "loot\_prob\_template" properties. Instead of "low" (essentially a fixed 0.2) you will see "ProbT1" for example, which will translate - based on your Loot Stage - to a probability between 0.0 and 1.0, in line with the graph shown above. For example, if an item used loot\_prob\_template="ProbT1" (the Tier 1 curve) and your Loot Stage were 70, that would map to a probability of approximately 0.7. If your Loot Stage were 85, that same item would now have a probability near 1.0. All of the calculations shown above apply to this Loot-Stage-calculated probability just like it would to a fixed probability.

## Increasing Loot Quality

* The Lucky Looter perk increases the player's loot bonus by a percentage. It also decreases the time needed to search a previously-unopened container.
* The Lucky Goggles increase the player's loot bonus. They also decrease the buried treasure radius when doing treasure hunting quests started from a treasure map.
* The Eye Kandy increases the player's loot bonus by a percentage and a flat amount for five minutes.
* Exploring a different Biome may raise your loot stage by a percentage and by a flat amount, as shown in biomes.xml.