Kzisor Posted March 16, 2015 Share Posted March 16, 2015 (edited) -- OUTDATED -- Edited July 18, 2015 by Kzisor Link to comment Share on other sites More sharing options...
afetogbo Posted March 18, 2015 Share Posted March 18, 2015 (edited) Okay I am trying to use this to put 1 layout on the level. and i want it to go in any task. is there an easy way to populate tasks = {} will all possible tasks including those from mods? also can you do this sort of thing with prefabs. like a unique world object that is spawned at random on the level. Edited March 18, 2015 by afetogbo Link to comment Share on other sites More sharing options...
Kzisor Posted March 18, 2015 Author Share Posted March 18, 2015 (edited) @afetogbo, the answer to your first question is yes there is an easy way of doing that.require("map/tasks")local tasks = tasks.sampletasksThis is how tasks work. map/tasks.lualocal tasklist = {}function AddTask(name, data) table.insert(tasklist, Task(name, data))endtasks = { sampletasks = tasklist, oneofeverything = everything_sample, GetTaskByName = GetTaskByName,} To expand on what I mean, is you will need to iterate through the tasks obtaining the name of each and inserting them in to a new table. require("map/tasks")local tasklist = tasks.sampletaskslocal task_names = {} for _, task in pairs(tasklist) do table.insert(task_names, task.id)end The answer to your second question is irrelevant to the topic at hand. Spawning unique world objects at random can be done in a similar method. I will be creating a new tutorial for that with wrapper sample code to make it easy to do. However, I will say it is possible and like creating Set Pieces traditionally it requires a massive amount of code to do it correctly. Keep your eye on the forums over the next couple of days for a fully working tutorial on spawning world objects. Edit:Expanded on what I meant about how to properly obtain task names. Edited March 19, 2015 by Kzisor Link to comment Share on other sites More sharing options...
afetogbo Posted March 18, 2015 Share Posted March 18, 2015 I put the second code block in my modwoldgenmain.lua and i get this error modworldgenmain.lua"]:135: attempt to index global 'tasks' (a nil value) line 135 is local tasklist = tasks.sampletasks before this i was trying to access tasklist from tasks.lua but I couldn't figure a way of doing it. That makes me feel good that I was on the right track although still a noob at all this. Link to comment Share on other sites More sharing options...
Kzisor Posted March 19, 2015 Author Share Posted March 19, 2015 I put the second code block in my modwoldgenmain.lua and i get this error modworldgenmain.lua"]:135: attempt to index global 'tasks' (a nil value) line 135 is local tasklist = tasks.sampletasks before this i was trying to access tasklist from tasks.lua but I couldn't figure a way of doing it. That makes me feel good that I was on the right track although still a noob at all this. I've modified the actual code to change local tasks = tasks.sampletasks into local task_names = tasks.sampletasks. You may have to put GLOBAL.tasks.sampletasks to make it work right if you're not using my mod environment from the downloads page. Link to comment Share on other sites More sharing options...
Kzisor Posted March 23, 2015 Author Share Posted March 23, 2015 Update:Wrapper functions have been updated to correctly spawn based on the percentage change per room. Link to comment Share on other sites More sharing options...
Kzisor Posted April 7, 2015 Author Share Posted April 7, 2015 Update:Wrapper functions have been updated to correctly spawn the proper amount of set pieces. Link to comment Share on other sites More sharing options...
Lampofulmine Posted May 19, 2015 Share Posted May 19, 2015 So, have a question... What if you create a new ground texture which is not present in the current DS ground textures file ?! I just want to use that speciic texture to base my set piece, how can i do that ? Link to comment Share on other sites More sharing options...
Kzisor Posted May 19, 2015 Author Share Posted May 19, 2015 @Lampofulmine, I have not tested that out, however, you would need to look into the following files: prefabs/minimap.luascripts/worldtiledefs.luamap/terrain.lua Determine how those work and then try to replicate the result. Link to comment Share on other sites More sharing options...
Lampofulmine Posted May 19, 2015 Share Posted May 19, 2015 @Kzisor, mmmm... i see, so i guess that i definitely need to know coding in case a want to do this right ?! Link to comment Share on other sites More sharing options...
Kzisor Posted May 19, 2015 Author Share Posted May 19, 2015 @Lampofulmine, yeah there isn't a quick fix for it, the only other thing you could do is look at wicker and see how Up and Away or Hero's in the Dark apply their ground textures to the game. Link to comment Share on other sites More sharing options...
Lampofulmine Posted May 20, 2015 Share Posted May 20, 2015 @Kzisor, thanks for the help, I'll try to see what can they tell me about this ! Link to comment Share on other sites More sharing options...
Kzisor Posted July 4, 2015 Author Share Posted July 4, 2015 This guide has been updated. 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