DuleVenus Posted September 28, 2017 Share Posted September 28, 2017 I'm working on a custom character and want to have it where when it kills anything (rabbit, spider. etc.) I have no idea what I'm doing. Any help would be greatly appreciated. Thanks in advance. Link to comment https://forums.kleientertainment.com/forums/topic/82437-gain-sanity-when-you-kill-monsters/ Share on other sites More sharing options...
RedHairedHero Posted September 28, 2017 Share Posted September 28, 2017 (edited) 18 hours ago, DuleVenus said: I'm working on a custom character and want to have it where when it kills anything (rabbit, spider. etc.) I have no idea what I'm doing. Any help would be greatly appreciated. Thanks in advance. You'll need an event listener which you'll put into your Master Postinit function and a function outside of that to perform your sanity gain on each kill. Here's an example. local function onkilled(inst) inst.components.sanity:DoDelta(5) -- You can change the 5 out for whatever number you'd like. end inst:ListenForEvent("killed", onkilled) Edited September 28, 2017 by RedHairedHero Link to comment https://forums.kleientertainment.com/forums/topic/82437-gain-sanity-when-you-kill-monsters/#findComment-958958 Share on other sites More sharing options...
DuleVenus Posted September 29, 2017 Author Share Posted September 29, 2017 I tried this and a couple of my own ideas to fix it. Every time something dies in the game near me this pops up Link to comment https://forums.kleientertainment.com/forums/topic/82437-gain-sanity-when-you-kill-monsters/#findComment-959016 Share on other sites More sharing options...
ptr Posted September 29, 2017 Share Posted September 29, 2017 where did you put the given code? You'd better provide some related code to see if anything is wrong. Link to comment https://forums.kleientertainment.com/forums/topic/82437-gain-sanity-when-you-kill-monsters/#findComment-959033 Share on other sites More sharing options...
RedHairedHero Posted September 29, 2017 Share Posted September 29, 2017 1 hour ago, DuleVenus said: I tried this and a couple of my own ideas to fix it. Every time something dies in the game near me this pops up If you're using the code I provided it looks like you are calling "onkill" which will be the function name. Make sure the function you're calling and the event listener match. Link to comment https://forums.kleientertainment.com/forums/topic/82437-gain-sanity-when-you-kill-monsters/#findComment-959035 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