Author Topic: Pain Sound Variation  (Read 3019 times)

So I'm trying to make it so that a playertype or bot will play one of three (or more) sounds when damaged. I believe Conan told me that this IS possible when I mistakenly posted this in help.

Can anyone tell me how? I'm honestly surprised no ones done it yet. Is it that easy, or is it that complicated?

P.S: I'm no code-person, so I pretty much know next to nothing about torque. I just know how to swap pain sounds and a bunch of other little stuff I've picked up over the years.

I know that Death Yells addon or whatever can sort of perform something that replaces the death sound of everything with a random parameter. Not sure how exactly it works but I edit the script a lot to put in my own stuff. Perhaps something can be done similarly to pain sounds?

I know that Death Yells addon or whatever can sort of perform something that replaces the death sound of everything with a random parameter. Not sure how exactly it works but I edit the script a lot to put in my own stuff. Perhaps something can be done similarly to pain sounds?

Yeah, I did the same a while back with an Overwatch build. The problem is that, as you said, everything would have the same variation of pain sounds. So If I wanted a human to make varied human sounds but a robot to make varied...robot sounds, I couldn't do that using that add-on. Appreciate the input though!

I remember in Crispy's/piber20's FASTKarts gamemode the variable pain/death noises that might help you out?

Not sure I've heard of that. Were the pain sounds varied based on the playertype, or was it like the death yells where every player/bot has the same, varied, pain sounds?


Everything had the varied pain sounds.

Give it a shot

functions that possibly play the sound:

function Player::playDeathCry(){} - you can overwrite this to play different sounds even based on the datablock

i don’t remember if there’s a pain sound function but if there is it’s most likely the same thing you can do with it, if not you can make it so the sound is blank on a datablock and package damage function (shapebase)

Everything had the varied pain sounds.

Give it a shot

Think I will. Thanks!

functions that possibly play the sound:

function Player::playDeathCry(){} - you can overwrite this to play different sounds even based on the datablock

i don’t remember if there’s a pain sound function but if there is it’s most likely the same thing you can do with it, if not you can make it so the sound is blank on a datablock and package damage function (shapebase)

The pain..er...code (not a code guy) that folks have been using for custom pain sounds is this:

   useCustomPainEffects = true;
   painSound     = PainSound;
   JumpSound   = JumpSound;
   deathSound    = DeathSound;


Not sure how this works or why, but with those three, you can implement any sounds you want for pain, jumping, and death. I was wondering if it would've been possible to make it so that it plays one of three pain sounds at random. Kind of like what Jaydee did here:

Code: [Select]
function MG42Projectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
%random = getRandom(1,3);
switch(%random)
{
case 1:
serverplay3d(impact1HitSound,%pos);
case 2:
serverplay3d(impact2HitSound,%pos);
case 3:
serverplay3d(impact3HitSound,%pos);
default:
echo("Error on MG42");
}
}

That enables each bullet to make one of three sounds at random whenever it hits. (Not that I need to explain that to you since you can read this stuff like I read comics. I'm just stating it so that you know that I know what it does.) I was wondering if I could do this same thing with the...painSound...code. Would it be as easy as adding something like this after the equal sign? Cause that would be right up my alley in terms of what I'm actually able to do. It would also...apparently...be the first playertype that plays varied pain sounds in the history of blockland. I think. I've not come across a single playertype or bot that has varied pain sounds or death sounds, which is either indicative of how easy it would be, or how impossible it would be.

i don’t remember if there’s a pain sound function

that's Player::playPain()