Goregonzola Posted January 19, 2021 Share Posted January 19, 2021 (edited) Hey-hey! No tilky-talky, I straight get to the point: Let's say my character has a max Health of 200. Is it possible to set his spawining/starting Health to 100? Thanks in advance! Edited January 20, 2021 by BillTheCipher Link to comment Share on other sites More sharing options...
penguin0616 Posted January 19, 2021 Share Posted January 19, 2021 Health:SetCurrentHealth(amount) 1 Link to comment Share on other sites More sharing options...
Thomas Die Posted January 19, 2021 Share Posted January 19, 2021 inst.OnNewSpawn = function(inst) --the code end for specifically a new spawn the esctemplate should come with a bit of that code Link to comment Share on other sites More sharing options...
Goregonzola Posted January 19, 2021 Author Share Posted January 19, 2021 So it should look something like this, right? Quote Inside local master_postinit = function(inst) inst.OnNewSpawn = function(inst) Health:SetCurrentHealth(150) end I might do something wrong, but this coding crashes the game (variable 'Health' is not declared). What did I missed? Link to comment Share on other sites More sharing options...
penguin0616 Posted January 19, 2021 Share Posted January 19, 2021 @BillTheCipher Health is supposed to be your player's health component. 2 Link to comment Share on other sites More sharing options...
Goregonzola Posted January 20, 2021 Author Share Posted January 20, 2021 @penguin0616 I feel like a total moron : ( How should the final coding look like? Link to comment Share on other sites More sharing options...
Thomas Die Posted January 20, 2021 Share Posted January 20, 2021 (edited) Same way you find current health just replace it with :SetCurrentHealth() Edited January 20, 2021 by thomas4846 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