Jump to content

Recommended Posts

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 )
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.

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.

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?

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...