Author Topic: How would I make a death sound with multiple sounds  (Read 1021 times)

/title
I'm trying to make a survival server with some custom human death screams, how would I do this?

You could package the 3D sound playing function and check for the datablock it should play. If the datablock matches the default deathsound datablock, have it pick your custom human death screams by random and play that instead.

Actually instead you should be able to just package onDeath or whatever function and play the sound then.
I can't remember if the player's datablock has the death sound field, if so, just set it blank and rely on the onDeath package.

Don't package onDeath, package Player::playDeathCry instead.

Don't package onDeath, package Player::playDeathCry instead.
Wasn't sure what function there is and didn't feel like starting up Blockland to find out.

Something like this should work.

Code: [Select]
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 );

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