happyforever94 0 Report post Posted May 1, 2016 Hi everyone, I really love the idea that create my own character in DST, every parts is complete but i still want add some unique ability to my character. Here are my ideas: 1) Health star regen slowly when your hunger is higher than 100 2) Regen 5 sanity whenever the character eating food 3) Move very slow when your hunger is lower than 20% I try to add some code in prefabs\test.Lua with my little knowledge about coding but always got error when creating new world. Can anyone help me (_ _") Share this post Link to post Share on other sites
Mobbstar 14132 Report post Posted May 1, 2016 You should use DoPeriodicTask() for #1 and #3. e.g.: inst:DoPeriodicTask( 2 ,function() --code here end) #2 can be done using the "oneat" event. inst:ListenForEvent( "oneat", function() --code here end) You can raise stats using this function: inst.components.sanity:DoDelta(5) You can also use TUNING.SANITY_TINY instead of 5, which can be dynamically tuned by other mods and updates. For quiet raising, use: inst.components.health:DoDelta(1, true) Share this post Link to post Share on other sites