Minitte Posted March 31, 2020 Share Posted March 31, 2020 (edited) 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 = {} end room.contents.countstaticlayouts["surface_lightbulb_fissure"] = 1 --add one end) The code above is based on the set piece tutorial from http://dontstarveapi.com/tutorials/creating-your-first-mod/setpiece/ Also 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. Solution: AddLevelPreInitAny(function(level) if level.location ~= "forest" then -- only in overworld return end if level.required_setpieces == nil then -- if required_setpieces does not exist already, create it level.required_setpieces = {} end table.insert(level.required_setpieces, "surface_lightbulb_fissure") end) Edited March 31, 2020 by Minitte added tags and solution Link to comment https://forums.kleientertainment.com/forums/topic/116928-unique-set-piece-solved/ Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now