Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Cunning fox

Help with sounds

Recommended Posts

Cunning fox    63

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
DarkKingBoo    215

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

 

Share this post


Link to post
Share on other sites
Cunning fox    63
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