Draukel Posted September 13, 2017 Share Posted September 13, 2017 Hello everyone, one again I ask about sanity stuff. For this question is just if I can code something like "I gain 10 sanity point when I take damage" (don't ask me what character I made, that's...Weird...But in don't starve universe it's normal I guess), I know it's possible, I've successfully coded an effect for loose sanity in day and gain it in night. Or maybe I'm wrong? I don't know, but I prefer to try. If you think you have the answer, a reply is welcome. Don't be afraid, I don't bite, not every time èwé Link to comment Share on other sites More sharing options...
Lumina Posted September 13, 2017 Share Posted September 13, 2017 Yes. You need to add a "listenforevent" in your character masterpostinit, with the even of being attacked (don't remember which one it's exactly), and make your custom function that will trigger when attacked. Link to comment Share on other sites More sharing options...
Draukel Posted September 13, 2017 Author Share Posted September 13, 2017 5 minutes ago, Lumina said: Yes. You need to add a "listenforevent" in your character masterpostinit, with the even of being attacked (don't remember which one it's exactly), and make your custom function that will trigger when attacked. So I do Quote inst:ListenForEvent("something I didn't found yet", function(data) if data.cause == inst.prefab then local delta = 10 -- amount inst.components.health:DoDelta(delta) end Right? 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