Jump to content

Recommended Posts

Thanks Mobbstar with my last question, I start to learn about mods and I promise bring some interesting mods someday, but now I want to understand how the game's world works and Im studing the existing prefabs, How can I access to the code of the prefabs of the game?, im looking for the science machine, meat effigy, shadow manipulator and the firepit

@Rily Have you looked through the games "scripts" folder? You can find all the lua code there.

"..\scripts\prefabs\" contains all the prefabs' code files.

scienceprototyper.lua - Science machine

resurrectionstatue.lua - Meat effigy

magicprototyper.lua - Shadowmanipulator

firepit.lua - Firepit

@Rily Have you looked through the games "scripts" folder? You can find all the lua code there.

"..\scripts\prefabs\" contains all the prefabs' code files.

scienceprototyper.lua - Science machine

resurrectionstatue.lua - Meat effigy

magicprototyper.lua - Shadowmanipulator

firepit.lua - Firepit

Thanks a lot, now, I was looking in the guides and I found so much content about  create new things but how about of modify the existing ones? which guides can give me more information about change the existing prefabs?

I'm kind of bad at mods but to my understanding you make a mod that effectively replaces the .lua of whatever item you are modyfying for instance to remove the spoiling effect of the pumpkin lantern, you'd effectively need to delete these lines:

local function OnDropped(inst)
    inst.components.perishable:StartPerishing()
    if not TheWorld.state.isday then
        fade_in(inst)
    end
 
But messing with .lua-s is not actual modding so yeah good luck

 

I'm kind of bad at mods but to my understanding you make a mod that effectively replaces the .lua of whatever item you are modyfying for instance to remove the spoiling effect of the pumpkin lantern, you'd effectively need to delete these lines:

local function OnDropped(inst)
    inst.components.perishable:StartPerishing()
    if not TheWorld.state.isday then
        fade_in(inst)
    end
 
But messing with .lua-s is not actual modding so yeah good luck

 

ok,I got it, but, should I literally replace the .lua file?, the mod can not do something like lock the original .lua file or something?, I Want to make a simple mod, not a permanent change to the game, another thing that I  want is to lock some recipes permanently for some characters, it is possible? for example make Wigfrid unable to build a science machine

@Rily PostInit functions are what you're looking for.

You are able to override files by giving them the same name and relative path in your mod, but I wouldn't recommend it. You can achieve almost everything you'd want to with post init functions, and it's much cleaner and reliable that way.

@Rily PostInit functions are what you're looking for.

You are able to override files by giving them the same name and relative path in your mod, but I wouldn't recommend it. You can achieve almost everything you'd want to with post init functions, and it's much cleaner and reliable that way.

Thanks, that is exactly what im looking for

then, my best suggestion is to look at a simple mod and copy parts of it for yourself(don't forget to use the same version), another thing to understand are scenarios, components and features.

For making some recipe unavailable I'd go look at how Wickerbottom has some recipes.

She has a science level buff for builder.lua in components.

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