Jump to content

Recommended Posts

Title~

 

Right now I have mobs that kinda work like Spiders. They have homes, they come out of their homes, and after a certain amount are killed another one will take its place after a couple of days. They are In a setpiece and spawn around the world.

 

I have two problems though,

 

1. I just want a couple of set pieces, it keeps spawning 6-12 set pieces which is overkill. How can I reduce that?

 

2. I don't want it to spawn around the world, only in the Savanna biome. Problem is when I try to look for rooms, theres only Forest and Cave. How can I make this specific?

 

I'm using squiggles tutorial on setpieces.

 

I'd appreciate the help!

 

- - modworldgenmain

local Layouts = GLOBAL.require("map/layouts").Layoutslocal StaticLayout = GLOBAL.require("map/static_layout") Layouts["SaberWildHome"] = StaticLayout.Get("map/static_layouts/saberwildhome") AddRoomPreInit("Forest", function(room)    if not room.contents.countstaticlayouts then        room.contents.countstaticlayouts = {}    end    room.contents.countstaticlayouts["SaberWildHome"] = 1end)

@rons0n, define "savanna".

 

A world generates based on a level.

This level has a task set given.

This task set contains all tasks, all pieces of the puzzle that is the map.

Those tasks contain rooms, or how the piece of the puzzle look.

 

If you go by rooms that have GROUND.SAVANNA as value, you can end up in many places, a savanna with grass only, a savanna with grass and rabbits, a savanna with grass, rabbits, beefalo, a savanna with beefalo, that savanna with rabbits that gets stuck in the middle of the desert.

 

There are many puzzle pieces that have yellow dots, which you may think are savanna, but are surrounded by other stuff.

 

Many rooms.

 

But where are the beef?

 

Well, for example, in the BeefalowPlain room.

 

Mainly used in the tasks "For a nice walk", and "Great Plains".

"Great Plains" is a mandatory task to use, "For a nice walk" is not, it's optional.

 

 

All of this is a boring mess.

 

You can make your own simple task with a single room and append it to the task set.

You can make your own room and append it to an existing task.

 

You can make your own static layout and append it to an existing room.

Which is what you did. You appended your layout to the "Forest" room, that gets used repeatedly in many tasks.

Ergo, getting a ton of layouts, everywhere.

To fix this, you should make one room and append it so that it will only exist once among all tasks.

 

I'm going to take the approach the dragonfly arena, the wormholes, the touchstones, use.

local require = GLOBAL.requirelocal Layouts = require("map/layouts").Layoutslocal StaticLayout = require("map/static_layout")local Tasks = require("map/tasks")Layouts["SaberWildHome"] = StaticLayout.Get("map/static_layouts/saberwildhome")Tasks.GetGenTasks("default").set_pieces["SaberWildHome"] = {count = 1, tasks = {"Great Plains"}}

I get the default task set, I get its set_pieces table, and I append my static layout.

I only want it once, in any room of the "Great Plains" task, which consists of:

	-- Beefalo and grass (1-4 rooms)	["BeefalowPlain"] = 1 + math.random(3),	-- Grass, rocks, rabbits, and green mushrooms (1-4 rooms)	["Plain"] = 1 + math.random(3), 	-- Forest like place where the multiplayer spawn can appear (2 rooms)	["Clearing"] = 2,

So pretty good overall. My layout will be dumped in any of those rooms.

 

IF there's space. There's a chance the layout won't find space and won't be put. (I gave it a 1, and limited it to a single task.)

 

And what you can do here is:

a) Making your layout a room with distributed prefabs. This way you will be able to concentrate prefabs in a spot designed for them, they will have a place.

b) Have the layout have a required prefab on the level.

local function AddReq(level)	table.insert(level.required_prefabs, "SaberLionDen")endAddLevelPreInit("SURVIVAL_TOGETHER", AddReq)

So if there's no static layout, there's no SaberLionDen, so world tries to regenerate.

 

Have fun!

@DarkXero,  That was really informative!

 

I appreciate you willing to type up a very lengthly and knowledgeable post for me. I don't understand fully but I have the gist of it atleast. Now time to make tons of set pieces in the future!

 

Though I hope you don't mind me asking more questions in this thread every now and then if I bump into problems.

 

As usual, my thanks to you

Edited by rons0n

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...