DayZ Updated April 27, 2026

Spawning Gear with Attachments via cfgspawnabletypes.xml

Use cfgspawnabletypes.xml to define what attachments and cargo items spawn pre-attached to weapons and gear found in the world.

DayZattachmentscfgspawnabletypeslootmission

Overview

cfgspawnabletypes.xml controls what attachments and cargo items are pre-attached to weapons and gear when they spawn in the world. Without entries here, an M4A1 spawns bare with no magazine, no stock, no optic. With proper configuration, it can spawn partially or fully kitted. This file only affects world-spawned items — player-crafted gear is not affected.

File Location

The file is inside your mission PBO:

missionFiles/dayzOffline.chernarusplus/cfgspawnabletypes.xml

Extract with pboProject, edit, repack, and restart the server to apply changes.

File Structure

<spawnabletypes>
    <type name="M4A1">
        <attachments chance="0.50">
            <item name="M4_RISHndgrd_Black" chance="0.70"/>
            <item name="M4_OEBttstck" chance="0.50"/>
        </attachments>
        <attachments chance="0.40">
            <item name="ACOGOptic" chance="0.30"/>
            <item name="ReflexOptic" chance="0.50"/>
        </attachments>
        <cargo chance="0.60">
            <item name="Mag_STANAG_30Rnd" chance="0.80"/>
        </cargo>
    </type>
</spawnabletypes>

Key Concepts

<attachments> group chance: The outer chance on <attachments> is the probability that this attachment slot group is even attempted. Set to 1.00 to guarantee the group is tried.

<item> chance: The chance that a specific item from the group is selected. If multiple items are listed in one <attachments> block, only one is selected (the first that passes its chance roll). Items are tried top to bottom.

<cargo>: Items that spawn inside the weapon or item's inventory rather than attached to it. Useful for spawning magazines inside pouches or food inside bags.

Example: M4A1 with Guaranteed Magazine

<type name="M4A1">
    <attachments chance="1.00">
        <item name="Mag_STANAG_30Rnd" chance="1.00"/>
    </attachments>
</type>

This spawns every M4A1 with a 30-round STANAG magazine already attached.

Example: Random Optic with 40% Chance

<type name="M4A1">
    <attachments chance="0.40">
        <item name="ACOGOptic" chance="0.50"/>
        <item name="ReflexOptic" chance="0.50"/>
        <item name="PUScopeOptic" chance="0.25"/>
    </attachments>
</type>

40% of M4A1 spawns attempt an optic. Of those, the engine tries ACOG first (50% chance), then Reflex (50%), then PU Scope (25%). The first item that passes its roll wins.

Example: Backpack with Cargo

<type name="AliceBag_Black">
    <cargo chance="0.70">
        <item name="CanOpener" chance="0.60"/>
        <item name="Rag" chance="0.80"/>
        <item name="BandageDressing" chance="0.50"/>
    </cargo>
</type>

This gives backpacks a 70% chance of containing some basic survival items.

Finding Item Class Names

Item class names are case-sensitive and must match exactly. Sources:

  • Community-maintained DayZ class name lists on the DayZ Wiki
  • Extract the vanilla dayz_code.pbo and search config.cpp for class definitions
  • The types.xml name attributes list all valid lootable item names

Applying Changes

  1. Stop the server
  2. Extract mission PBO
  3. Edit cfgspawnabletypes.xml
  4. Repack with pboProject
  5. Replace PBO in missionFiles/
  6. Start the server

Troubleshooting

  • Attachments not appearing: Confirm the item class name is spelled correctly and matches the class name in types.xml. A typo causes the entry to be silently ignored.
  • Items spawning with no attachments despite config: Check that types.xml has a non-zero nominal for the attachment item itself. If the attachment has nominal=0 it cannot spawn.
  • All items of a type are bare: Verify your PBO repack succeeded and the file is in the correct mission path.