happyforever94 Posted May 1, 2016 Share 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 (_ _") Link to comment https://forums.kleientertainment.com/forums/topic/66873-help-coderegen-hp-when-your-hunger-is-higher-than-100/ Share on other sites More sharing options...
Mobbstar Posted May 1, 2016 Share 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) Link to comment https://forums.kleientertainment.com/forums/topic/66873-help-coderegen-hp-when-your-hunger-is-higher-than-100/#findComment-764143 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