halfrose Posted June 3, 2018 Share Posted June 3, 2018 Hello. Current thing I'm trying to figure out is how to remove the 'hunger' noise when a character is close to starve. I know it is listed in the stategraph, and while I am calling the stategraph sgwilson, I can't seem to kill the sound. AddStategraphPostInit("wilson", function(sg) local _funnyidle_onenter = sg.states.funnyidle.onenter sg.states.funnyidle.onenter = function(inst) _funnyidle_onenter(inst) if inst:HasTag("mytag") and inst.components.hunger:GetPercent() < TUNING.HUNGRY_THRESH then inst.SoundEmitter:KillSound("dontstarve/wilson/hungry") end end) end This is the basis that i was doing bu that doesn't really do anything If Anyone has any suggestion I would highly appreciate! Thank you for reading! Link to comment Share on other sites More sharing options...
IronHunter Posted June 3, 2018 Share Posted June 3, 2018 There is a strong possibility that the sound hasn't started playing yet when your function is called. I did some experiments trying to cancel the eat sound for a coach mod a while back with my results below. Potentially doing a dotaskintime(0, etc will delay your kill sound task to the next frame which means sounds will still play for 1/30 of a second potentially. However I am pretty certain that you might get a crash as I did. The original stategraph is expecting a sound to kill upon leaving the state with no safeguards programmed... The best method I have found is to just make a cloned state minus the sound that only plays when your prefab would enter this state and return the original if not your prefab. Link to comment 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