-
Notifications
You must be signed in to change notification settings - Fork 91
Adding loadouts to PawnKinds
If you're adding a new pawn kind that can spawn as an NPC/raider/etc. you might want to add additional CE inventory data. This is necessary to make sure your pawns spawn with sufficient ammo as well as any sidearms/shields they might have.
<Operation Class="PatchOperationAddModExtension">
<xpath>/PawnKindDefs/PawnKindDef[defName="MercenaryHeavy"]</xpath>
<value>
<li Class="CombatExtended.LoadoutPropertiesExtension">
<primaryMagazineCount>
<min>1</min>
<max>4</max>
</primaryMagazineCount>
<forcedSidearm>
<sidearmMoney>
<min>150</min>
<max>350</max>
</sidearmMoney>
<weaponTags>
<li>CE_SMG</li>
</weaponTags>
<magazineCount>
<min>0</min>
<max>1</max>
</magazineCount>
</forcedSidearm>
<shieldMoney>
<min>500</min>
<max>1400</max>
</shieldMoney>
<shieldTags>
<li>OutlanderShield</li>
</shieldTags>
<shieldChance>0.9</shieldChance>
<sidearms>
<li>
<generateChance>0.5</generateChance>
<sidearmMoney>
<min>60</min>
<max>150</max>
</sidearmMoney>
<weaponTags>
<li>CE_Sidearm_Melee</li>
</weaponTags>
</li>
</sidearms>
</li>
</value>
</Operation>
CE injects the data for loadout generation via the DefModExtension LoadoutPropertiesExtension. All parameters here are optional but not specifying a primaryMagazineCount might leave your pawn without ammo.
primaryMagazineCount: How many magazines to create for the primary weapon. CE weapons spawn initially unloaded and will then select a random ammo type compatible with the primary, load it and generate this amount of spare magazines.
Note that for one-time use weapons like grenades and rocket launchers this will instead create additional copies of the weapon.
forcedSidearm: this sidearm will always be generated before anything else. Generation works the same as vanilla primary weapon generation regarding money and weapon tags.
Intended use is for pawns which generate with heavy weapons like rocket launchers and should generate a backup weapon before filling their inventory to capacity with primary weapon ammo.
shieldMoney: the money-range that can be spent on shields. Works same as vanilla weapon/apparel money.
shieldTags: shields need to have at least one of these apparel tags to be allowed to spawn on this pawn. By default CE uses TribalShield for its buckler style melee shield and OutlanderShield for the modern ballistic shield. If your mod is adding custom shield types you may add your own tags here.
shieldChance: the chance the pawn will be allowed to generate a shield. Note that before being allowed to generate a shield a pawn must first satisfy every other requirement such as having a one-handed primary weapon.
sidearms: this is a list of sidearm options a pawn can generate in addition to his primary/forced sidearm.
Items are generated as such:
- All vanilla primary weapon/apparel/fixed inventory
- Forced sidearm with ammo (if specified)
- Primary weapon ammo
- Shield (if applicable)
- Sidearms with ammo
Note that loadout generation will not exceed inventory mass/bulk limits. If your pawn is set to spawn with a ballistic shield but generated with a bad back and frail then CE won't overload his inventory.