Majo_Ellen Posted February 1, 2020 Share Posted February 1, 2020 (edited) I want to make a character who slowly loses health when standing idle or sleeping. I'm not quite sure how to go about it doing something like that, however. Would I put such a feature in mod main, a prefab, or a component? It would not effect while walking/attacking/etc movements.Don't worry, the character has an absurdly large HP pool to compensate this flaw, let's just say he's a little cursed. Edited February 1, 2020 by Majo_Ellen Link to comment Share on other sites More sharing options...
Desblat Posted February 1, 2020 Share Posted February 1, 2020 into character fn: inst:DoPeriodicTask(3, function() if inst.sg:HasStateTag("idle") then inst.components.health:DoDelta(-1) end end Link to comment Share on other sites More sharing options...
Majo_Ellen Posted February 2, 2020 Author Share Posted February 2, 2020 There should be a little ) after the last end! But it works! Yes yes! Thank you very kindly! That was just what I needed. With this, the basis of the coding for this character is complete...! Now then, on to my next conquest..! (While the art comes in...) 1 Link to comment Share on other sites More sharing options...
Desblat Posted February 2, 2020 Share Posted February 2, 2020 8 hours ago, Majo_Ellen said: There should be a little ) after the last end! But it works! Yes yes! Thank you very kindly! That was just what I needed. With this, the basis of the coding for this character is complete...! Now then, on to my next conquest..! (While the art comes in...) Good luck 1 1 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