# Loot piles too big with chance of item collection

**URL:** https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999
**Category:** The Garage
**Created:** [November 24, 2016, 11:13am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999 "2016-11-24T11:13:36Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![egomassive](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/egomassive/32/381_2.png) [@egomassive](https://discourse.cataclysmdda.org/u/egomassive)
#### Post date: [November 24, 2016, 11:13am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/1 "2016-11-24T11:13:36Z")

</div>

I wanted stacks of items to appear with a single declaration on my json map character. So in the terrain json I put

`
      "items": {
        "z": { "item": "jacket_stack", "chance": 80 }
      }`

Then in a items\_groups.json I put

`
  {
    "type" : "item_group",
    "id" : "jacket_stack",
    "subtype": "collection",
    "groups":[
      ["jackets", 30],
      ["jackets", 30],
      ["jackets", 30]
    ]
  }`  
“jackets” is a core item group. I expected 0 to 3 jackets to appear on each “z” in my map, but I got as many as 20. Changing the chance to 100 in my terrain json makes it work as I expected. Also, if I do the same sort of thing with a distribution, everything works correctly.

Finally if I remove the chance from my declaration it behaves as though I gave it a 0 chance. Seems like it should be 100 by default.

```auto

```

I’m posting here instead of the github because it’s possible it’s mearly my understanding collections that is buggy.

win10, tiles, 0.C-19846-gebe6fa5

---

<div class="post-metadata">

### Author: ![egomassive](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/egomassive/32/381_2.png) [@egomassive](https://discourse.cataclysmdda.org/u/egomassive)
#### Post date: [November 26, 2016, 11:25am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/2 "2016-11-26T11:25:52Z")

</div>

On further digging, I’ve discovered that declaring item placement via the map characters always goes sideways if the chance isn’t 100%. I didn’t get any feedback here, but I’m fully confident this is a bug now, so I’ll be posting it on the github.

---

<div class="post-metadata">

### Author: ![mugling](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@mugling](https://discourse.cataclysmdda.org/u/mugling)
#### Post date: [November 26, 2016, 7:53pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/3 "2016-11-26T19:53:57Z")

</div>

Use place\_loot instead. It’s much more predictable

---

<div class="post-metadata">

### Author: ![egomassive](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/egomassive/32/381_2.png) [@egomassive](https://discourse.cataclysmdda.org/u/egomassive)
#### Post date: [November 26, 2016, 11:17pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/4 "2016-11-26T23:17:36Z")

</div>

Thanks mugling. There are so many ways to write the same thing, and I’ve tried a lot of them. I avoided “place\_loot” because “loot” didn’t sound like official terminology to me.

Maybe “loot” is the best term. The usage of “item” and “group” is haphazard. In the example above, “item” expects a group, and I couldn’t figure out how to actually declare an item in that format.

---

<div class="post-metadata">

### Author: ![mugling](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@mugling](https://discourse.cataclysmdda.org/u/mugling)
#### Post date: [November 26, 2016, 11:50pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/5 "2016-11-26T23:50:06Z")

</div>

Yes, the legacy item placement system is bad. It’s being worked on at the moment

---

<div class="post-metadata">

### Author: ![DanmakuDan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/danmakudan/32/5057_2.png) [@DanmakuDan](https://discourse.cataclysmdda.org/u/DanmakuDan)
#### Post date: [November 26, 2016, 11:53pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/6 "2016-11-26T23:53:34Z")

</div>

The behavior for chance at 100 will always place one; for other values, it will repeatedly place an item from the group until the chance roll fails.

---

<div class="post-metadata">

### Author: ![acidia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/acidia/32/2347_2.png) [@acidia](https://discourse.cataclysmdda.org/u/acidia)
#### Post date: [November 27, 2016, 12:35am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/7 "2016-11-27T00:35:14Z")

</div>

What syntax are you using to get place\_loot to work?

` "place_loot": {
        "z": { "item": "jacket_stack", "chance": 80 }
      }`  
Doesn’t work and I haven’t seen an existing json use it WITHOUT defining x,y coordinates…

---

<div class="post-metadata">

### Author: ![BorkBorkGoesTheCode](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/borkborkgoesthecode/32/2343_2.png) [@BorkBorkGoesTheCode](https://discourse.cataclysmdda.org/u/BorkBorkGoesTheCode)
#### Post date: [November 27, 2016, 1:07am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/8 "2016-11-27T01:07:19Z")

</div>

`"mapping": {
                "l": { "items": [
                { "item": "book_gunref", "chance": 20 },
                { "item": "book_gunmags", "chance": 10 }
                ]
            },
                "w": { "items": [
                { "item": "trash_cart", "chance": 20 }
                ]
            },
                "T": { "items": [
                { "item": "guns_obscure", "chance": 10 },
                { "item": "mags_obscure", "chance": 10 },
                { "item": "antique_guns", "chance": 20 },
                { "item": "ammo_obscure", "chance": 10 },
                { "item": "antique_rare", "chance": 10 }
                ]
            },
                "L": { "items": [
                { "item": "guns_obscure", "chance": 20 },
                { "item": "mags_obscure", "chance": 15 },
                { "item": "antique_guns", "chance": 50 },
                { "item": "ammo_obscure", "chance": 30 },
                { "item": "antique_ammo", "chance": 20 }
                ]
            }
            }
        }
  }
]
`

---

<div class="post-metadata">

### Author: ![acidia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/acidia/32/2347_2.png) [@acidia](https://discourse.cataclysmdda.org/u/acidia)
#### Post date: [November 27, 2016, 1:49am UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/9 "2016-11-27T01:49:57Z")

</div>

Sorry, I thought all item generation was now supposed to be handled by “place\_loot” but I guess mapping is still fine?

Edit: #19381 Isn’t exactly clear

---

<div class="post-metadata">

### Author: ![egomassive](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/egomassive/32/381_2.png) [@egomassive](https://discourse.cataclysmdda.org/u/egomassive)
#### Post date: [November 27, 2016, 11:00pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/10 "2016-11-27T23:00:41Z")

</div>

> [@DanmakuDan](#):
>
> The behavior for chance at 100 will always place one; for other values, it will repeatedly place an item from the group until the chance roll fails.

So that’s what’s happening! Thanks for clearing up my confusion! That is extremely counter-intuitive. Essentially probability (“chance”) and quantity (“repeat”) have been combined into a single number. It’s usable but dangerous. A chance of 50 would typically give 0 to 2 items, but there’s a slim chance for much higher quantities.

> [@mugling](#):
>
> Yes, the legacy item placement system is bad. It’s being worked on at the moment

@mugling: Any plans to deprecate old methods? I’m particularly fond of placing loot with a map key, but I’m not fond of making stuff that will stop working or cause problems.

---

<div class="post-metadata">

### Author: ![mugling](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@mugling](https://discourse.cataclysmdda.org/u/mugling)
#### Post date: [November 27, 2016, 11:35pm UTC](https://discourse.cataclysmdda.org/t/loot-piles-too-big-with-chance-of-item-collection/12999/11 "2016-11-27T23:35:53Z")

</div>

> [@egomassive](#):
>
> @mugling: Any plans to deprecate old methods? I’m particularly fond of placing loot with a map key, but I’m not fond of making stuff that will stop working or cause problems.

Yes, and this will be announced in the [JSON API changes thread](https://github.com/CleverRaven/Cataclysm-DDA/issues/19376) which you may wish to subscribe to notifications on
