st.amnesier Posted February 4, 2019 Share Posted February 4, 2019 Hello! I'm making a character mod and have some issues. I want to make him masochist and gain sanity when getting hit. Any ideas how to do this? Link to comment Share on other sites More sharing options...
Ultroman Posted February 4, 2019 Share Posted February 4, 2019 -- Put this above your character's fn(). local gainSanityOnHit = function(inst) if inst.components.sanity then inst.components.sanity:DoDelta(5) end end -- Put this at the bottom of your character's fn() to gain sanity when attacked. inst:ListenForEvent("attacked", gainSanityOnHit) -- Add this as well, if your character also likes blocking attacks. inst:ListenForEvent("blocked", gainSanityOnHit) Link to comment Share on other sites More sharing options...
st.amnesier Posted February 4, 2019 Author Share Posted February 4, 2019 1 hour ago, Ultroman said: -- Put this above your character's fn(). local gainSanityOnHit = function(inst) if inst.components.sanity then inst.components.sanity:DoDelta(5) end end -- Put this at the bottom of your character's fn() to gain sanity when attacked. inst:ListenForEvent("attacked", gainSanityOnHit) -- Add this as well, if your character also likes blocking attacks. inst:ListenForEvent("blocked", gainSanityOnHit) actually worked! thank you so much! ^w^ Link to comment Share on other sites More sharing options...
Ultroman Posted February 4, 2019 Share Posted February 4, 2019 You are very welcome 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