Wiki Navigation

Configuration File
XML Format

cfgspawnabletypes.xml Configuration

Configure item attachments and cargo that spawn with weapons and containers. Define what items appear inside or attached to other items when they spawn.

Overview

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.

File Structure

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>

Type Parameters

name string

The classname of the parent item that will receive attachments or cargo. Must exactly match a classname defined in types.xml.

Attachments Parameters

chance float

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.

item name string

The classname of the attachment item. Must be compatible with the parent item's attachment slots.

item chance float

The relative weight for selecting this specific item from the attachment group. Higher values mean more likely selection.

Cargo Parameters

Cargo defines items that spawn inside the parent item's inventory. This is useful for containers like backpacks, vests, and cases.

chance float

The probability (0.0 to 1.0) that this cargo slot will contain an item when the parent spawns.

item name string

The classname of the cargo item. Must fit in the parent item's inventory space.

item chance float

The relative weight for selecting this item from the cargo group when the slot is filled.

How It Works

When an item spawns, the server checks cfgspawnabletypes.xml for matching type entries. Each attachment and cargo group is processed independently.

Slot Chance Roll

First, the server rolls against the attachment/cargo group's chance. If it fails, that slot remains empty.

Item Selection

If the slot roll succeeds, one item is selected from the group based on relative chance weights.

Multiple Slots

Multiple attachment groups represent different slots (optic, handguard, stock). Each is processed independently.

Compatibility

Items must be compatible with the parent. Incompatible attachments will fail silently and not spawn.

Best Practices

Recommended

  • Only include compatible attachments for each weapon type
  • Balance attachment chances to maintain item rarity
  • Group attachments by slot type (optics, handguards, stocks)
  • Test configurations to verify attachments spawn correctly

Avoid

  • Incompatible attachments that won't fit the parent item
  • Very high attachment chances that make bare weapons rare
  • Cargo items too large for the parent's inventory
  • Typos in classnames which cause silent failures

Example Configuration

AKM Rifle Configuration

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>

Pro Tips

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.