Jump to content

Recommended Posts

Hello !

 

I have created some rooms for a mod, and i would like one of these rooms to be in the cave (underground). Here is the code i have made for now for this room (code in the modworldgenmain.lua) :

Layouts["box_thing"] = StaticLayout.Get("map/static_layouts/box")-- Remove the ring thing layout creating by defaultLayouts["TeleportatoBoxLayout"] = StaticLayout.Get("map/static_layouts/The_Nil_Piece")-- Add a room to the world that include the box thingAddRoom("box_thing", {                    colour={r=0,g=0,b=0,a=0},                    value = GLOBAL.GROUND.CAVE,                    tags = {},                    contents =  {                                    distributepercent = 0,                                    countstaticlayouts=                                    {                                        box_thing = 1,                                    },                                    distributeprefabs=                                    {                                    },                                }                    })task.room_choices["box_thing"] = 1

I have tried to change the value GLOBAL.GROUND with GLOBAL.UNDERGROUND but this won't works, this value is just to change the ground of the room.

 

You know, i begin in modding, and what is simple for you is probably not for me. Could you explain me a little more ?

 

Excuse me, I assumed you knew what a task is beforehand. Don't Starves world generation basically works in these steps: levels (islands or worlds, if you will) -> tasks (branches) -> rooms (biomes) -> setpieces (you know these for sure)

 

As you can see,  you are making a tiny room for your setpiece (to assure one and only one spawns, I assume), and adding that room to a task. Depending on what task you add it to, it will appear in a different environment (e.g. "BefallowPlain" will put your setpiece nearby beefalos).

 

That's where the "task.room_choices" comes into play. The declaration of "task" determines the task your room ends up in, and by replacing it by others, you can control the area and even level your room appears in.

 

Here's a short list of some examples for cave tasks: BatCaves,TentacledCave,FungalPlain,Cavern

 

I hope this helps :encouragement:

Ok it works when i do this :

-- Add a room to the world that include the box thing AddRoom("box_thing", {                    colour={r=0,g=0,b=0,a=0},                    value = GLOBAL.GROUND.CAVE,                    tags = {},                    contents =  {                                    distributepercent = 0,                                    countstaticlayouts=                                    {                                        box_thing = 1,                                    },                                    distributeprefabs=                                    {                                    },                                }                    })local task = GLOBAL.tasks.GetTaskByName("BatCaves", GLOBAL.tasks.sampletasks)task.room_choices["box_thing"] = 1

But there are two main problems :

 

- This create a room with the box thing in each caves, so three box things

- The world can't be generated if there is no box thing on the "normal" world

 

I search solutions. If someone have an idea that can help, don't hesitate ! :ugeek: 

 

Ok it works when i do this :

-- Add a room to the world that include the box thing AddRoom("box_thing", {                    colour={r=0,g=0,b=0,a=0},                    value = GLOBAL.GROUND.CAVE,                    tags = {},                    contents =  {                                    distributepercent = 0,                                    countstaticlayouts=                                    {                                        box_thing = 1,                                    },                                    distributeprefabs=                                    {                                    },                                }                    })local task = GLOBAL.tasks.GetTaskByName("BatCaves", GLOBAL.tasks.sampletasks)task.room_choices["box_thing"] = 1

But there are two main problems :

 

- This create a room with the box thing in each caves, so three box things

- The world can't be generated if there is no box thing on the "normal" world

 

I search solutions. If someone have an idea that can help, don't hesitate ! :ugeek:

perhaps adding some dirty trick when you generate the first cave that stays on until you change of island. It would deactivate the creation of the room...But i have no idea of how it would work...

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