You need to organize your code.

Have you already got to play a single, fixed footstep sound? That's the first step (no pun intended) because it's not as simple as playing the sound on every loop. You have to play the sound at certain points of the animation cycle.

In the same loop with the c_trace, for instance, you could define a skill for the actor that stores the kind of floor he is standing or walking on:
c_trace(my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);
if( str_cmpni(tex_name,"BZid_04_tga") == 1){my._skillFloorType = 1;}
if(str_cmpni(tex_name,"Josef_054_bmp") == 1){my._skillFloorType=2;}

In my code, I used another skill as a 'sound trigger'. For instance, 0 means NO SOUND, 1 means FOOT STEP, 2 means ATTACK SOUND, etc.

Then in the animation part, you have to make sure the sound isn't played repeatedly, but only twice per walk loop. So I use the skill everytime I need a sound, for instance:
my._skillSoundTrigger = 1;

then I have a permament loop for every actor that has sound, parallel to the other loops. Kinda:

Code:
function actorSound ()
{
while (me)
{
  if (my._skillSoundTrigger ==1)
  {  
      if (my.skillFloorType ==1) {play sound 1}
      if (my.skillFloorType ==2) {play sound 2}
      my._skillSoundTrigger =0 ; (WARRANTS sound will played just once)
   }
   wait(1)
}


And if you get tidy, you can have all your floor types and sound names organized by enumerating them, putting their pointers in arrays, etc. And, in the future, will be very easy to make the characters play attack screams and jump/fall sounds. You will only need to 'if player hit the attack button: {my._skillSoundTrigger = SOUNDATTACK}.' - fire and forget, sound will play just once.

Please note these code snippets are still from C-script, and it's not a plug and play code. I'm just trying to help with some ideas that work.

Emilio



Last edited by eleroux; 05/12/08 22:07.