Blockland Forums > Modification Help

How would I make a death sound with multiple sounds

Pages: << < (2/2)

SUSHI:


--- Quote from: SUSHI on July 16, 2017, 08:02:15 AM ---Something like this should work.


--- Code: ---datablock AudioProfile( sfxDeath0 )
{
    fileName = "./death0.wav";
    description = audioClosest3d;
   
    preload = false;
};

datablock AudioProfile( sfxDeath1 )
{
    fileName = "./death1.wav";
    description = audioClosest3d;
   
    preload = false;
};

package CustomDeathSounds
{
    function player::playDeathCry( %obj )
    {
        %obj.playAudio( 0, "sfxDeath" @ getRandom( 0, 1 ) );
    }
};
activatePackage( CustomDeathSounds );
--- End code ---

--- End quote ---

You can also change the pain sounds by packaging player::playPain.

Pages: << < (2/2)

Go to full version