Jump to content

How to force a count static layout to NEVER spawn in layouts.lua (look at thread to understand better).


Recommended Posts

There is a static layout called "MushroomRingLarge" in layouts.lua. How can I mod that to NEVER spawn?
What code can I add to my modworldgen.lua?

PS: its actually in terrain_forest.lua that the " count layout" is added.

Edited by NamelessName
Link to comment
Share on other sites

Anyone knows how to turn off the default set pieces? I know that adding something like "--" in front of a line can disable it to spawn but how do I make that into a mod. 

I have made the dev graveyard trap (and many others) to spawn always BUT they also sometimes spawn a duplicate of it for some reason. How do I make sure that it doesnt spawn more than the one ive added?

Link to comment
Share on other sites

So at first I tried incresing the amount of mushroom rings to see if it's possible to change the frequency of appearance.

It worked with this code:

AddRoomPreInit("BGDeepForest", function(room) -- Adding the room with mushroom rings
	room.contents.countstaticlayouts = {["MushroomRingSmall"] = function() -- A function that sets the frequency of appearance
																if math.random(0,1000) > 20 then -- The smaller the number on the right the higher the frequency of appearance
																	return 1
																end
																return 0 
															end}
end)

AddRoomPreInit("Clearing", function(room) -- Adding the room with mushroom rings
	room.contents.countstaticlayouts = {["MushroomRingLarge"] = function() -- A function that sets the frequency of appearance
																if math.random(0,1000) > 20 then  -- The smaller the number on the right the higher the frequency of appearance
																	return 1 
																end
																return 0 
															end}
end)

There was around 20 rings per world (I didn't count so might be more). Now to reverse this effect I put in this code:

AddRoomPreInit("BGDeepForest", function(room)
	room.contents.countstaticlayouts = {["MushroomRingSmall"] = nil} -- Eliminating any static layouts (in this case only mushroom rings)
end)

AddRoomPreInit("Clearing", function(room)
	room.contents.countstaticlayouts = {["MushroomRingLarge"] = nil} -- Eliminating any static layouts (in this case only mushroom rings)
end)

It seems to work but I'm not sure since it's hard to search for something that you might have deleted.

  • Like 1
Link to comment
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
 Share

×
×
  • Create New...