Rokin Posted July 9, 2015 Share Posted July 9, 2015 (edited) Hi rewrite my topic here because my first was in wrong forum http://forums.kleientertainment.com/topic/56007-custom-worldgen-mainlua-in-mod/?p=652946 Hello, Sorry, I'm not a pro in english and lua coding, I searched a lot on forum/google/steam/DST source-code some informations but I don't understand everything :I (try) to write a mod who modify the gen-world code (tasks/rooms more customizable and random). Can it's possible to write a custom "worldgen_main.lua" in my mod folder and use it ? (if yes how ?) (ex : After many try, if i try to put a custom "mymod/script/worldgen_main.lua", the game don't want use it) (PS : "LevelPreInitAny API" don't help me for all what i want do) If it's not possible i can try to push my gen-world code in a custom forest_map.lua but its a crap "hook" solution i think. Thank you ! @Rokin, it's worldgenmain.lua not worldgen_main.lua. >>>>>>>>>>>> Uuuum I did not understand.. I have my mod :../DST/mods/<mysupermod>/ I have written some code in :../DST/mods/<mysupermod>/modmain.lua../DST/mods/<mysupermod>/modworldgenmain.luaIf i want, in this example, modify "rooms.lua" (in "hardcode", without use any api)i can put a copy of this file in my mod directory and modify it (the game read that copy if the mod is enable)../DST/data/scripts/map/rooms.lua(copy to)../DST/mods/<mysupermod>/scripts/map/rooms.luaNow if i want modify worldgen_main.lua../DST/data/scripts/worldgen_main.luai can try to put a copy in :../DST/mods/<mysupermod>/scripts/worldgen_main.luaBut the game not use it. (If y have a little understand, the game call worldgen_main.lua after mods loading.) @Rokin, it's worldgenmain.lua not worldgen_main.lua. so what i must do ?!../DST/mods/<mysupermod>/scripts/worldgenmain.lua../DST/mods/<mysupermod>/data/scripts/worldgenmain.luaI have try but it's change nothing and i found 0 threads who speak from a file named worldgenmain.lua (https://www.google.fr/search?q=worldgenmain.lua&oq=worldgenmain.lua&aqs=chrome..69i57j69i59.327j0j7&sourceid=chrome&es_sm=122&ie=UTF-8) Edited July 9, 2015 by Rokin Link to comment https://forums.kleientertainment.com/forums/topic/56012-custom-worldgen_mainlua-in-mod/ Share on other sites More sharing options...
Kzisor Posted July 9, 2015 Share Posted July 9, 2015 @Rokin, you were very unclear in your original post. I did my best to decipher what you meant, but honestly you are giving no information beyond you want to edit world generation. From a mod perspective that is done via 'modworldgenmain.lua' the files. You wrote: I (try) to write a mod who modify the gen-world code (tasks/rooms more customizable and random). Can it's possible to write a custom "worldgen_main.lua" in my mod folder and use it ? (if yes how ?) (ex : After many try, if i try to put a custom "mymod/script/worldgen_main.lua", the game don't want use it) (PS : "LevelPreInitAny API" don't help me for all what i want do) It sounds like you're wanting to change the appearance of specific rooms and/or tasks. However, it also sounds like you do not have enough lua coding skills to understand what how to accomplish it. It would be best to lay out exactly what you're trying to accomplish because with the little information you've given it seems that LevelPreInitAny does in fact do what you want it to do. Link to comment https://forums.kleientertainment.com/forums/topic/56012-custom-worldgen_mainlua-in-mod/#findComment-653020 Share on other sites More sharing options...
Rokin Posted July 9, 2015 Author Share Posted July 9, 2015 @Rokin, you were very unclear in your original post. I did my best to decipher what you meant, but honestly you are giving no information beyond you want to edit world generation. From a mod perspective that is done via 'modworldgenmain.lua' the files. You wrote: It sounds like you're wanting to change the appearance of specific rooms and/or tasks. However, it also sounds like you do not have enough lua coding skills to understand what how to accomplish it. It would be best to lay out exactly what you're trying to accomplish because with the little information you've given it seems that LevelPreInitAny does in fact do what you want it to do. I try to do my best for English, sorry if I write very badly. I have already written alot of "advanced" lua/python/bash etc files for mmo, minecraft, linux & co, but if you are not too stupid, you can keep your judgment and sarcasm for you and try to understand that learn and start modding a "niche game" for the first time without a good api doc and not enought informations available is not easy. So, you can just ask me more details if I write badly if you want try to help me or hit the road. A big part of the code is already done in the file worldgenmain.lua (random generation and on the fly for the number and the content of the rooms and tasks) but for example I have problems to know how to properly place my code to retrieve and use my "parameters.world_gen_choices" in the worldgenmain.lua. I do not ask anyone to write the mod, I seek only to know, as i try to explain better in the second post, if it's possible to use a copy of the original "worldgen_main.lua" in my mod folder and use it during the World Generation which is quite solve my problems like this. Link to comment https://forums.kleientertainment.com/forums/topic/56012-custom-worldgen_mainlua-in-mod/#findComment-653045 Share on other sites More sharing options...
Kzisor Posted July 9, 2015 Share Posted July 9, 2015 (edited) @Rokin, here is what you can accomplish with the mod API.AddLevelPreInitAny(function(level) -- level.id -- string -- level.name -- string -- level.desc -- string -- level.overrides -- table -- level.tasks -- table -- level.numoptionaltasks -- integer -- level.optionaltasks -- table -- level.setpieces -- table -- level.numrandom_set_pieces -- integer -- level.random_set_pieces -- table -- level.ordered_story_setpieces -- table -- level.required_prefabs -- table end) AddTaskPreInit(task_name, function(task) -- task.locks -- table -- task.keys_given -- table -- task.room_choices -- table -- task.room_bg -- GROUND -- task.background_room -- string -- task.colour -- table end) AddRoomPreInit(room_name, function(room) -- room.colour -- table -- room.value -- GROUND -- room.tags -- table -- room.contents -- table -- room.contents.countstaticlayouts -- table -- room.contents.countprefabs -- table -- room.contents.distributepercent -- integer -- room.contents.distrubuteprefabs -- table end) Edited July 9, 2015 by Kzisor Link to comment https://forums.kleientertainment.com/forums/topic/56012-custom-worldgen_mainlua-in-mod/#findComment-653058 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