This is the essence of what I use:
DetCollTextName$ gives me the texture name of what I'm walking on.
Then I have a lookup list of texturenames > sound files.
The appropriate sound file is 'marked' for next use, and is then played after a timer-count has expired.
;----------------------------- Function PlayerDetCollText() ;----------------------------- Local collcnt Local SURFACE_Level,BRUSH_Level,TEX_Level Local success = 0 If (EntityCollided(hEntPlayer,TYPE_TERRAIN)) DetCollTextName$ = "TERRAIN" Else collcnt = CountCollisions(hEntPlayer) If collcnt>0 SURFACE_Level = CollisionSurface(hEntPlayer, collcnt) If SURFACE_Level > 0 BRUSH_Level = GetSurfaceBrush(SURFACE_Level) TEX_Level = GetBrushTexture(BRUSH_Level) DetCollTextName$ = Upper$(TextureName$(TEX_Level) ) FreeBrush(BRUSH_Level) FreeTexture(TEX_Level) success = 1 EndIf EndIf EndIf Return success End Function
DetCollTextName$ gives me the texture name of what I'm walking on.
Then I have a lookup list of texturenames > sound files.
The appropriate sound file is 'marked' for next use, and is then played after a timer-count has expired.