2

« **on:** June 18, 2024, 02:24:51 am »
It would be nice if we could designate a set of loadouts/weapon sets that are randomly selected for a unit at each tech level, along with weighting values to make them more or less likely to be picked relative to other options at that tech level.

This would prevent us from having to messily kludge it by creating alternate versions/duplicates of the same unit simply for loadout variation.

Essentially adding the following parameters to builtInWeaponSets:

**techLevel: **Defaults to 1. The level of tech that this loadout is eligible for random selection in. If there are no loadouts eligible for a given tech level, it will default to selecting from eligible options for the tech level immediately prior (so if there are no techLevel 3 loadouts, it will default to techLevel 2 loadouts, and so on).

**Weight:** Defaults to 1. The relative chance of this loadout being picked if eligible for selection; final probability of a loadout being selected is equal to its weight divided by the total weight of all eligible loadouts. For example an eligible loadout with a weight of 50 while two other eligible loadouts have a weight of 30 and 10 would have a 62.5% chance of being selected: 50 / (50 + 30 + 10) = 0.625

**maxPicks:** Defaults to 0 (no limit). The maximum number of times this loadout can be picked. If a loadout hits its maximum, it can no longer be picked, and its weight is discounted for the purposes of determining pick probability.

**minPicks:** Defaults to 0 (no minimum). The minimum number of times this loadout can be picked. If the number of loadouts for a unit of this type remaining to be picked is equal to or less than the total amount of minPick loadouts for the appropriate tech level, it will automatically pick these options; they are prioritized according to weight. So if there are say 7 loadouts for a unit to be picked for a given tech level, and the total value of minPick loadouts is 5 (one loadout has a 3 minPick value, and another has a 2 minPick value), 5 of those loadouts will automatically be determined: 3 going to one minPick loadout, 2 going to the other minPick; the rest will be randomly determined by weights as normal. If there are only 4 loadouts to be picked and 5 minPick loadouts, they are randomly allocated from among the minpick options according to weight as normal; minPick loadout options that hit their quota from this pool are excluded from subsequent random allocations; in this example, if the loadout with a 2 minPick value is randomly selected twice, 'satisfying' it, the rest automatically go to the 3 minPick value loadout.

If there is only one loadout eligible for a tech level, it will be picked automatically regardless of the Weight value.

For example,

` builtInWeaponSets:`

techLevel: 1

Weight: 30

- STR_PISTOLS

- STR_CHAOS_CLAWS

- STR_PISTOL_CLIP_AP

- STR_PISTOL_CLIP_AP

- STR_ALIEN_GRENADE

techLevel: 1

Weight: 70

- STR_PISTOLH

- STR_CHAOS_CLAWS

- STR_RIFLE_CLIP_AP

- STR_RIFLE_CLIP_AP

- STR_ALIEN_GRENADE

- STR_KRAK_GRENADE

techLevel: 1

Weight: 30

- STR_PISTOLS

- STR_CHAOS_CLAWS

- STR_PISTOL_CLIP_AP

- STR_PISTOL_CLIP_AP

- STR_ALIEN_GRENADE

techLevel: 2

Weight: 25

minPicks: 2

- STR_PLASMA_PISTOL

- STR_CHAOS_CLAWS

- STR_PLASMA_PISTOL_CLIP

- STR_PLASMA_PISTOL_CLIP

- STR_MGRENADE

techLevel: 2

Weight: 50

- STR_PLASMA_RIFLE

- STR_PLASMA_RIFLE_CLIP

- STR_PLASMA_RIFLE_CLIP

- STR_MGRENADE

techLevel: 2

Weight: 10

maxPicks: 1

- STR_MGRENADE

- STR_MGRENADE

- STR_MGRENADE

- STR_MGRENADE

- STR_MGRENADE