epsylon77 Posted July 29, 2017 Share Posted July 29, 2017 I don't find how to do for my character earn life when he attack and earn sanity when he mined thx for helping Link to comment Share on other sites More sharing options...
Lumina Posted July 29, 2017 Share Posted July 29, 2017 Try looking at wathgrith.lua code (wigfrid) For example, my character is loosing sanity when killing animals, i did this : inst:ListenForEvent("killed", onkilled) (In the master_postinit) local function onkilled(inst, data) if data.victim:HasTag("animal") then inst.components.sanity:DoDelta(-TUNING.SANITY_SMALL) end end So when my character is killing a creature with the animal tag, she will lose some sanity. Just change "killed" for the attack event, and do something like inst.components.health:DoDelta(TUNING.HEALTH_SMALL) (not tested) Take a look at tuning.lua (in script), for example of value. Usually, something like : inst.components.health:DoDelta(20) should work too. Good luck. 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