Server Config XML Format

cfgspawnabletypes.xml

Manages item spawn configurations and attachment spawning. Defines what attachments can spawn on weapons and how items are configured when they appear.

Overview

The cfgspawnabletypes.xml file controls what attachments and cargo items spawn with an item when it appears in the world. This is how weapons spawn with magazines, optics, or suppressors already attached, and how backpacks spawn with items inside them.

It works together with cfgrandompresets.xml which defines reusable item pools referenced by preset name.

XML Structure

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<spawnabletypes>
    <type name="AKM">
        <attachments chance="0.30">
            <item name="AK_WoodBttstck" chance="0.50" />
            <item name="AK_PlasticBttstck" chance="0.50" />
        </attachments>
        <attachments preset="opticAR" />
        <cargo preset="ammoAK" />
    </type>
</spawnabletypes>

Each <type> matches an item name from types.xml. Within each type you can define inline items or reference presets from cfgrandompresets.xml.

Attachment Spawning

Attachments spawn already connected to the parent item. Each <attachments> block represents one attachment slot. The CE picks one item from the list based on chance weights.

<type name="M4A1">
    <!-- Optic slot: 40% chance any optic spawns -->
    <attachments chance="0.40">
        <item name="ACOGOptic" chance="0.20" />
        <item name="M68Optic" chance="0.40" />
        <item name="ReflexOptic" chance="0.40" />
    </attachments>

    <!-- Buttstock slot: always spawns with a stock -->
    <attachments chance="1.00">
        <item name="M4_OEBttstck" chance="0.50" />
        <item name="M4_CQBBttstck" chance="0.30" />
        <item name="M4_MPBttstck" chance="0.20" />
    </attachments>

    <!-- Handguard slot -->
    <attachments chance="1.00">
        <item name="M4_PlasticHndgrd" chance="0.50" />
        <item name="M4_RISHndgrd" chance="0.50" />
    </attachments>

    <!-- Suppressor: 5% chance -->
    <attachments chance="0.05">
        <item name="M4Suppressor" chance="1.00" />
    </attachments>
</type>

Cargo Configuration

Cargo items spawn inside the parent item's inventory. This is commonly used for backpacks, clothing, and containers:

<type name="TaloonBag_Green">
    <!-- Inline cargo items -->
    <cargo chance="0.50">
        <item name="BandageDressing" chance="0.30" />
        <item name="Rag" chance="0.40" />
        <item name="Apple" chance="0.30" />
    </cargo>

    <!-- Or reference a preset -->
    <cargo preset="foodVillage" />
</type>

Note: Cargo items must fit within the parent item's inventory size. If the selected item is too large, it will be skipped.

Hoarder Settings

The hoarder element controls whether the CE counts items stored in player bases and containers toward the global nominal limit:

<type name="AKM">
    <hoarder>
        <!-- Items in stashes/bases count toward nominal -->
        <item name="AKM" count_in_hoarder="1" />
    </hoarder>
</type>

This is typically controlled via the count_in_hoarder flag in types.xml rather than here. The cfgspawnabletypes.xml hoarder section is less commonly used.

Weapon Attachment Examples

<!-- AK-74 with full attachment configuration -->
<type name="AK74">
    <attachments chance="1.00">
        <item name="AK_WoodBttstck" chance="0.40" />
        <item name="AK_PlasticBttstck" chance="0.35" />
        <item name="AK_FoldingBttstck" chance="0.25" />
    </attachments>
    <attachments chance="1.00">
        <item name="AK_WoodHndgrd" chance="0.50" />
        <item name="AK_PlasticHndgrd" chance="0.30" />
        <item name="AK_RailHndgrd" chance="0.20" />
    </attachments>
    <attachments chance="0.25">
        <item name="PSO1Optic" chance="0.30" />
        <item name="KobraOptic" chance="0.70" />
    </attachments>
    <attachments chance="0.60">
        <item name="Mag_AK74_30Rnd" chance="1.00" />
    </attachments>
</type>

<!-- Mosin with simple setup -->
<type name="Mosin9130">
    <attachments chance="0.15">
        <item name="PUScopeOptic" chance="1.00" />
    </attachments>
</type>

Backpack Cargo Examples

<!-- Military backpack with ammo and medical supplies -->
<type name="AssaultBag_Green">
    <cargo chance="0.40">
        <item name="Ammo_556x45" chance="0.25" />
        <item name="Ammo_762x39" chance="0.25" />
        <item name="Mag_STANAG_30Rnd" chance="0.20" />
        <item name="BandageDressing" chance="0.15" />
        <item name="Morphine" chance="0.15" />
    </cargo>
</type>

<!-- Civilian backpack with food and tools -->
<type name="TaloonBag_Blue">
    <cargo preset="foodVillage" />
    <cargo chance="0.30">
        <item name="Flashlight" chance="0.40" />
        <item name="Battery9V" chance="0.30" />
        <item name="Compass" chance="0.30" />
    </cargo>
</type>