makar5000

help
Help with sounds

3 posts in this topic

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

Share this post


Link to post
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

 

2 people like this

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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