# How vehicles spawn?

**URL:** <https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954>\
**Category:** The Toolbox\
**Created:** [April 26, 2014, 10:22am UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954 "2014-04-26T10:22:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![McFeel1](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@McFeel1](https://discourse.cataclysmdda.org/u/McFeel1)\
**Post date:** [April 26, 2014, 10:22am UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954/1 "2014-04-26T10:22:12Z")

</div>

Hi,

I want to add new vehicles, but don’t know how to make them spawn in game. There are a file like item\_groups.json for vehicles, they spawn randomly, or the spawn is harcoded?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![BevapDin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/bevapdin/32/228_2.png) [@BevapDin](https://discourse.cataclysmdda.org/u/BevapDin)\
**Post date:** [April 26, 2014, 2:06pm UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954/2 "2014-04-26T14:06:30Z")

</div>

> [@McFeel1](#):
>
> or the spawn is harcoded?

This. Look into mapgen.cpp and mapgen\_functions.cpp and search for add\_vehicle. That function places the vehicles (using their id). You’ll have to add more add\_vehicle calls with the id of your vehicles.

---

<div class="post-metadata">

**Author:** ![McFeel1](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@McFeel1](https://discourse.cataclysmdda.org/u/McFeel1)\
**Post date:** [April 26, 2014, 3:30pm UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954/3 "2014-04-26T15:30:33Z")

</div>

For now I have only modified json archives, and I’m not sure how to find the cpp ones. I have to compile the game? I have downloaded the source, but it’s an old version (0.6).

---

<div class="post-metadata">

**Author:** ![McFeel1](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@McFeel1](https://discourse.cataclysmdda.org/u/McFeel1)\
**Post date:** [April 26, 2014, 5:04pm UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954/4 "2014-04-26T17:04:20Z")

</div>

I have found the current version in the compilation post in this forum. I will try it, thanks.

---

<div class="post-metadata">

**Author:** ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)\
**Post date:** [April 26, 2014, 7:11pm UTC](https://discourse.cataclysmdda.org/t/how-vehicles-spawn/5954/5 "2014-04-26T19:11:51Z")

</div>

> [@McFeel1](#):
>
> For now I have only modified json archives, and I’m not sure how to find the cpp ones. I have to compile the game? I have downloaded the source, but it’s an old version (0.6).

You will have to compile once you’ve made your changes; that’s correct.
