@name Footsteps
@inputs 
@outputs MV Pitch Playing
@persist
@trigger all

runOnTick(1)

Sound = "ambient/siren.wav"

Own = owner()

Vel = Own:vel()
MV = max(abs(Vel:x()), abs(Vel:y()), abs(Vel:z()))

Pitch = clamp((MV * 0.2 + 25),20,250)

if(first() | duped()) { Own:soundPlay(1,0,Sound) }

if($MV != 0 & MV > 0 & !Playing)
{
    owner():soundPlay(1,0,Sound)
    Playing = 1
}
RAnd = random(0,0.2)
soundPitch(1,Pitch - RAnd)
if($MV != 0 & MV == 0)
{
    soundStop(1)
    Playing = 0
}

