Yakuzashi Posted May 19, 2018 Share Posted May 19, 2018 Hello, I have made 2 simple mods to DST based on Extended Sample Character Template and I want to take one step further and make my third character. I am wondering how to add health regeneration when it is near campfire. I do not have experience and knowledge about programming in LUA, so my fellow modders (if somebody like me can be called that way) could you help me with this problem. I would be grateful for example of code line like mentioned before so I can do it myself. Thank you for your precious time. (Sorry for my English too) Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted May 19, 2018 Share Posted May 19, 2018 Here: local master_postinit = function(inst)--reference on where it goes local function fireheal(inst) local x,y,z = inst.Transform:GetWorldPosition() local max_rad = 3 --you have to be close to heal from the fire local ents = TheSim:FindEntities(x,y,z, max_rad, nil, nil, {"campfire"}) --only look for campfires not forest fires for k,v in pairs(ents) do inst.components.health:DoDelta(1,1) --heal 1 end end inst:DoPeriodicTask(5, fireheal, nil, inst) --do the heal every five seconds Read the notes so you can modify it to your liking, and not get a error from including the reference. This code goes into your character's lua file. Link to comment Share on other sites More sharing options...
Yakuzashi Posted May 19, 2018 Author Share Posted May 19, 2018 Thank you very much. I really appreciate your help 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