Jump to content

Recommended Posts

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!:) 

  • Like 1
Link to comment
https://forums.kleientertainment.com/forums/topic/73965-help-with-sounds/
Share on other sites

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

 

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!

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...