Configure item attachments and cargo that spawn with weapons and containers. Define what items appear inside or attached to other items when they spawn.
The cfgspawnabletypes.xml file defines what items spawn attached to or inside other items. It controls weapon attachments like scopes and magazines, container cargo like items inside backpacks, and spawn probabilities for each attachment or cargo item.
Each <type> element defines a parent item with its possible attachments and cargo items.
<spawnabletypes>
<type name="M4A1">
<attachments chance="0.30">
<item name="M4_RISHndgrd" chance="0.50" />
<item name="M4_RISHndgrd_Black" chance="0.30" />
<item name="M4_RISHndgrd_Green" chance="0.20" />
</attachments>
<attachments chance="0.25">
<item name="ACOGOptic" chance="0.40" />
<item name="M68Optic" chance="0.35" />
<item name="ReflexOptic" chance="0.25" />
</attachments>
<cargo chance="0.20">
<item name="Mag_STANAG_30Rnd" chance="0.70" />
<item name="Mag_STANAG_60Rnd" chance="0.30" />
</cargo>
</type>
</spawnabletypes>
The classname of the parent item that will receive attachments or cargo. Must exactly match a classname defined in types.xml.
The probability (0.0 to 1.0) that this attachment slot will have an item. If triggered, one item from the list is selected based on relative chances.
The classname of the attachment item. Must be compatible with the parent item's attachment slots.
The relative weight for selecting this specific item from the attachment group. Higher values mean more likely selection.
Cargo defines items that spawn inside the parent item's inventory. This is useful for containers like backpacks, vests, and cases.
The probability (0.0 to 1.0) that this cargo slot will contain an item when the parent spawns.
The classname of the cargo item. Must fit in the parent item's inventory space.
The relative weight for selecting this item from the cargo group when the slot is filled.
When an item spawns, the server checks cfgspawnabletypes.xml for matching type entries. Each attachment and cargo group is processed independently.
First, the server rolls against the attachment/cargo group's chance. If it fails, that slot remains empty.
If the slot roll succeeds, one item is selected from the group based on relative chance weights.
Multiple attachment groups represent different slots (optic, handguard, stock). Each is processed independently.
Items must be compatible with the parent. Incompatible attachments will fail silently and not spawn.
Balanced attachments for the AKM assault rifle
<type name="AKM">
<!-- Optics slot - 25% chance -->
<attachments chance="0.25">
<item name="PSO1Optic" chance="0.40" />
<item name="PSO11Optic" chance="0.30" />
<item name="KobraOptic" chance="0.30" />
</attachments>
<!-- Buttstock slot - 20% chance -->
<attachments chance="0.20">
<item name="AK_WoodBttstck" chance="0.50" />
<item name="AK_PlasticBttstck" chance="0.30" />
<item name="AK_FoldingBttstck" chance="0.20" />
</attachments>
<!-- Magazine cargo - 15% chance -->
<cargo chance="0.15">
<item name="Mag_AKM_30Rnd" chance="0.70" />
<item name="Mag_AKM_Drum75Rnd" chance="0.30" />
</cargo>
</type>
Separate attachment groups represent different slots on the weapon. The first group might be optics, the second handguards, etc. Each group rolls independently, so a weapon could spawn with an optic but no handguard, or vice versa. Keep slot chances relatively low (0.15-0.35) to maintain the value of finding attachments separately.