Cunning fox Posted February 11, 2017 Share Posted February 11, 2017 Hey all! I'm trying to make shop mod. But I have some problem with sounds... If you come closer to shopkeeper, he'll say you smth with sound. When you go back, he'll say you smth too. BUT if you'll do that faster, he won't shut up. Here's video: My prefab here: http://pastebin.com/ZMXzyRtf I realy need help, and I don't know what to do... Thanks everyone for trying to help! 1 Link to comment Share on other sites More sharing options...
Leonardo Cox Posted February 12, 2017 Share Posted February 12, 2017 Try this: local function OnTurnOn(inst, isnight) if inst.components.talker then inst.components.talker:Say(TUNING.CLOSETEXT) if inst.SoundEmitter:PlayingSound("talk") then inst.SoundEmitter:KillSound("talk") end inst.SoundEmitter:PlaySound("dontstarve/maxwell/talk_LP_world6", "talk") inst:DoTaskInTime(2, function(inst) inst.SoundEmitter:KillSound("talk") end) end end local function OnTurnOff(inst, isnight) if inst.components.talker then inst.components.talker:Say(TUNING.GONETEXT) if inst.SoundEmitter:PlayingSound("talk") then inst.SoundEmitter:KillSound("talk") end inst.SoundEmitter:PlaySound("dontstarve/maxwell/talk_LP_world6", "talk") inst:DoTaskInTime(2, function(inst) inst.SoundEmitter:KillSound("talk") end) end end Link to comment Share on other sites More sharing options...
Cunning fox Posted February 12, 2017 Author Share Posted February 12, 2017 4 hours ago, DarkKingBoo said: Try this: local function OnTurnOn(inst, isnight) if inst.components.talker then inst.components.talker:Say(TUNING.CLOSETEXT) if inst.SoundEmitter:PlayingSound("talk") then inst.SoundEmitter:KillSound("talk") end inst.SoundEmitter:PlaySound("dontstarve/maxwell/talk_LP_world6", "talk") inst:DoTaskInTime(2, function(inst) inst.SoundEmitter:KillSound("talk") end) end end local function OnTurnOff(inst, isnight) if inst.components.talker then inst.components.talker:Say(TUNING.GONETEXT) if inst.SoundEmitter:PlayingSound("talk") then inst.SoundEmitter:KillSound("talk") end inst.SoundEmitter:PlaySound("dontstarve/maxwell/talk_LP_world6", "talk") inst:DoTaskInTime(2, function(inst) inst.SoundEmitter:KillSound("talk") end) end end Yeah, it's working nicely! Thanks! 1 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