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.
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.
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.
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.
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.
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
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.xmlexactly, 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