Jump to content

Recommended Posts

So I put together my first custom set piece this weekend, and thought I got everything working, so I released it. Then when testing other things, I realised it hadn't spawned just once on my map, but multiple times (9). I should have checked for something like this before releasing, but I was all took up with the excitement of getting the thing working.

 

I'm looking through other code right now, but I would be very grateful if anyone is able to point me in the right direction as to for limiting the spawn to 1 instance per world generated? I'm assuming this will be defined in modmain or modworldgenmain. (mod is here for those who want to look at the files)

 

I've essentially followed this tutorial (but can't post there because it's 30+ days old).

Edited by justjasper

Update:

 

So, on and off since I posted this I've tried to get it to work. Mainly I've been looking at other mods that spawn prefabs and set pieces to see if I can use the code, but I am an absolute novice to DS modding.

 

Now I'm focusing on this part of my code:

 

room.contents.countstaticlayouts["SETPIECENAME"] = 1

 

If the value is at anything less than 1, nothing shows up. But if it's at 1 or higher, 10+ instances of the set piece spawn in a world. They're spawning in the right biome, but too frequently. I'm at a loss for how to continue.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...