Sign in to follow this  

Unique Set Piece (solved)

Recommended Posts

Minitte    192

I am trying to create a set piece that only generates once. Have I have right now generates it correctly but there more than one.

 --import some needed stuff
local Layouts = GLOBAL.require("map/layouts").Layouts --this is where we add the setpiece
local StaticLayout = GLOBAL.require("map/static_layout") --this helps us load the setpiece

Layouts["surface_lightbulb_fissure"] = StaticLayout.Get("map/static_layouts/surface_lightbulb_fissure") --index your setpiece

AddRoomPreInit("Forest", function(room) --"Forest" is the biotope in this case
    if not room.contents.countstaticlayouts then
        room.contents.countstaticlayouts = {}
    room.contents.countstaticlayouts["surface_lightbulb_fissure"] = 1 --add one

The code above is based on the set piece tutorial from


I tried looking into how pig king or the lunar island's alter pieces are spawned but I don't really get it. :l

Edit:Nvm it's on the 2nd post for the tutorial forum post.


	if level.location ~= "forest" then -- only in overworld
	if level.required_setpieces == nil then -- if required_setpieces does not exist already, create it
		level.required_setpieces = {}
	table.insert(level.required_setpieces, "surface_lightbulb_fissure")


Edited by Minitte
added tags and solution

Share this post

Link to post
Share on other sites

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
Sign in to follow this