# Looking for a way to limit map location spawns in custom mod

**URL:** <https://discourse.cataclysmdda.org/t/looking-for-a-way-to-limit-map-location-spawns-in-custom-mod/18417>\
**Category:** The Toolbox\
**Created:** [January 17, 2019, 8:12pm UTC](https://discourse.cataclysmdda.org/t/looking-for-a-way-to-limit-map-location-spawns-in-custom-mod/18417 "2019-01-17T20:12:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sneeze-attack](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/sneeze-attack/32/4220_2.png) [@sneeze-attack](https://discourse.cataclysmdda.org/u/sneeze-attack)\
**Post date:** [January 17, 2019, 8:12pm UTC](https://discourse.cataclysmdda.org/t/looking-for-a-way-to-limit-map-location-spawns-in-custom-mod/18417/1 "2019-01-17T20:12:53Z")

</div>

I’m working on a mod that adds a custom start location (science bunker) that contains a vat of flavored/unflavored mutagen serum.

My mod is [here](https://github.com/sneeze-attack/mutagen-dreams)

Everything is working great, except I am having an issue where I want to limit the total number of Science bunkers that generate in the game world to 2. I know in the overmap specials you can specify a range for occurrences; however I ended up creating a separate overmap special of the science bunker and each of the different mutations to allow specifying which mutagen beginning location you’d like to start in. This means my worlds spawn with up to 23 of these Science bunkers, as each variation has an occurrence of 0-1.  
I haven’t really figured out a way to solve this so far that wouldn’t involve more than JSON modding. I know I can set up weighted values, but then I lose the ability to allow the player to select their starting mutagen type (by choosing their starting location) if I change the `om_terrain` value of the bunkers to be identical.

I’m trying to avoid using LUA, but if it would allow this, I’m up to the challenge – I’m just still not sure what condition/value I would tie the IF statement to.

Any ideas?

---

<div class="post-metadata">

**Author:** ![sneeze-attack](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/sneeze-attack/32/4220_2.png) [@sneeze-attack](https://discourse.cataclysmdda.org/u/sneeze-attack)\
**Post date:** [January 18, 2019, 3:44pm UTC](https://discourse.cataclysmdda.org/t/looking-for-a-way-to-limit-map-location-spawns-in-custom-mod/18417/2 "2019-01-18T15:44:14Z")

</div>

Just an update, I’ve decided to go the LUA route for now as I feel JSON will be too limiting for what I am trying to achieve. I found that there is a `start_location` attribute in [class\_definitions.lua](https://github.com/CleverRaven/Cataclysm-DDA/blob/e725e4ff03822018b9d47ae3e996db92788a9ebf/lua/class_definitions.lua) on line 530 that I think I can reference with an IF statement. If that attribute isn’t sufficient, I think there is enough here for me to be creative and find a method that will work.  
If and when I do get this working, I will post my solution for future reference.

Edit: [Link](https://github.com/sneeze-attack/mutagen-dreams/blob/master/lua/sciencebunker.lua) to the code used for this
