Jump to content

Gain sanity on hit


Recommended Posts

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

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

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
 Share

×
  • Create New...