
1 Timer Called: soundtimer - seconds = 30
1 Counter Called: finalcounter - Value = 0
A plate is connected to timer and the timer is connected to the function: function horrorsounds() and the counter can be on any level or just one level. Here is the Code:
Code: Select all
function horrorsounds()
if finalcounter:getValue() == 0 then
xpos = 0
ypos = 0
local random = math.random(2)
if random == 1 then
xpos = party.x + 1 + math.random(4)
else
xpos = party.x - 1 - math.random(4)
end
local random = math.random(2)
if random == 1 then
ypos = party.y + 1 + math.random(4)
else
ypos = party.y - 1 - math.random(4)
end
local plev = party.level
local random = math.random(10)
if random == 1 then
playSoundAt("mine_horror01",plev,xpos,ypos)
elseif random == 2 then
playSoundAt("mine_horror02",plev,xpos,ypos)
elseif random == 3 then
playSoundAt("mine_horror03",plev,xpos,ypos)
elseif random == 4 then
playSoundAt("mine_horror04",plev,xpos,ypos)
elseif random == 5 then
playSoundAt("mine_horror05",plev,xpos,ypos)
elseif random == 6 then
playSoundAt("mine_horror06",plev,xpos,ypos)
elseif random == 7 then
playSoundAt("mine_horror07",plev,xpos,ypos)
elseif random == 8 then
playSoundAt("mine_horror08",plev,xpos,ypos)
elseif random == 9 then
playSoundAt("mine_horror09",plev,xpos,ypos)
elseif random == 10 then
playSoundAt("mine_horror10",plev,xpos,ypos)
end
local random = math.random(40) + 20
soundtimer:setTimerInterval(random)
end
end