Author Topic: Help with custom pain sounds  (Read 2486 times)

I am trying to replace the hilarious default pain sound with a number of random ones.

(By editing this: http://forum.blockland.us/index.php?topic=233366.0)

 I am extremely new to modding and no nothing about programming language. Any ideas?  :cookieMonster:

?? You're litterally just changing file names and files. What other ideas do you need... Lol.

?? You're litterally just changing file names and files. What other ideas do you need... Lol.

If I did that, then it would only use one pain sound......

I was assuming you were editting that add-on you linked us to.

I was assuming you were editting that add-on you linked us to.

I was. But I wanted randomized pain sounds with the death sounds too.

You will have to use the Armor::OnDamage function.

Heres script.cs

package DeathYells
{
    function gameConnection::onDeath(%this)
    {
        serverplay3d("scream" @ getRandom(1, 5), %this.player.getHackPosition() SPC "0 0 1 0");
        
        return parent::onDeath(%this);
    }
};
activatepackage (DeathYells);

datablock AudioProfile(DeathSound)
{
   filename = "./Da_Death.wav";
   description = AudioClosest3d;
   preload = false;
};

package customDeathSound
{
     function player::playDeathCry(%this)
     {
          serverPlay3D(DeathSound, %this.getHackPosition());
     }
};

activatePackage("customDeathSound");

Heres sound.cs

datablock AudioProfile(Scream1)
{
   fileName = "./death1.wav";
   description = AudioClosest3d;
   preload = false;
};
datablock AudioProfile(Scream2)
{
   fileName = "./death2.wav";
   description = AudioClosest3d;
   preload = false;
};
datablock AudioProfile(Scream3)
{
   fileName = "./death3.wav";
   description = AudioClosest3d;
   preload = false;
};
datablock AudioProfile(Scream4)
{
   fileName = "./death4.wav";
   description = AudioClosest3d;
   preload = false;
};
datablock AudioProfile(Scream5)
{
   fileName = "./death5.wav";
   description = AudioClosest3d;
   preload = false;
};   

I havent touched neither of them yet. I dont know what to do with them for them to play a random pain sound.
« Last Edit: July 24, 2013, 08:41:48 PM by pwningmachine1 »

You will have to use the Armor::OnDamage function.
Like as I said, use this function instead of using GameConnection::OnDeath.

Like as I said, use this function instead of using GameConnection::OnDeath.

I tried that, but now the neither, pain or death sounds will play.
Heres what I got.

package DeathYells
{
    function gameConnection::onDeath(%this)
    {
        serverplay3d("scream" @ getRandom(1, 7), %this.player.getHackPosition() SPC "0 0 1 0");
       
        return parent::onDeath(%this);
    }
};
{
    function Armor::OnDamage(%this)
    {
        serverplay3d("scream" @ getRandom(7, 14), %this.player.getHackPosition() SPC "0 0 1 0");
       
        return parent::onDamage(%this);
    }
};

activatepackage (DeathYells);

datablock AudioProfile(DeathSound)
{
   filename = "./Da_Death.wav";
   description = AudioClosest3d;
   preload = false;
};

package customDeathSound
{
     function player::playDeathCry(%this)
     {
          serverPlay3D(DeathSound, %this.getHackPosition());
     }
};

activatePackage("customDeathSound");
« Last Edit: July 25, 2013, 06:52:09 AM by pwningmachine1 »

Armor::onDamage has more args and there are errors in your syntax in the Death Yells package.

About 3 weeks ago this mod was actually suggested in suggestions and requests. I made it for the guy and it's still up on dropbox.

Here's the link so you can study the code and learn from it.
https://dl.dropboxusercontent.com/u/19324878/Sound_RandomPain.zip