Jump to content

Recommended Posts

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 by RedHairedHero
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

image.thumb.png.41c21c7f3d6e2f247f960bd636dc0cfa.png

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...