Thread: Morale
View Single Post
  #3  
Old 08-23-2012, 08:22 PM
von Pilsner von Pilsner is offline
Approved Member
 
Join Date: Apr 2011
Posts: 377
Talking

A few minutes work, here is a sound player in .cs form. You can call it from within the mission script quite easily.

The wav files go here: Steam\steamapps\common\il-2 sturmovik cliffs of dover\parts\Sounds

If you use the loop be sure and kill the sound when the pilot dies or the mission ends.

Code:
    public void playSound(string sound, int trigger)
    {
        try
        {
            SoundPlayer singleSound = new SoundPlayer("parts\\Sounds\\" + sound + ".wav");
            if ((trigger < 0) || (trigger > 2))
            {
                trigger = 2;
            }

            if (trigger == 0)   // To play a sound
            {
                singleSound.Play();
            }
            if (trigger == 1)   // To loop a sound
            {
                singleSound.PlayLooping();
            }
            if (trigger == 2)    // to stop looping
            {
                singleSound.Stop();
            }
        }
        catch (Exception e) { }
    }
Use it with a decent random function and you can have lots of different screams...
and / or
Check the amount of damage done to pick more intense screams (or sobs).

EDIT: call the function like this:
Code:
playSound("scream01", 0);
This will play the sound scream01.wav one time.

Last edited by von Pilsner; 08-23-2012 at 08:51 PM.
Reply With Quote