Help with spawning items

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:

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

Thank you

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.

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…

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

Still thanks for the time you used to stab :slight_smile: