Closed Iridar closed 4 years ago
Complementary Specializations
With default configuration of Random Classes, each soldier receives at least 3 specializations: one Primary, one Secondary and one Complementary. The above explains the interactions of the Primary and Secondary specs, and if you thought this was complicated, get ready for a ride.
Complementary specs are additional specs that provide more perks to choose from, but do not open access to any additional weapon categories.
For example, if the soldier has Assault as their primary spec and a Sniper as their complementary, they will be able to use a shotgun in the primary weapon slot, and get the Steady Hands perk from the Sniper spec to boost Aim and Crit while stationary.
And if the Soldier has Sniper as their primary spec and Assault as complementary, they will be able to use a sniper rifle in the primary weapon slot, and get Rapid Fire perk to fire two shots back to back.
Great for variety. However, in order to ensure the maximum number of potential combinations, the system that determines which specs can become complementary to what specs has to be fairly complicated.
When picking complementary specs, the mod looks at the soldier's Primary and Secondary specs it has picked just a few moments earlier.
A spec can become complementary if:
1) If the primary or the secondary spec shares at least one weapon category and the slot with the spec. For example, Hacker and Medic an become complementary to each other, since they both allow using a Gremlin in the secondary weapon slot:
[Hacker X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(gremlin), InventorySlots=(eInvSlot_SecondaryWeapon))
[Medic X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(gremlin), InventorySlots=(eInvSlot_SecondaryWeapon))
2) If this spec is Dual Wield, it can become a complementary spec to another Dual Wield spec, if it was assigned to the soldier as their primary spec, and they share at least one weapon category. For example, both Akimbo specs can become complementary to each other, because they both are marked as Dual Wield and they share the 'pistol' category:
[DP_GunFu X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(pistol), InventorySlots=(eInvSlot_PrimaryWeapon), bDualWield=true, bCantBeComplementary=true)
[DP_Scrapper X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(pistol), InventorySlots=(eInvSlot_PrimaryWeapon), bDualWield=true, bCantBeComplementary=true)
Note that this happens even though both specs are marked as bCantBeComplementary
. This is necessary so that they can't become complementary to non-Dual Wield specs. This is the only exception where bCantBeComplementary
is disrespected. If you need to absolutely block a spec from ever becoming complementary, you can do it by setting iWeightComplementary = 0
.
3) If at least one additional marker matches. For now the markers include:
bUniversal
- if this is true, this spec can become complementary to any other combination of specs, because its perks don't depend on any equipment, or they depend on the equipment carried in utility slots.
[Scout X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(vektor_rifle), InventorySlots=(eInvSlot_PrimaryWeapon), bShoot=true, bUniversal=true)
bShoot
- any spec that has this set to true can become complementary to any other spec that has this set to true. The general idea is to mark the spec as "having to do with shooting a weapon" without having to mention specific compatible weapon categories by name.
bMelee
- similar to bShoot. Marks the specs as requiring a generic "melee weapon" so they can become complementary to each other.
There are more markers: bGremlin
and bPsionic
, but they are somewhat redundant, since the only Gremlin-like weapon category is the gremlin, and psiamp
is the only Psi Amp-like weapon, so just using the allowed weapon categories to determine whether a spec can become complementary or not should be enough.
Specialization Weights
Each specialization can have these three weights configured:
iWeightPrimary
iWeightSecondary
iWeightComplementary
These weights determine how often the spec will be randomly picked as primary, secondary and complementary.
1
by default. 0
, then this spec will never be picked in that role.Forced Complementary Specializations
Each specialization can have an array of ForceComplementarySpecializations
configured. When a specialization is assigned to a soldier, all of the specs that are configured as forced complementary specs will also be granted to the soldier.
For example, this is used for the Biotic specializations. If the soldier is assigned one of the Biotic specs, they will automatically receive the two other Biotic specs. Note that these specs are configured only for the secondary slot, so the soldier will never receive them as primary.
[Tactician X2UniversalSoldierClassInfo]
+ForceComplementarySpecializations=Adept
+ForceComplementarySpecializations=Vanguard
SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(bioamp), InventorySlots=(eInvSlot_SecondaryWeapon), iWeightSecondary=1)
[Adept X2UniversalSoldierClassInfo]
+ForceComplementarySpecializations=Tactician
+ForceComplementarySpecializations=Vanguard
SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(bioamp), InventorySlots=(eInvSlot_SecondaryWeapon), iWeightSecondary=1)
[Vanguard X2UniversalSoldierClassInfo]
+ForceComplementarySpecializations=Adept
+ForceComplementarySpecializations=Tactician
SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(bioamp), InventorySlots=(eInvSlot_SecondaryWeapon), iWeightSecondary=1)
Forced complementary specs do not interact with Weapon Restrictions, meaning they are treated the same as true complementary specializations.
Forced complementary specs count against the total number of specs a soldier can have.
For example, with default config a soldier can have up to three specs in total.
So if the soldier receive a primary spec, a biotic secondary spec, which will also auto-grant two additional forced complementary specs, the soldier will have four specs in total.
Since 4 > 3, the soldier will then not receive any additional random complementary specializations.
Mutually Exclusive Specializations
Each spec can have an array of specializations it is not compatible with.
[Gunner X2UniversalSoldierClassInfo]
SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(cannon), InventorySlots=(eInvSlot_PrimaryWeapon), MutuallyExclusiveSpecs[0]="Infantry")
[Infantry X2UniversalSoldierClassInfo]
SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(rifle), InventorySlots=(eInvSlot_PrimaryWeapon), MutuallyExclusiveSpecs[0]="Gunner")
When the mod considers adding a Secondary or a Complementary spec, it will first check if the soldier has any of the specs that this spec has marked as mutually exclusive.
For example, Infantry's Light 'Em Up perk is restricted from functioning with Cannons, so there's potentially some merit in marking Gunner and Infantry as mutually exclusive, so that primary Gunners cannot get Infantry complementary and vice versa.
Thanks for the extensive documentation!
I moved the documentation to wiki pages
https://github.com/Musashi1584/RPGO/wiki
please make further changes there. It has a better changelog it will be found better.
Will do. Wiki page was my first instinct, but I lacked the rights to create a page.
Probably not the best place for this, but I needed a place to write and this will do for now.
Random Classes with Weapon Restrictions Mechanics
When the RPGO soldier is first promoted to squaddie, they will receive several random specializations (specs). During the randomization process the mod will look at the additional optional meta information about specs, which describes what this spec is about. For example, Hacker is a specialization that allows using Gremlins in Secondary Weapon Slot.
The first to roll is the Primary spec. A spec can be rolled as a Primary if it allows at least one weapon category and is marked as using the Primary Weapon slot:
[Assault X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(shotgun), InventorySlots=(eInvSlot_PrimaryWeapon))
Then the mod rolls a random secondary spec. Similarly, a spec can be rolled as Secondary if it allows at least one weapon category and is marked as using the Secondary Weapon slot:
[Hacker X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(gremlin), InventorySlots=(eInvSlot_SecondaryWeapon))
Some specializations can become both primary or secondary, for example:
[Ranger X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(sword, combatknife), InventorySlots=(eInvSlot_PrimaryWeapon, eInvSlot_SecondaryWeapon))
It's important to realize that normally a spec allows using its configured Weapon Categories only in the slot the spec was assigned to. For example, if this Ranger spec is assigned as the primary spec, it will allow using swords and combat knives only in the primary weapon slot. While another soldier that receives Ranger as a secondary spec will be able to use these weapons only in the secondary weapon slot.
A notable exception from this rule are Dual Wield specs - they will allow using their weapon categories in any slot. This is necessary to handle specializations that cannot function without dual wielding, such as Akimbo.
[DP_GunFu X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(pistol), InventorySlots=(eInvSlot_PrimaryWeapon), bDualWield=true)
Any soldier with this Akimbo spec will be allowed to use pistols in both primary and secondary weapon slots. Note how the spec doesn't even need to mention the secondary weapon slot.
If a soldier has a Dual Wield primary spec, they do not get Secondary specs. It will be as if the soldier's primary spec is also the secondary spec.
Dual Wield specs themselves, however, can become secondary specs to primary specs that share at least one weapon category with them.
[Gunslinger X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(pistol, sidearm), InventorySlots=(eInvSlot_PrimaryWeapon, eInvSlot_SecondaryWeapon))
If the soldier has Gunslinger as their primary specialization, they will be able to get the Akimbo spec as a secondary spec.
We also use this interaction to allow certain specs to only ever be picked as a secondary to another specific specs.
[MZChemthrowerOffense X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(chemthrower), InventorySlots=(eInvSlot_PrimaryWeapon))
[MZChemthrowerCanister X2UniversalSoldierClassInfo] SpecializationMetaInfo = (bUseForRandomClasses=true, AllowedWeaponCategories=(chemthrower, canister), InventorySlots=(eInvSlot_PrimaryWeapon), iWeightPrimary=0, iWeightComplementary=0, iWeightSecondary=8, bDualWield=true)
For example, these specs are from Mitzruti's Immolator + Chemthrower Abilities mod. The Chemthrower spec is a generic primary spec that allows using chemthrowers in the primary weapon slot. It will work fine alongside any secondary spec.
The Canister spec allows using special fuel canisters in the secondary weapon slot that provide additional features for the chemthrower. This spec requires the primary chemthrower spec in order to function. So we configure it as a Dual Wield spec, and set its Primary and Complementary Weights to zero, ensuring the spec will never be randomly picked as a primary or a complementary spec. The fact that it is marked as a Dual Wield spec allows the mod to select it as a secondary spec for the Chemthrower primary spec, because they share the "chemthrower" weapon category. And the weights ensure it will never be picked for anything else.
The only side effect of this interaction is that it will technically allow using both 'canister' and 'chemthrower' weapon categories in both primary and secondary weapon slots, though in this case it's not a problem, since there are no primary canisters and no secondary chemthrowers.