Loot piles too big with chance of item collection

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.

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

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.

Use place_loot instead. It’s much more predictable

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.

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

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.

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…

"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 } ] } } } } ]

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

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: 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 which you may wish to subscribe to notifications on