Gabre Posted December 12, 2016 Share Posted December 12, 2016 I am currently working on my first charackter for DST, but I am really new to lua and have no real idea on how anything works yet. I am adding stuff step by step, but now I am really lost. The charackter needs to be able to consume nightmarefule and regenerate hunger, sanity, and health by doing so. Everything I found on this were far not detailed and/or basic enough for my knoweledge. I would be thrilled if someone would do a step by step explaination to what I have to do where. (Including stuff like "Put it in the master_postinit" or "Place it anywhere BUT NOT in the master_postinit" Link to comment Share on other sites More sharing options...
Aquaterion Posted December 12, 2016 Share Posted December 12, 2016 (edited) --PUT THE CODE BELOW IN MODMAIN.LUA local FOODTYPE = GLOBAL.FOODTYPE FOODTYPE.SHADOW = "SHADOW" AddComponentPostInit("eater", function(self) function self:SetCanEatShadows() table.insert(self.preferseating, FOODTYPE.SHADOW) table.insert(self.caneat, FOODTYPE.SHADOW) self.inst:AddTag(FOODTYPE.SHADOW.."_eater") end end) AddPrefabPostInit("nightmarefuel", function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.SHADOW inst.components.edible.healthvalue = 5--CHANGE THESE 3 VALUES TO ANYTHING YOU WANT inst.components.edible.hungervalue = 10 inst.components.edible.sanityvalue = 15 end) --PUT THE CODE BELOW IN YOUR CHARACTER.LUA (in master_postinit) inst.components.eater:SetCanEatShadows() don't forget to adjust the healing values for eating the fuel Edited December 12, 2016 by Aquaterion 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