Feanara Posted May 22, 2020 Share Posted May 22, 2020 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? Link to comment Share on other sites More sharing options...
penguin0616 Posted May 24, 2020 Share Posted May 24, 2020 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, ...) end end) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
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.