Serpens Posted February 12, 2017 Share Posted February 12, 2017 (edited) Hi since I saw Lumina made a few tutorials, I thought I also might make a short one about adding new structures to worldgeneration, since the newest two mods I saw on workshop, made it the "wrong" way. All code mentioned here belongs to modworldgenmain.lua. In most mods you see, the author added his new trees or other structures like this in modworldgenmain.lua: Spoiler if GLOBAL.terrain.rooms.BGBadlands then GLOBAL.terrain.rooms.BGBadlands.contents.distributeprefabs.coffebush = 0.2 end if GLOBAL.terrain.rooms.Lightning then GLOBAL.terrain.rooms.Lightning.contents.distributeprefabs.coffebush = 0.1 end if GLOBAL.terrain.rooms.Badlands then GLOBAL.terrain.rooms.Badlands.contents.distributeprefabs.coffebush = 0.3 end if GLOBAL.terrain.rooms.HoundyBadlands then GLOBAL.terrain.rooms.HoundyBadlands.contents.distributeprefabs.coffebush = 0.1 end if GLOBAL.terrain.rooms.BuzzardyBadlands then GLOBAL.terrain.rooms.BuzzardyBadlands.contents.distributeprefabs.coffebush = 0.1 end But this code REPLACES everything else in this area, instead of adding new stuff! If you take a closer look in the game files, you will see that all "distributeprefabs" values are relative to each other. So if you have 0.05 trees, 0.07 rabbits and 0.1 grass, this will result to a total value of 0.05+0.07+0.1 = 0.22The result will be 0.05/0.22 = 22,72% trees. (of the chosen space) If you now add your coffebush the way like above with value of 0.2, the total value will be 0.22+0.2 = 0.42 So now you will only get 0.05/0.44 = 11.36 % trees. (of the chosen space) With more mods like this, the endresult will be like no trees at all, but only mod-things. There is another important value you have to change, if you don't want to replace other things: distributepercent. If "distributepercent" is for example 0.4 , this means at 40% of the available space, any thing will be placed. The rest of the space stays empty. So if you make it 1, everything would be full of trees, rabbits, grass and other stuff, there would be no space left. That means, if you add new things, you should also increase "distributepercent", to really add and not replace. I developed a system for this in my "Increase Animals" mod:http://steamcommunity.com/sharedfiles/filedetails/?id=758921911 The only thing I was not able to solve yet is, that "distributepercent" can't be more than 1 = 100% of course. So if you play with 10 mods, all of them adding 10% of space things, they will still replace old stuff, as soon as the distributepercent value reaches 100%. But 10% is quite alot, a more common value would be ~1%. In additoin if you reach 100%, the whole space is cluttered with stuff, which is also not nice to play with I extracted the code, so you can simply copy paste the following in your modworldgenmain.lua: Spoiler GLOBAL.require("map/terrain") -- some math helpers local function mymathclamp(num, min, max) return num <= min and min or (num >= max and max or num) end local function myround(num, idp) return GLOBAL.tonumber(string.format("%." .. (idp or 0) .. "f", num)) end -- roomincrease is an array of the rooms where you want to add your prefab and a percentage how many. -- {BGMarsh=0.8,Badlands=2,BGSavanna=1} this would result in 0.8% of the space in BGMarsh, 2% of space in Badlands and 1% of space in BGSavanna. -- The percentage is percentage of total available space! I suggest at max 10, not more! A more common value would be ~ 0.8 The code does not allow values above 20. local function AddThingtoWorldGeneration(prefab,roomincrease) local Increase = 0 for roomstr,add in pairs(roomincrease) do Increase = add/100 if Increase > 0 and Increase <= 0.2 then local oldpercent = 0 local oldsum = 0 local prefabvalue = 0 AddRoomPreInit(roomstr, -- if the room does not exist, it is added... so in case we want to support mod rooms, we shoudl call all active rooms first, and test if this room is active at the moment function(room) if room.contents then oldpercent = room.contents.distributepercent or 0 if not room.contents.distributeprefabs or oldpercent==0 then room.contents.distributeprefabs = {} prefabvalue = 1 -- here this value does not matter, cause it is the only one room.contents.distributeprefabs[prefab] = (room.contents.distributeprefabs[prefab] and room.contents.distributeprefabs[prefab] + prefabvalue) or prefabvalue room.contents.distributepercent = Increase else oldsum = 0 for distprefab,number in pairs(room.contents.distributeprefabs) do if type(number)=="table" then -- eg: smallmammal = {weight = 0.025, prefabs = {"rabbithole", "molehill"}}, -- print("number ist eine table bei: "..tostring(distprefab).." in room: "..tostring(roomstr)) for k,v in pairs(number) do -- print("k: "..tostring(k).." v: "..tostring(v)) if type(v)=="number" and k=="weight" then oldsum = oldsum + v end end elseif type(number)=="number" then oldsum = oldsum + number end end room.contents.distributepercent = mymathclamp(oldpercent + Increase,0,1) prefabvalue = myround((oldsum * (room.contents.distributepercent / oldpercent)) - oldsum,8) room.contents.distributeprefabs[prefab] = (room.contents.distributeprefabs[prefab] and room.contents.distributeprefabs[prefab] + prefabvalue) or prefabvalue end -- print("Increaser Debug: "..roomstr..": added "..prefab..". oldpercent: "..oldpercent..", oldsum: "..oldsum..", newpercent: "..room.contents.distributepercent..", prefabvalue: "..prefabvalue..", newvalue: "..room.contents.distributeprefabs[prefab]) end end ) print("Increaser: Add "..tostring(myround(Increase*100,2)).."% "..prefab.." to room: "..roomstr) elseif Increase > 0.2 then print("Increaser: Value of Increase is too high for "..prefab..", reduce it!") end end end After that, all you need is this line below my function: AddThingtoWorldGeneration("coffebush",{BGBadlands=0.7,Badlands=1,Lightning=1.1,HoundyBadlands=0.5,BuzzardyBadlands=0.6}) The number value is percentage of total available space! I suggest at max 10, not more! A more common value would be ~ 0.8. If you would set 100 or the total of the same terrain sums up to 100, every single point on the map would contain your thing, so there would be no space left to even walk. When adding new objects, don't forget to adjust the filters, so your object won't be on Roads for example. But that is already correct in all mods I saw: GLOBAL.terrain.filter.coffebush = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER} At last some terrain names I collected for my Increase Animals mod, so you do not have to search in game files, which terrains does exist. Might be incomplete, but I think the most important ones are there. There is no need to include the following in your code, it is just meant as a list of terrain names that you could use. EDIT: I replaced the code style with just a normal list, so there will be no misundertstanding. Spoiler these are mostly used rooms I think "BGBadlands","Badlands","Lightning","HoundyBadlands","BuzzardyBadlands","Moundfield", "BGDeciduous","DeepDeciduous","DeciduousMole","DeciduousClearing","PondyGrass","MolesvilleDeciduous","MagicalDeciduous", "BGGrassBurnt","BGGrass","MandrakeHome","GrassyMoleColony","FlowerPatch","EvilFlowerPatch","Waspnests","WalrusHut_Grassy","Walrusfield","PigTown","PigVillage","PigKingdom","PigCamp", "BGDirt","BGNoise", "BGCrappyForest","BGForest","BGDeepForest","BurntForest","CrappyDeepForest","DeepForest","Forest","ForestMole","CrappyForest","BurntClearing","Clearing","SpiderForest","SpiderCity","Graveyard", "BGMarsh","Marsh","SpiderMarsh","SlightlyMermySwamp","SpiderVillageSwamp","Mermfield","Tentacleland", "BGRocky","Rocky","GenericRockyNoThreat","MolesvilleRocky","BGChessRocky","RockyBuzzards","SpiderVillage","WalrusHut_Rocky","Tallbirdfield","TallbirdNests","PigCity", "BGSavanna","Plain","BarePlain","WalrusHut_Plains","BeefalowPlain", -- and here you see which mob belongs to which terrain I think Spiders = {"SpiderMarsh","SpiderForest","SpiderCity","SpiderVillage","SpiderVillageSwamp","SpiderfieldEasy","Spiderfield",}, Wasps = {"BeeClearing","FlowerPatch","EvilFlowerPatch","Waspnests",}, -- everywhere were bees are Merms = {"SlightlyMermySwamp","MermTown","Mermfield",}, Tentacles = {"BGMarsh","Marsh","Tentacleland",}, Walrus = {"WalrusHut_Plains","WalrusHut_Grassy","WalrusHut_Rocky","Walrusfield",}, Hounds = {"HoundyBadlands","Moundfield",}, Clockworks = {"ChessArea","MarbleForest","ChessMarsh","ChessForest","ChessBarrens","BGChessRocky","Chessfield",}, GuardPigs = {}, -- guardpigs have no natural room... -- neutral Bees = {"BeeClearing","FlowerPatch","EvilFlowerPatch","Waspnests",}, Tallbirds = {"TallbirdNests","Tallbirdfield",}, Beefalos = {"BeefalowPlain",}, Pigs = {"PigTown","PigVillage","PigKingdom","PigCity","PigCamp",}, Rabbits = {"BGSavanna","Plain","BarePlain",}, Moles = {"GrassyMoleColony","DeciduousMole","MolesvilleDeciduous","ForestMole","MolesvilleRocky",}, Voaltgoats = {"Lightning",}, Catcoons = {"BGDeciduous","DeepDeciduous","MagicalDeciduous","DeciduousMole","PondyGrass",} If you think we can even improve my code, please tell me and I will make adjustments Yes, you can argue that with all the mods adding new stuff, the world could get too full, if nothing is replaced. But as you can see above, if everytime something is replaced, there might be nothing from the old stuff left in the end.Of course feel free to develope another code system, that gets rid of both disadvantages! Edited February 12, 2017 by Serpens Link to comment Share on other sites More sharing options...
Lumina Posted February 12, 2017 Share Posted February 12, 2017 I'll give it a try. I have some questions : - This code goes in modworldgen.lua right ? - Could i use both methods, part replace, part your code ? - If i understand well, your code is more "stable" about the number of things added ? Like, if i set things on 0.8, i will not end with "ton in one biome, few in another" because it will no more be linked with what is already in theses biomes ? (Not sure i'm clear...) Link to comment Share on other sites More sharing options...
Serpens Posted February 12, 2017 Author Share Posted February 12, 2017 (edited) 9 minutes ago, Lumina said: I'll give it a try. I have some questions : - This code goes in modworldgen.lua right ? - Could i use both methods, part replace, part your code ? - If i understand well, your code is more "stable" about the number of things added ? Like, if i set things on 0.8, i will not end with "ton in one biome, few in another" because it will no more be linked with what is already in theses biomes ? (Not sure i'm clear...) - yes in modworldgenmain.lua. - Yes, there should be no conflict using both methods. But keep in mind with the first "replacer-method" you have to look up at least all game values of that terrain, to keep the chosen value in line with them (according to calculation formula above). And you can't know those values of other mods.... And even if you would know all values, with enough mods active, you need to adjust values of game objects to keep balance... this might be a step to find code for a middleway. - Yes, I chose the value to be "percentage of the total available space" instead of linking to other objects. So if you chose a value of 1 with my skript, 1% of the whole space in that area, whill contain this object, regardless of the number of other objects. Edited February 12, 2017 by Serpens Link to comment Share on other sites More sharing options...
Filigrani Posted February 12, 2017 Share Posted February 12, 2017 Very hard But a very interesting article! I kind of knew how to do. The code will look like? AddThingtoWorldGeneration("hole",{BGForest=0.015,BGCrappyFores=0.015}) AddThingtoWorldGeneration("tee_tree",{BGForest=0.9,BGCrappyFores=0.9}) AddThingtoWorldGeneration("wheat",{BGSavanna=0.18}) AddThingtoWorldGeneration("coffebush",{BGBadlands=0.7,Badlands=1,Lightning=1.1,HoundyBadlands=0.5,BuzzardyBadlands=0.6}) GLOBAL.terrain.filter.coffebush = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER} GLOBAL.terrain.filter.tee_tree = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER} GLOBAL.terrain.filter.wheat = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER} GLOBAL.terrain.filter.hole = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER} But What better figures put spawn in appearance. At your discretion? Link to comment Share on other sites More sharing options...
Eusong Posted February 12, 2017 Share Posted February 12, 2017 Everything looks good, but when using your code it causes the server to fail to start. I'm only trying to add in one prefab to spawn at the moment. GLOBAL.require("map/terrain") -- some math helpers local function mymathclamp(num, min, max) return num <= min and min or (num >= max and max or num) end local function myround(num, idp) return GLOBAL.tonumber(string.format("%." .. (idp or 0) .. "f", num)) end -- roomincrease is an array of the rooms where you want to add your prefab and a percentage how many. -- {BGMarsh=0.8,Badlands=2,BGSavanna=1} this would result in 0.8% of the space in BGMarsh, 2% of space in Badlands and 1% of space in BGSavanna. -- The percentage is percentage of total available space! I suggest at max 10, not more! A more common value would be ~ 0.8 local function AddThingtoWorldGeneration(prefab,roomincrease) local Increase = 0 for roomstr,add in pairs(prefabslist) do Increase = add/100 if Increase > 0 and Increase <= 0.2 then local oldpercent = 0 local oldsum = 0 local prefabvalue = 0 AddRoomPreInit(roomstr, -- if the room does not exist, it is added... so in case we want to support mod rooms, we shoudl call all active rooms first, and test if this room is active at the moment function(room) if room.contents then oldpercent = room.contents.distributepercent or 0 if not room.contents.distributeprefabs or oldpercent==0 then room.contents.distributeprefabs = {} prefabvalue = 1 -- here this value does not matter, cause it is the only one room.contents.distributeprefabs[prefab] = (room.contents.distributeprefabs[prefab] and room.contents.distributeprefabs[prefab] + prefabvalue) or prefabvalue room.contents.distributepercent = Increase else oldsum = 0 for distprefab,number in pairs(room.contents.distributeprefabs) do if type(number)=="table" then -- eg: smallmammal = {weight = 0.025, prefabs = {"rabbithole", "molehill"}}, -- print("number ist eine table bei: "..tostring(distprefab).." in room: "..tostring(roomstr)) for k,v in pairs(number) do -- print("k: "..tostring(k).." v: "..tostring(v)) if type(v)=="number" and k=="weight" then oldsum = oldsum + v end end elseif type(number)=="number" then oldsum = oldsum + number end end room.contents.distributepercent = mymathclamp(oldpercent + Increase,0,1) prefabvalue = myround((oldsum * (room.contents.distributepercent / oldpercent)) - oldsum,8) room.contents.distributeprefabs[prefab] = (room.contents.distributeprefabs[prefab] and room.contents.distributeprefabs[prefab] + prefabvalue) or prefabvalue end -- print("Increaser Debug: "..roomstr..": added "..prefab..". oldpercent: "..oldpercent..", oldsum: "..oldsum..", newpercent: "..room.contents.distributepercent..", prefabvalue: "..prefabvalue..", newvalue: "..room.contents.distributeprefabs[prefab]) end end ) print("Increaser: Add "..tostring(myround(Increase*100,2)).."% "..prefab.." to room: "..roomstr) elseif Increase > 0.2 then print("Increaser: Value of Increase is too high for "..prefab..", reduce it!") end end end local Terrains = { Badland = {"BGBadlands","Badlands",}, BadlandComplete = {"BGBadlands","Badlands","Lightning","HoundyBadlands","BuzzardyBadlands","Moundfield",}, Decidiuous = {"BGDeciduous","DeepDeciduous","DeciduousClearing","PondyGrass",}, DecidiuousComplete = {"BGDeciduous","DeepDeciduous","DeciduousMole","DeciduousClearing","PondyGrass","MolesvilleDeciduous","MagicalDeciduous",}, Grass = {"BGGrassBurnt","BGGrass","MandrakeHome",}, -- eg. hounds attack everything, so there would be no moles and beehives left... GrassComplete = {"BGGrassBurnt","BGGrass","MandrakeHome","GrassyMoleColony","FlowerPatch","EvilFlowerPatch","Waspnests","WalrusHut_Grassy","Walrusfield","PigTown","PigVillage","PigKingdom","PigCamp",}, Dirt = {"BGDirt","BGNoise",}, DirtComplete = {"BGDirt","BGNoise",}, Forest = {"BGCrappyForest","BGForest","BGDeepForest","BurntForest","CrappyDeepForest","DeepForest","Forest","CrappyForest","BurntClearing","Clearing",}, ForestComplete = {"BGCrappyForest","BGForest","BGDeepForest","BurntForest","CrappyDeepForest","DeepForest","Forest","ForestMole","CrappyForest","BurntClearing","Clearing","SpiderForest","SpiderCity","Graveyard",}, Marsh = {"BGMarsh","Marsh",}, MarshComplete = {"BGMarsh","Marsh","SpiderMarsh","SlightlyMermySwamp","SpiderVillageSwamp","Mermfield","Tentacleland",}, Rocky = {"BGRocky","Rocky","GenericRockyNoThreat",}, RockyComplete = {"BGRocky","Rocky","GenericRockyNoThreat","MolesvilleRocky","BGChessRocky","RockyBuzzards","SpiderVillage","WalrusHut_Rocky","Tallbirdfield","TallbirdNests","PigCity",}, Savanna = {"BGSavanna","Plain","BarePlain",}, SavannaComplete = {"BGSavanna","Plain","BarePlain","WalrusHut_Plains","BeefalowPlain",}, } AddThingtoWorldGeneration("grapebb",{BGDeciduous=0.3,DeerpDeciduous=0.3}) GLOBAL.terrain.filter.strawbb = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} GLOBAL.terrain.filter.grapebb = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} GLOBAL.terrain.filter.tomatob = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} GLOBAL.terrain.filter.orangetre = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} GLOBAL.terrain.filter.lemontree = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} GLOBAL.terrain.filter.limeltree = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER, GLOBAL.GROUND.ROCKY, GLOBAL.GROUND.MARSH} Link to comment Share on other sites More sharing options...
Serpens Posted February 12, 2017 Author Share Posted February 12, 2017 3 hours ago, Filigrani said: But What better figures put spawn in appearance. At your discretion? Thank you for taking the time and trying to implement it in your mod Yes your code looks alright The values for coffebushes I put into my code example are just random numbers. They might fit your needs, but better try a bit around and see if the number of coffebushes is too less/to many. English is not my native language. I know each word of both sentences, but I have no clue what you are asking =/ Could you try to ask it with other words or other sentence? Link to comment Share on other sites More sharing options...
Serpens Posted February 12, 2017 Author Share Posted February 12, 2017 @Eusong: If game crashes, the first thing you do, is looking at the logfiles. This is a general advise IIn the logfile you should get at least the file and line of the crash. And that will help alot to find out what went wrong, since I do not see any mistake by looing at the code. btw. the big list of all terrain types is not needed in the code. It was only meant to give you a list of what terrains do exist. Link to comment Share on other sites More sharing options...
Eusong Posted February 12, 2017 Share Posted February 12, 2017 [00:00:00]: System Memory: Memory Load: 50% Available Physical Memory: 4051m/8136m Available Page File: 6220m/11495m Available Virtual Memory: 3980m/4095m Available Extended Virtual Memory: 0m [00:00:00]: Process Memory: Peak Working Set Size: 28m Working Set Size: 28m Quota Peak Page Pool Usage: 225k Quota Page Pool Usage: 217k Quota Peak Non Paged Pool Usage:15k Quota Non Paged Pool Usage: 14k Page File Usage: 4m Peak Page File Usage: 4m [00:00:00]: PersistRootStorage is now APP:Klei//DoNotStarveTogether/Cluster_5/Master/ [00:00:00]: Starting Up [00:00:00]: Version: 203787 [00:00:00]: Current time: Sun Feb 12 14:51:11 2017 [00:00:00]: Don't Starve Together: 203787 WIN32 [00:00:00]: Build Date: 1796 [00:00:00]: Parsing command line [00:00:00]: Command Line Arguments: -monitor_parent_process 16392 -persistent_storage_root APP:Klei/ -conf_dir DoNotStarveTogether -cluster Cluster_5 -ownernetid 76561198105798752 -backup_log_count 10 -shard Master -sigprefix DST_Master [00:00:00]: Initializing distribution platform [00:00:00]: Initializing Minidump handler [00:00:00]: ....Done [00:00:00]: ....Done [00:00:00]: Fixing DPI [00:00:00]: ...Done [00:00:00]: ProfileIndex:8.59 [00:00:00]: THREAD - started 'GAClient' (4284) [00:00:00]: [Connect] PendingConnection::Reset(true) [00:00:00]: CurlRequestManager::ClientThread::Main() [00:00:00]: Network tick rate: U=15(2), D=0 [00:00:00]: Network tick rate: U=15(2), D=0 [00:00:00]: Authorized application C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\bin\dontstarve_dedicated_server_nullrenderer.exe is enabled in the firewall. [00:00:00]: WindowsFirewall - Application already authorized [00:00:00]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/client_save/blocklist.txt (Failure) [00:00:00]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/client_save/adminlist.txt (Failure) [00:00:00]: OnLoadUserIdList: APP:Klei//DoNotStarveTogether/client_save/whitelist.txt (Failure) [00:00:00]: Offline user ID: OU_76561198105798752 [00:00:00]: Token retrieved from: APP:Klei//DoNotStarveTogether/Cluster_5/cluster_token.txt [00:00:00]: Token retrieved from: APP:Klei//DoNotStarveTogether/Cluster_5/cluster_token.txt [00:00:00]: THREAD - started 'ConsoleInput' (15444) [00:00:00]: HardwareStats: OS name Microsoft Windows 10 Home version 10.0.14393 architecture 64-bit platformSpecific SP 0.0 CPU numCores 2 features SSE,SSE2,SSE3,SSSE3,SSE41,SSE42 name Intel(R) Pentium(R) CPU G3240 @ 3.10GHz manufacturer GenuineIntel clockSpeed 3100 RAM megsOfRam 8192 GPU name NVIDIA GeForce GT 720 driverDate 20161229000000.000000-000 megsOfRam 1024 refreshRate 59 videoModeDescription 1680 x 1050 x 4294967296 colors driverVersion 21.21.13.7653 [00:00:00]: cGame::InitializeOnMainThread [00:00:00]: Renderer initialize: Okay [00:00:00]: AnimManager initialize: Okay [00:00:00]: Buffers initialize: Okay [00:00:00]: cDontStarveGame::DoGameSpecificInitialize() [00:00:00]: FMOD Error: An invalid object handle was used. [00:00:00]: GameSpecific initialize: Okay [00:00:00]: cGame::StartPlaying [00:00:00]: LOADING LUA [00:00:00]: DoLuaFile scripts/main.lua [00:00:00]: DoLuaFile loading buffer scripts/main.lua [00:00:00]: running main.lua [00:00:00]: loaded modindex [00:00:00]: WARNING: icon paths for mod workshop-478005098 (Craftable Gears) are not valid. Got icon_atlas="modicon.xml" and icon="modicon.tex". Please ensure that these point to valid files in your mod folder, or else comment out those lines from your modinfo.lua. [00:00:00]: ModIndex: Beginning normal load sequence for dedicated server. [00:00:01]: DownloadMods(0) [00:00:01]: modoverrides.lua enabling More Fruits - Unfinished [00:00:01]: ModIndex:GetModsToLoad inserting moddir, More Fruits - Unfinished [00:00:01]: Could not load mod_config_data/modconfiguration_More Fruits - Unfinished_CLIENT [00:00:01]: applying configuration_options from modoverrides.lua to mod More Fruits - Unfinished [00:00:01]: Loading mod: More Fruits - Unfinished (More Fruits) Version:0.2.2 [00:00:01]: Mod: More Fruits - Unfinished (More Fruits) Loading modworldgenmain.lua [00:00:01]: MOD ERROR: More Fruits - Unfinished (More Fruits): Mod: More Fruits - Unfinished (More Fruits) [00:00:01]: Mod: More Fruits - Unfinished (More Fruits) Loading modmain.lua [00:00:01]: [string "../mods/More Fruits - Unfinished/modworldge..."]:17: bad argument #1 to 'pairs' (table expected, got nil) LUA ERROR stack traceback: =[C] in function 'pairs' ../mods/More Fruits - Unfinished/modworldgenmain.lua(17,1) in function 'AddThingtoWorldGeneration' ../mods/More Fruits - Unfinished/modworldgenmain.lua(82,1) in main chunk =[C] in function 'xpcall' scripts/util.lua(609,1) in function 'RunInEnvironment' scripts/mods.lua(483,1) in function 'InitializeModMain' scripts/mods.lua(453,1) in function 'LoadMods' scripts/main.lua(251,1) in function 'ModSafeStartup' scripts/main.lua(306,1) in function 'callback' scripts/modindex.lua(60,1) in function 'BeginStartupSequence' scripts/main.lua(305,1) in function 'callback' scripts/modindex.lua(516,1) =[C] in function 'GetPersistentString' scripts/modindex.lua(490,1) in function 'Load' scripts/main.lua(304,1) in main chunk [00:00:01]: [string "scripts/mainfunctions.lua"]:975: variable 'global_error_widget' is not declared LUA ERROR stack traceback: =[C] in function 'error' scripts/strict.lua(23,1) scripts/mainfunctions.lua(975,1) =[C] in function 'GetPersistentString' scripts/modindex.lua(490,1) in function 'Load' scripts/main.lua(304,1) in main chunk [00:00:01]: DoLuaFile Error: (null) [00:00:01]: LuaError but no error string [00:00:01]: Error loading main.lua [00:00:01]: Failed mSimulation->Reset() [00:00:01]: Error during game initialization! [00:00:01]: [IPC] Signal 'DST_Master_Kill' opened #000003B0 [00:00:01]: [IPC] Registering handler for signal #000003B0 [00:00:01]: [IPC] Handle #000003B0 added to the Eventhandles [00:00:01]: [IPC] Signal 'DST_Master_Starting' opened #000003B8 [00:00:01]: [IPC] Sending signal... #000003B8 [00:00:01]: Collecting garbage... [00:00:01]: lua_gc took 0.02 seconds [00:00:01]: ~ShardLuaProxy() [00:00:01]: ~ItemServerLuaProxy() [00:00:01]: ~InventoryLuaProxy() [00:00:01]: ~NetworkLuaProxy() [00:00:01]: ~SimLuaProxy() [00:00:01]: Cancelling LuaQueryCallback handle [1] [00:00:01]: Cancelling LuaQueryCallback handle [2] [00:00:01]: lua_close took 0.01 seconds [00:00:01]: Manager - ORPHANED UNKNOWN RESOURCES: [00:00:01]: shaders/ui_yuv.ksh - 1 [00:00:01]: CurlRequestManager::ClientThread::Main() complete [00:00:01]: HttpClient2 discarded 0 callbacks. [00:00:01]: Shutting down It looks to me like the issue is with the line "for roomstr,add in pairs(prefabslist) do" Link to comment Share on other sites More sharing options...
Serpens Posted February 12, 2017 Author Share Posted February 12, 2017 (edited) @Eusong: you can use the "spoiler" tag to shorten your post. And yes, look for "lua error" in your code and you will find out that "prefablist" is nil, which means it is undefined. As I wrote I extracted the code from my other mod, but adjusted it a bit to work on its own. I forgot to rename this variable. Please replace it with "roomincrease", I will fix it in first post. Thank you for finding this bug I tested the code now and it should work now (no more bugs I think) Edited February 12, 2017 by Serpens Link to comment Share on other sites More sharing options...
Lumina Posted February 12, 2017 Share Posted February 12, 2017 Ah, thanks, i got this error too but wasn't sure it was my mistake (since i tried to add it to my current worldgen), i didn't have time for more try at this moment. Good to know i wasn't alone and it's fixed now, i'll try it again soon then ^^ Link to comment Share on other sites More sharing options...
Eusong Posted February 12, 2017 Share Posted February 12, 2017 Thank you! And sorry, I didn't realize there was a spoiler tag. xD Link to comment Share on other sites More sharing options...
Filigrani Posted February 13, 2017 Share Posted February 13, 2017 (edited) 10 hours ago, Serpens said: Thank you for taking the time and trying to implement it in your mod Yes your code looks alright The values for coffebushes I put into my code example are just random numbers. They might fit your needs, but better try a bit around and see if the number of coffebushes is too less/to many. English is not my native language. I know each word of both sentences, but I have no clue what you are asking =/ Could you try to ask it with other words or other sentence? I mean: What is better to use numbers ? And English is also not my native language. I am Russian . According to this and there are errors in my text ! Edited February 13, 2017 by Filigrani Link to comment Share on other sites More sharing options...
Serpens Posted February 13, 2017 Author Share Posted February 13, 2017 6 hours ago, Filigrani said: I mean: What is better to use numbers ? you want to know which numbers to use in my "AddThingtoWorldgGeneration" function? The best would be to try around with different numbers. Try e.g 5 and see ingame how many are spawned. then try 0.5 and also 1 and see what you like best. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now