Jump to content
Sign in to follow this  
ADuke

Stop a sound that was started with PlaySound?

Recommended Posts

Is there any way to stop a sound that was started with PlaySound in a script?

-AD

Share this post


Link to post
Share on other sites

I have tried FadeSound, it does not seem to work, even when I set the forceplay to false when playing the original sound.

Share this post


Link to post
Share on other sites

I know that playMusic "" works for music, maybe playSound "" work for sound. That's empty quotes ;)

Share this post


Link to post
Share on other sites

No way to do it. As an alternative, you can attach an invisible H to the player, make the H say the sound, and when you want to stop the sound, delete the H or set its damage to 1.

Share this post


Link to post
Share on other sites

Good solution, Celery. That works perfectly.

Share this post


Link to post
Share on other sites
Guest

Celery, i don't understand what is H. Its a Human?

Share this post


Link to post
Share on other sites

I think he means an unvisible

 

Celery, i don't understand what is H. Its a Human?

I think he means an unvisible helicopter marker.

Share this post


Link to post
Share on other sites

I used this same method to make a fake sound source. He means something like this:

/* A simulated strange sound when the player is NOT the player. So player must be inside a vehicle as the driver. When he gets in the vehicle "aVehicleName" a Sound will play in loop until he gets out.
"aVehicleName" is the name of a strange and medium damaged vehicle. Ex: Car1, Car2, ChopperX2,...
*/

if (!local player) exitwith {};

if (vehicle player != player) then {

 StrangeSound ="HeliHempty" createvehicleLocal position player;
 Strange attachTo [player, [0, 0, 0.2]];

       WaitUntil {
       driver aVehicleName == player; sleep 0.1; if (vehicle player == player) exitwith {DeleteVehicle StrangeSound};
           };

 // Being the driver in the vehicle
 while (driver aVehicleName == player) do
 {
 HintSilent "You're hearing a Strange Sound in the motor."; sleep 5; StrangeSound SAY "StrangeSoundInVehicle"; // "StrangeSoundinVehicle" should be added previously to the mission in Description.ext
 }; // Strange sound must be 5 secons duration. Sure, you can change this aswell... 10 seconds sound ==> "sleep 10;"
// That Sound will keep playing until player is not the driver.

deletevehicle StrangeSound; // Deleting the object which was being used to play a sound when player was the driver.
}; // If ENDS HERE


if (true) exitwith {Hint "You don't hear that sound now}; // Message to confirm the End of the Script

That could be an example. Sure it has little mistakes but It was just a quick idea but keeps the essence.

I hope it helps you to understand the concept.

Share this post


Link to post
Share on other sites
On 1/16/2011 at 7:06 AM, w0lle said:

 

this will disable all sounds, not only source

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×