Sorry for digging up this old thread.
I've included your script in my mod and it works great.
I want it to be like in the main game, sometimes the earthquake gets triggered just for atmospheric reasons. But the cut-off sound is poison for the atmosphere, so if tried some things:
I'm simply fading it out by using more silent versions of earthquake_stop:
Code: Select all
defineSound{
name = "earthquake_stop",
filename = "assets/samples/env/earthquake_01.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 6,
}
defineSound{
name = "earthquake_stop1",
filename = "assets/samples/env/earthquake_01.wav",
loop = false,
volume = 0.7,
minDistance = 1,
maxDistance = 6,
}
defineSound{
name = "earthquake_stop2",
filename = "assets/samples/env/earthquake_01.wav",
loop = false,
volume = 0.4,
minDistance = 1,
maxDistance = 6,
}
defineSound{
name = "earthquake_stop3",
filename = "assets/samples/env/earthquake_01.wav",
loop = false,
volume = 0.2,
minDistance = 1,
maxDistance = 6,
}
defineSound{
name = "earthquake_stop4",
filename = "assets/samples/env/earthquake_01.wav",
loop = false,
volume = 0.1,
minDistance = 1,
maxDistance = 6,
}
And triggering them inside your script to generate a echo or fake fadeout:
Code: Select all
function quakeStart()
spawn ("timer",party.level,0,0,0,"quakeDustTimer"):setTimerInterval(0.2):addConnector("activate","random_Earthquake","quakeDust"):activate()
party:shakeCamera(math.random(0.2)+0.1, 10)
playSound("earthquake_stop")
end
quakeTick = 1
function quakeDust()
local dustTargY = {-3, -2, -1, 0, 0, 1, 2, 3}
local dY = dustTargY[math.random(1, #dustTargY)]
local dustTargX = {-3, -2, -1, 0, 0, 1, 2, 3}
local dX = dustTargX[math.random(1, #dustTargX)]
if quakeTick < 40 then
spawn("fx", party.level, party.x+dX, party.y+dY, 0):setParticleSystem("earthquake_dust")
if quakeTick==10 then playSound("earthquake_stop1") end
if quakeTick==14 then playSound("earthquake_stop2") end
if quakeTick==21 then playSound("earthquake_stop3") end
if quakeTick==29 then playSound("earthquake_stop4") end
else
quakeDustTimer:deactivate()
quakeDustTimer:destroy()
quakeTick = 1
return
end
quakeTick = quakeTick + 1
end
Sounds good so far, perhaps it can be optimized with less versions of earthquake_stop.