Modding Help Adjusting Monster Spawn Rates

Discussion in 'Starbound Modding' started by Quailman84, Feb 23, 2017.

  1. Quailman84

    Quailman84 Void-Bound Voyager

    I'm working on a mod that will cause more creatures to spawn on higher tier planets, and less on lower tier planets.

    For whatever reason, I'm having a hard time pinning down what will actually make the spawn rates increase. What file controls all that?
     
  2. Quailman84

    Quailman84 Void-Bound Voyager

    Of course, it always happens that you find your solution immediately after posting the question. It is the files in the spawntypes folder. You just have to change the "spawnchance" for each type. Duh.

    For anybody interested, my method for setting the spawn rates per tier is to roll a random number between 1 and 6 during every monster's init() and aborting the spawn if the number is higher than the planet's threat level. Haven't done much testing but it seems to work. There are definitely more elegant methods, but they are also incredibly tedious to implement.
     
  3. xaliber

    xaliber Scruffy Nerf-Herder

    I know how to set the spawnchance, but I'm curious how/where do you roll the random number? Is it in the .biome files or in .lua?
     
  4. Quailman84

    Quailman84 Void-Bound Voyager

    I put it in the init() function of monster.lua. It does cause some problems. For example, that poptop thing that's always in the mine on the starter planet has a pretty high chance of never existing. So there's just an arena with nothing in it. You could find a way around stuff like that by checking the type of the monster before aborting it. I haven't had a chance to iron out all of the flaws, but if I do I'll post it here.
     

Share This Page