I have a medieval soldier that is climbing spiral stairs in a tower. If the player gets up to a certain height (z level), the game takes control of the player, and moves it along a certain path up the stairs, and then rotates the player to view something that the game wants the player to view.

When this happens, I am trying to make a different song play, so that the player knows something different is going on, and that it is not a bug. I have it so that the new song plays, however, after the player automatically moves to the new position, and finishes rotating to view whatever the game wanted it to view, the music abruptly stops after the rotation.

This is the code I have for this so far:

Code:
...

wizardEnemy_action()
{
   ...

   while(1)
   {
      ...

      c_scan(my.x,my.pan,vector(360,0,750),SCAN_ENTS | 
         SCAN_FLAG2 | IGNORE_ME);
				
      if (you) // player detected?
      { 
         if((you.z >= 2397) && (you.z < 2500))
         {
            snd_stop ( songHandle);

	    songHandle = snd_loop(sndWizMusic, 100, 0);	

            // sndWizMusic loop starts playing.
	
	    ent_moveto(hero, vector(-179, 581, 2458), 5);
	    wait_for_my(ent_moveto);
		
            ent_turnto(hero,vector(-59,0,0),5);
	    wait_for_my(ent_turnto);

            // sndWizMusic loop stops here for some reason,
            //    after player's rotation is complete.

            ...
         }

         ...

      }
      wait(1);
   }
}



Does the ent_turnto function somehow make the sound stop playing? If so, is there a way around it?

Last edited by Ruben; 03/19/16 07:48.