Zeyn Posted March 3, 2015 Share Posted March 3, 2015 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"] = 1I 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. Link to comment Share on other sites More sharing options...
Mobbstar Posted March 3, 2015 Share Posted March 3, 2015 You know that there are three caves in a world? Just sayin. Add the thing to a cave task. That simple. Link to comment Share on other sites More sharing options...
Zeyn Posted March 3, 2015 Author Share Posted March 3, 2015 Add the thing to a cave task. That simple. You know, i begin in modding, and what is simple for you is probably not for me. Could you explain me a little more ? Link to comment Share on other sites More sharing options...
orian34 Posted March 3, 2015 Share Posted March 3, 2015 You know, i begin in modding, and what is simple for you is probably not for me. Could you explain me a little more ?in map.tasks you have a task file. In the cave task, you can add the room. Link to comment Share on other sites More sharing options...
Mobbstar Posted March 3, 2015 Share Posted March 3, 2015 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 Link to comment Share on other sites More sharing options...
Zeyn Posted March 3, 2015 Author Share Posted March 3, 2015 Thank you orian34 and Mobbstar for your help ! Effectively, i didn't knew what a task was, and that's much clear now. I think i will be able to do it with your help ! Link to comment Share on other sites More sharing options...
Zeyn Posted March 4, 2015 Author Share Posted March 4, 2015 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"] = 1But 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 ! Link to comment Share on other sites More sharing options...
orian34 Posted March 4, 2015 Share Posted March 4, 2015 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"] = 1But 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 ! 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... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.