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 https://forums.kleientertainment.com/forums/topic/118440-sanity-loss-when-starting-fires/ Share on other sites More sharing options...
penguin0616 Posted May 24, 2020 Share Posted May 24, 2020 (edited) 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) Edited May 24, 2020 by penguin0616 1 Link to comment https://forums.kleientertainment.com/forums/topic/118440-sanity-loss-when-starting-fires/#findComment-1335947 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