Step-by-step guide · 7 steps

How to make guns spawn with attachments in DayZ

Whether a rifle spawns bare or with a scope and stock is set in cfgspawnabletypes.xml, not types.xml. The same file decides how worn items are and what's inside backpacks and containers. A few lines turn a disappointing find into a proper reward.

  • 3 min read
  • Updated
  • PlayStation, Xbox and PC
cfgspawnabletypes.xmlExample
<type name="M4A1">    <damage min="0.0" max="0.3"/>    <attachments chance="0.6">        <item name="M4_OEBttstck" chance="1.0"/>    </attachments>    <attachments chance="0.3">        <item name="ACOGOptic" chance="0.5"/>        <item name="M68Optic" chance="0.5"/>    </attachments></type>
Step 1

Find cfgspawnabletypes.xml

It's in your mission folder, next to the db folder. Download a copy first. Where DayZ server files live has the path for every map.

Step 2

Add an attachments group

Inside the weapon's entry, an attachments group has a chance for the group and a chance for each item in it. A group chance of 0.5 means half of those rifles get something from that group.

Use one group per slot: one for optics, one for the stock, one for the magazine. Otherwise a rifle might get two scopes and no stock.

Step 3

Set the damage range

The damage line sets how worn the item spawns: 0 is pristine and 1 is ruined. A range of 0.0 to 0.3 means mostly good condition.

Step 4

Upload and restart

Check the file with the XML validator, upload it and restart. Newly spawned items use the new rules; ones already on the map don't change.

Step 5

Use cargo for backpacks and containers

The same file fills things that hold other things. A cargo group works like an attachments group, but the items go inside rather than onto a slot. It's how you make a field backpack occasionally turn up with a few cans and a bandage, or a crate in a military tent hold ammo.

Keep cargo modest. A backpack that always arrives full makes everything else on the map feel pointless, and lots of extra items add to the server's load.

Step 6

Balance rare optics and magazines

Attachments are an easy way to make loot feel better without raising nominal in types.xml. A few rules of thumb most owners settle on:

  • Common rifles: stock and handguard most of the time, optics rarely
  • Military rifles: a decent chance of a basic sight, a small chance of a long-range scope
  • Magazines: a moderate chance, so a found rifle is usable without being a free kit
  • Suppressors and long-range scopes: keep them rare, they change fights more than anything else
Step 7

Why a weapon still spawns bare

If nothing changes after a restart, it's nearly always one of these:

  • The type name doesn't match the classname in types.xml exactly, including capital letters
  • The attachment doesn't fit that weapon, so DayZ quietly skips it
  • The group chance is low, so most of the weapons you've checked simply rolled nothing
  • You're looking at weapons that spawned before the change. Only new spawns use the new rules
  • The file has a typo and the server ignored it. Run it through the validator to find the line

Tools for this

Common questions

Do attachment chances add up to 100%?

Within a group, DayZ picks one item using the chances as weights. The group's own chance decides whether the weapon gets anything from it at all.

Can I use presets instead of listing items?

Yes. A group can point at a preset from cfgrandompresets.xml. Just don't mix a preset and listed items in the same group.

Does this work on console servers?

Yes. cfgspawnabletypes.xml is part of the base game, so it works on PlayStation, Xbox and PC.

Where is cfgspawnabletypes.xml on a Nitrado console server?

In the mission folder, in dayzps_missions on PlayStation or dayzxb_missions on Xbox, next to the db folder. See where DayZ server files live.

Can I make every gun spawn with a scope?

Yes, by giving the optics group a chance of 1.0. Most servers find it makes loot too easy, so a chance between 0.2 and 0.5 is more common.

Run your DayZ server from one place

Free editors for every config file, plus a live dashboard and Discord feeds when you're ready.