Salted Poultry Posted January 14, 2021 Share Posted January 14, 2021 I'm gonna try and make my first mod, so I'm gonna try and start with something simple, like making Monster Lasagna restore 85 hunger. How can I do this? Link to comment Share on other sites More sharing options...
Thomas Die Posted January 14, 2021 Share Posted January 14, 2021 AddPrefabPostInit("prefab_name", fn) --add code to a existing prefab AddPrefabPostInit("prefab_name", function(inst) end) --can do it this way local function Code (inst) end AddPrefabPostInit("prefab_name", Code) AddPrefabPostInit("prefab_name_2", Code) --or this way, it works better for multiple you can also replace the prefab as a whole but this kinda ruins any comparability to other mods AddPrefabPostInit("prefab_name",function (inst) if not GLOBAL.TheWorld.ismastersim then return inst end --add this to change specific component stuff, i'm not sure but it has something to do with client and server stuff end) AddPrefabPostInit("prefab_name",function (inst) if not GLOBAL.TheWorld.ismastersim then return inst end --you can use these to change whichever stat you want using components, for this one specificly the hunger value --inst:AddComponent("edible") --inst.components.edible.healthvalue = data.health inst.components.edible.hungervalue = 85 --has to be a number --inst.components.edible.sanityvalue = data.sanity or 0 end) prefab name is basically the name if the item as sometimes the name in code is different from the name of the item you can easily find the code name on the don't starve wiki, bless their souls and whatnot. IMPORTANT: this will be in your modmain i'm not that good at explaining things but hopefully this works 1 Link to comment Share on other sites More sharing options...
Lokoluna Posted January 14, 2021 Share Posted January 14, 2021 5 hours ago, thomas4846 said: snip Thank you so much, every other psot didn't mention this, so helpful!! if not GLOBAL.TheWorld.ismastersim then return inst end, 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