Yes, footstep_needed has nothing to do with the EmitSound Command! It's only a flipflop varible.
I see you took this snippet from my "headbanger" example. But there' something I don't understand: why did you alter the line
If footstep_needed<>0
to
If footstep_needed<>1
??
This way it's likely that it is never played. Because it works this way: The value of Sin(90+a1*2) will vary between -1.0 and +1.0. At a value of -1.0 the camera reaches the deepest point, representing the point where you will hear the footstep. Since the value -1.0 will not be reached EXACTLY, instead it may be something between -0.85 and -1.0 (due to shoe_size) we need to do the footstep as soon as it's below -0.8499. To prevent playing the sound multiple times we set the variable footstep_needed to zero as soon as we have played it once, and reset it to 1 as soon as the mentioned sin() value is higher than -0.85, to make it ready for the next footstep sound.
BTW if you altered the variable shoe_size and then the example didn't work anymore, you probably need to use a value higher than -0.85, maybe -0.5 or even -0.25 to make sure the step won't be missed. But basicly you need to understand what the code is doing!
Here's the original snippet:
; >>>>>>>>>wobble camera
If walking=1
a1#=(a1#+shoe_size) Mod 360
Else
;a1#=a1#*0.8
EndIf
PositionEntity camera,Cos(a1#)*head_bang_X#,Sin(90+a1#*2)*head_bang_Y#,0,0
UpdateWorld
RenderWorld
; >>>>>>>>>control footstep sound
If Sin(90+a1*2)<-.85 ; camera min distance to ground?
If footstep_needed<>0
Color 255,255,255
Text 50,50, "Tap!" ; play a footstep once!
footstep_needed=0 ; disallow further footstep sounds
EndIf
Else ; camera out of min distance range,
footstep_needed=1 ; allow next footstep
EndIf
I hope I made this clear. And did you create a listener? You need a listener to make 3D Sounds work. But hey, personally I think you don't really need 3D sound for the footsteps of the FPS Camera! because they will come from the same origin, whereever you go. THe foosteps always com from below the camera, so you may use ordinary PlaySound commands instead. You better use 3D Sounds for things that are not fixed with the camera, like example given other Characters footsteps.