here is an idea of how to go about it (since i dont know the actual function/variable names treat this as pseudocode)
Code: Select all
while(command.+forward){ /* as long as the player is running/walking */
/* if you have moved far enough to trigger a footstep */
if(movedist==cvars.footstepfreq){
movedist=0; /* restart the counter */
/* get the current sector, wee need to use it a lot */
long temp_sectorid = getsctridfrm_crds(getactorx(player),getactory(player));
/* if the player is touching the floor */
if(getactorz(players.playernumber())==getsctrheight(temp_sectorid,SECTOR_FLOOR)){
/* get the sound name out of the terrain lump and play it on the footstep channel */
playsound(SND_CHAN_FOOTSTEPS,SND_VOL_FOOTSTEPS,getsndinfoentry(getterrianinfo(TERRAIN_FOOTSTEP,getsctrflatname(temp_sectorid))));
}
}
moveactor(player.playernumber(),x,y,z);
movedist++;
}