This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.


Sanity loss when starting fires?

Recommended Posts

Feanara    1

I want my custom character to lose sanity every time they light a fire (excluding adding fuel to a firepit or crafting a torch). But the fire mechanic is confusing me.

I thought it would be simple, just adding the line inst.components.lighter:SetOnLightFn(firefn). But I guess characters don't have the 'lighter' component, instead that goes into the torch itself. 

How do I detect when my character lights something on fire using a torch?

Share this post

Link to post
Share on other sites
penguin0616    1101

I would suggest you take a look at the component "Lighter". Whenever you light something with a lighter, it calls :Light() (excluding whacking stuff with a torch)

You could replace the Lighter function to have a concrete indicator of when you light something.

An example:

AddComponentPostInit("lighter", function(self)
	local oldLight = self.Light
	function self:Light(...)
		print("oh hey I lit something on fire")
		-- deduct sanity here
		return oldLight(self, ...)


Share this post

Link to post
Share on other sites