Shadow51311 Posted August 11, 2015 Share Posted August 11, 2015 So I am attempting to help my girlfriend write code for a mod she wants to make. I have coding experience just not with Lua. This is the first stuff I've tried to do with Lua. I have cannabilized code from a bunch of other people for things like Night Vision, custom Sanity mechanics, and diet restrictions. The problem I am running into is I have not seen an explanation of where I need to put this code. I have tried putting the code for Night Vision in both marceline.lua and modmain.lua. When I had it in marceline.lua, nothing changed. So I moved the code to modmain.lua and now when I try to resume the world I am using as a testing ground, the game doesn't load. I end up stuck on the loading screen. I am also not very clear on the whole GetWorld() vs TheWorld thing... This is the code I am using: -- Night-vision inst:ListenForEvent( "nighttime", function() inst.entity:AddLight() inst.Light:Enable(true) inst.Light:SetRadius(40) inst.Light:SetFalloff(.5) inst.Light:SetIntensity(0.9) inst.Light:SetColour(245/255,255/255,245/255) end, TheWorld ) Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/ Share on other sites More sharing options...
StarmanUltra Posted August 12, 2015 Share Posted August 12, 2015 That stuff all goes in the character.lua, within the master_postinit function Download some character mods on the steam workshop, you can find a lot of useful stuff there. Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662679 Share on other sites More sharing options...
Maris Posted August 12, 2015 Share Posted August 12, 2015 What is her name? Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662701 Share on other sites More sharing options...
DarkXero Posted August 12, 2015 Share Posted August 12, 2015 I am also not very clear on the whole GetWorld() vs TheWorld thing GetWorld() is a function from Don't Starve that returns you the world prefab.TheWorld is a Don't Starve Together variable that references the world prefab of the guy running the code.(The host's TheWorld is different from a client's TheWorld which is also different from another client's TheWorld) "nighttime" This event isn't pushed in DST's world, or anywhere. Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662743 Share on other sites More sharing options...
Shadow51311 Posted August 12, 2015 Author Share Posted August 12, 2015 Thank you guys and/or girls. I got the Night Vision working. Just had to remove the ListenForEvent wrapper and then it worked. I will probably be back when I have issues getting diet restrictions and sanity mechanics to work. If anybody is interested in creating art assets for us, that would be awesome. Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662804 Share on other sites More sharing options...
Shadow51311 Posted August 12, 2015 Author Share Posted August 12, 2015 Soo.... I did something. I have no idea what I did, but Marceline no longer shows up on the character select screen when I load into the world. The mod compiles when I start the game and when I manually run the autocompiler, but she doesn't show up in the character select screen. Any ideas? Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662827 Share on other sites More sharing options...
Doctor Donna Posted August 12, 2015 Share Posted August 12, 2015 "Oh Marceline.. why did you so meaan?" Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662845 Share on other sites More sharing options...
Doctor Donna Posted August 12, 2015 Share Posted August 12, 2015 Soo.... I did something. I have no idea what I did, but Marceline no longer shows up on the character select screen when I load into the world. The mod compiles when I start the game and when I manually run the autocompiler, but she doesn't show up in the character select screen. Any ideas? did you choose the mod before you start a new world? Link to comment https://forums.kleientertainment.com/forums/topic/57011-adding-custom-mechanics-to-mod-characters/#findComment-662847 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