# Help with spawning items

**URL:** <https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040>\
**Category:** The Toolbox\
**Created:** [November 24, 2019, 1:27am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040 "2019-11-24T01:27:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheeptime](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@sheeptime](https://discourse.cataclysmdda.org/u/sheeptime)\
**Post date:** [November 24, 2019, 1:27am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040/1 "2019-11-24T01:27:38Z")

</div>

I am creating a mod to add in more firearm-related content into the game.  
I just added STANAG magazine with different capacity and changed all the .223 STANAG guns to accept them.  
Instead of a gun spawn with a default 30rd magazine as default, now the game stick with the closest one it can fit the ammo inside the gun.

example:

 ![dev_gunspawn](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/a/a59192c4623aa256f2f1ffb4ef69a5d533a277e9.jpeg)

Is there any way to specify which magazine can be used for spawning?

Thank you

---

<div class="post-metadata">

**Author:** ![TheMurderUnicorn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/themurderunicorn/32/5706_2.png) [@TheMurderUnicorn](https://discourse.cataclysmdda.org/u/TheMurderUnicorn)\
**Post date:** [November 24, 2019, 3:12am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040/2 "2019-11-24T03:12:58Z")

</div>

Hmm. I haven’t worked with that sort of thing in a long time, so this could all be completely wrong!

But my guess would be that when the itemgroup is spawning the item, it’s spawning it using “charges-min” and “charges-max”, so depending on the amount of ammunition it’s then assigning a magazine based on that.

How to fix it? You’d probably have to change the itemgroups to only use a range of ammunition that would fit in the magazine you want to spawn, and set up others for the different clips.

Alternatively, I know you can use “contents-item” to specify storage for clips in things like a chest rig, so you may be able to use that to specify a clip into a gun, but I couldn’t find examples of this so it might not be possible.

If it were me, I’d just make one of the magazines standard and spawn with them all by specifying a range of ammo that fits that clip, then have the other magazines only appear in the world and not in the gun.

I don’t know if any of this was helpful or would work, but I’m bored and thought I’d weigh in.

---

<div class="post-metadata">

**Author:** ![sheeptime](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@sheeptime](https://discourse.cataclysmdda.org/u/sheeptime)\
**Post date:** [November 24, 2019, 4:06am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040/3 "2019-11-24T04:06:04Z")

</div>

Thanks for the suggestion, I did some test with your idea and sadly, none of them work or provide the result I would like.

Changing the range of ammunition can only work within 21~30 rounds, any more or less will result in a different magazine spawned instead.

Contents item would just spawn the magazine…

And then I found “container-item”  
{ “item”: “stanag30”, “prob”: 25, “charges-min”: 0, “charges-max”: 30, “container-item”: “m4a1”} works perfectly

problem solved, just need to edit all the item group now.  
500 lines, oh god…

---

<div class="post-metadata">

**Author:** ![TheMurderUnicorn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/themurderunicorn/32/5706_2.png) [@TheMurderUnicorn](https://discourse.cataclysmdda.org/u/TheMurderUnicorn)\
**Post date:** [November 24, 2019, 4:24am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040/4 "2019-11-24T04:24:52Z")

</div>

Neat. I was just taking stabs in the dark. Glad you found one that worked.

---

<div class="post-metadata">

**Author:** ![sheeptime](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@sheeptime](https://discourse.cataclysmdda.org/u/sheeptime)\
**Post date:** [November 24, 2019, 4:26am UTC](https://discourse.cataclysmdda.org/t/help-with-spawning-items/22040/5 "2019-11-24T04:26:52Z")

</div>

Still thanks for the time you used to stab 🙂
