-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Understanding Borderlands Weight and Probability Values
Before diving into this, it's recommended to have a general understanding of how Borderlands 2/TPS handles weighted probabilities -- a good primer on that can be found on Gearbox's blog in a post named The Borderlands 2 Loot System by Paul Hellquist.
Loot pools in Borderlands are generally defined using a BalancedItems
array which looks like this, taken from Borderlands 2's GD_Itempools.LootablePools.Pool_Locker_Items_SMGsAndPistols
:
BalancedItems(0)=(
ItmPoolDefinition=ItemPoolDefinition'GD_Itempools.WeaponPools.Pool_Weapons_Pistols',
InvBalanceDefinition=None,
Probability=(
BaseValueConstant=0.000000,
BaseValueAttribute=None,
InitializationDefinition=AttributeInitializationDefinition'GD_Balance.Weighting.Weight_2_Uncommon',
BaseValueScaleConstant=1.000000
),
bDropOnDeath=False
)
BalancedItems(1)=(
ItmPoolDefinition=ItemPoolDefinition'GD_Itempools.WeaponPools.Pool_Weapons_SMG',
InvBalanceDefinition=None,
Probability=(
BaseValueConstant=0.000000,
BaseValueAttribute=None,
InitializationDefinition=AttributeInitializationDefinition'GD_Balance.Weighting.Weight_3_Uncommoner',
BaseValueScaleConstant=1.000000
),
bDropOnDeath=True
)
The Probability
section will become very familiar over time, and consists of four elements: BaseValueConstant
, BaseValueAttribute
, InitializationDefinition
, and BaseValueScaleConstant
. We'll refer to them as BVC, BVA, ID, and BVSC.
When writing custom loot pools or playing with these kinds of stanzas in mods, the simplest thing to do is to set the middle two (BVA and ID) to None
and only use BVC and BVSC. In that case, the formula for finding out the numerical value of one of those stanzas is just BVC * BVSC
. So either of the following stanzas would evaluate to 50
:
Probability=(
BaseValueConstant=50.000000,
BaseValueAttribute=None,
InitializationDefinition=None,
BaseValueScaleConstant=1.000000
)
or
Probability=(
BaseValueConstant=1.000000,
BaseValueAttribute=None,
InitializationDefinition=None,
BaseValueScaleConstant=50.000000
)
In practice, you'll generally set BVC to the number you want, and leave the BVSC at 1
.
The next most common thing you'll find in loot pools is the use of the various GD_Balance.Weighting.Weight_*
values, set in the ID of the stanza. In our example at the top, Pistols are using Uncommon, and SMGs are using the amusingly-named "Uncommoner." You can take a look at these weights using obj dump
from the console, or from FilterTool/BLCMM's Object Explorer, but the important bits of those objects are these, taken for example from Weight_1_Common
:
BaseValueMode=BASEVALUE_InitializationDefSetsBaseValue
ValueFormula=(
bEnabled=True,
Multiplier=(
BaseValueConstant=100.000000,
BaseValueAttribute=None,
InitializationDefinition=None,
BaseValueScaleConstant=1.000000
),
The BaseValueMode=BASEVALUE_InitializationDefSetsBaseValue
definition means that the weight will completely override whatever BVC is set in the main probability/weight stanza. The Multiplier
section uses the same kind of number stanza as we mentioned above, and in this case 100 * 1 = 100
, so the value put into the main weight would be 100
. So, for instance, the following stanza:
(
BaseValueConstant=0.000000,
BaseValueAttribute=None,
InitializationDefinition=AttributeInitializationDefinition'GD_Balance.Weighting.Weight_1_Common',
BaseValueScaleConstant=1.000000
)
... will evaluate to exactly the same as this stanza:
(
BaseValueConstant=42000.12345,
BaseValueAttribute=None,
InitializationDefinition=AttributeInitializationDefinition'GD_Balance.Weighting.Weight_1_Common',
BaseValueScaleConstant=1.000000
)
... and is functionally identical to this stanza:
(
BaseValueConstant=100.000000,
BaseValueAttribute=None,
InitializationDefinition=None,
BaseValueScaleConstant=1.000000
)
In each case, that number will evaluate to 100
.
All of the GD_Balance.Weighting.Weight_*
values do this substitution on BVC. It's possible that there are other types of objects which can be referenced besides those, and perhaps some of them have a different BaseValueMode
than BASEVALUE_InitializationDefSetsBaseValue
, but those are uncommon, if they do exist.
The values on each of the common weight variables are as follows:
Object | Weight |
---|---|
GD_Balance.Weighting.Weight_0_VeryCommon |
200 |
GD_Balance.Weighting.Weight_1_Common |
100 |
GD_Balance.Weighting.Weight_2_Uncommon |
10 |
GD_Balance.Weighting.Weight_3_Uncommoner |
5 |
GD_Balance.Weighting.Weight_4_Rare |
1 |
GD_Balance.Weighting.Weight_5_VeryRare |
0.1 |
GD_Balance.Weighting.Weight_6_Legendary |
0.01 |
GD_Balance.Weighting.Weight_1_Common_RareMod |
(varies depending on Vault Hunter Relic) |
So, back to our first example, Pistols have a weight of 10, and SMGs have a weight of 5, so pistols will spawn from that pool 66% of the time, and SMGs the remaining 33%.
The other thing you may see is stanzas which use BVA to apply some trickier logic to the weights/probabilities. For instance, Knuckledragger has a loot pool which is defined like so:
(
ItemPool=ItemPoolDefinition'GD_Itempools.Runnables.Pool_Knuckledragger',
PoolProbability=(
BaseValueConstant=0.000000,
BaseValueAttribute=AttributeDefinition'GD_Itempools.DropWeights.DropODDS_BossUniques',
InitializationDefinition=None,
BaseValueScaleConstant=1.000000
)
)
Like the weighting values which use ID, BVA objects tend to completely override the BVC, so if you're using a BVA, the BVC in the stanza gets completely ignored. For GD_Itempools.DropWeights.DropODDS_BossUniques
, it's a pretty simple object -- it just always resolves to the value 0.100000
. So in this case, KnuckleDragger has a 10% chance of dropping loot from GD_Itempools.Runnables.Pool_Knuckledragger
(which happens to be the Hornet).
Other BVAs can get more complicated.