_Q_ Posted February 4, 2016 Share Posted February 4, 2016 Any way to force game to start in a cave type level? I changed level type of survial and it skipped to use plus preset instead of generating cave level. I did something like: AddLevel(LEVELTYPE.CAVE, { id="SURVIVAL_DEFAULT", name=STRINGS.UI.CUSTOMIZATIONSCREEN.PRESETLEVELS[1], desc=STRINGS.UI.CUSTOMIZATIONSCREEN.PRESETLEVELDESC[1], overrides={ {"start_setpeice", "DefaultStart"}, {"start_node", "Clearing"}, {"location", "cave"}, }, tasks = { "Make a pick", "Dig that rock", "Great Plains", "Squeltch", "Beeeees!", "Speak to the king", "Forest hunters", }, numoptionaltasks = 4, optionaltasks = { "Befriend the pigs", "For a nice walk", "Kill the spiders", "Killer bees!", "Make a Beehat", "The hunters", "Magic meadow", "Frogs and bugs", }, set_pieces = { ["ResurrectionStone"] = { count=2, tasks={"Make a pick", "Dig that rock", "Great Plains", "Squeltch", "Beeeees!", "Speak to the king", "Forest hunters" } }, ["WormholeGrass"] = { count=8, tasks={"Make a pick", "Dig that rock", "Great Plains", "Squeltch", "Beeeees!", "Speak to the king", "Forest hunters", "Befriend the pigs", "For a nice walk", "Kill the spiders", "Killer bees!", "Make a Beehat", "The hunters", "Magic meadow", "Frogs and bugs"} }, }, ordered_story_setpieces = { "TeleportatoRingLayout", "TeleportatoBoxLayout", "TeleportatoCrankLayout", "TeleportatoPotatoLayout", "AdventurePortalLayout", "TeleportatoBaseLayout", }, required_prefabs = { "teleportato_ring", "teleportato_box", "teleportato_crank", "teleportato_potato", "teleportato_base", "chester_eyebone", "adventure_portal", "pigking" }, }) Game generated SURVIVAL_DEFAULT_PLUS level instead. I want just put normal world into cave and make the game start there. @PeterA Link to comment Share on other sites More sharing options...
Developer PeterA Posted February 4, 2016 Developer Share Posted February 4, 2016 @_Q_ I don't know off the top off my head unfortuantely. I'll leave this thread open on my pc so I can take a look into it when I get a chance! Link to comment Share on other sites More sharing options...
Arkathorn Posted February 4, 2016 Share Posted February 4, 2016 AddGlobalClassPostConstruct("saveindex", "SaveIndex", function(inst) local fn_startsurvivalmode = inst.StartSurvivalMode inst.StartSurvivalMode = function(self, saveslot, character, customoptions, onsavedcb, dlc, startmode) fn_startsurvivalmode(self, saveslot, character, customoptions, onsavedcb, dlc, "cave") end end) This should do it. It might interfere with other worldgen, so be forewarned. Link to comment Share on other sites More sharing options...
_Q_ Posted February 5, 2016 Author Share Posted February 5, 2016 4 hours ago, Arkathorn said: AddGlobalClassPostConstruct("saveindex", "SaveIndex", function(inst) local fn_startsurvivalmode = inst.StartSurvivalMode inst.StartSurvivalMode = function(self, saveslot, character, customoptions, onsavedcb, dlc, startmode) fn_startsurvivalmode(self, saveslot, character, customoptions, onsavedcb, dlc, "cave") end end) This should do it. It might interfere with other worldgen, so be forewarned. The edited level is still ignored and it generates normal cave level instead. So now I could just edit the cave world instead, but that would be minus 1 caves level so this would make the level I want + ruins only. I just want world like the first floor of caves be the starting, dark but still with some kind of day and night cycle and ray oflights here and there. Link to comment Share on other sites More sharing options...
Mobbstar Posted February 5, 2016 Share Posted February 5, 2016 @_Q_ so do you want the world to START in your level or add a cave layer that can be accessed AFTER starting a new world? If it helps, here's a sketch on how I start a new level using a custom prefab (this is probably mixed up with my.... "uncompromising" doing) Spoiler This would be attached to the cave entrance I guess: Spoiler local function onsaved() GLOBAL.StartNextInstance({reset_action=GLOBAL.RESET_ACTION.LOAD_SLOT, save_slot = GLOBAL.SaveGameIndex:GetCurrentSaveSlot()}, true) end GLOBAL.TheFrontEnd:PopScreen() GLOBAL.SetPause(false) GetPlayer().sg:GoToState("teleportato_teleport") GetPlayer():DoTaskInTime(5, function() GLOBAL.SaveGameIndex:StartCustomLevel(onsaved) end) You will need to edit the savegame index: Spoiler AddGlobalClassPostConstruct("saveindex", "SaveIndex", function(self) function self:StartCustomLevel(cb) local function ongamesaved() self.data.slots[self.current_slot].current_mode = "bossfight" --default from lost fragment, replace self.data.slots[self.current_slot].modes.bossfight= {world = 1} -- Hunt through the modded levels and find ours, then save its index. local Levels = require("map/levels") for i,level in ipairs(Levels.custom_levels) do --I suppose you added yours to cave levels, so select it there if level.id == "CAVE_CUSTOM" then self.data.slots[self.current_slot].modes.bossfight.options = { level_id = i, } print("Found a custom level:",i,level.name) break end end self:Save(cb) end --self:SaveCurrent(ongamesaved) local current_mode = self.data.slots[self.current_slot].current_mode local data = self:GetModeData(self.current_slot, current_mode) --calls the data table local file = data.file data.file = nil GLOBAL.EraseFiles( ongamesaved, { file } ) --WARNING: THIS ERASES THE CURRENT LEVEL BEFORE TAKING YOU TO THE CUSTOM ONE end end) This is bodged together using the "lost fragment" mod, some source code and a jar of luck. No warranty! Link to comment Share on other sites More sharing options...
_Q_ Posted February 5, 2016 Author Share Posted February 5, 2016 I want the game to start in custom made new world. But can't make it dark world without setting night only, but caves are dark and still have day/night cycle, wondering what removes the sun. If that LEVELTYPE.CAVE variable or something else... Link to comment Share on other sites More sharing options...
Mobbstar Posted February 6, 2016 Share Posted February 6, 2016 @_Q_ this is just a suspicion, but I think it works like this: In clock.lua, day-, dusk- and night-colour are defined. You will find that night is 0/0/0 (i.e. black), but also that there's a second black colour called "cave". The clock always uses cave-colour when the world is a cave. The light from the holes comes from "cavelight" prefab, which is the sunrays marking said holes. So, to answer your question, I suggest you try to override the day- and dusk-colours with 0/0/0 and see how it goes. 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.