Author Topic: Changing default pain/death sound  (Read 1936 times)

Using the server.cs file from Bushido's/Munk's Footsteps Mod, I tried to replace the pain and death sounds. After I edited the script, everything worked, except, well, for the new pain/death sounds. Here is the script:

Code: [Select]
exec("./script_footstep.cs");

function addNewSounds()
{
if(isFile("./SOUNDS/jump.wav"))
jumpSound.fileName = "./SOUNDS/sn_jump.wav";

if(isFile("./SOUNDS/lightOn.wav"))
lightOnSound.fileName = "./SOUNDS/lightOn.wav";

if(isFile("./SOUNDS/lightOff.wav"))
lightOffSound.fileName = "./SOUNDS/lightOff.wav";

if(isFile("./SOUNDS/death.wav"))
deathSound.fileName = "./SOUNDS/death.wav";

if(isFile("./SOUNDS/pain.wav"))
painSound.fileName = "./SOUNDS/pain.wav";
}

addnewSounds();


package newSounds
{
function JumpSound::onAdd(%this)
{
parent::onAdd(%this);

if(isFile("./SOUNDS/sn_jump.wav"))
%this.fileName = "./SOUNDS/sn_jump.wav";
}

function lightOnSound::onAdd(%this)
{
parent::onAdd(%this);

if(isFile("./SOUNDS/lighton.wav"))
%this.fileName = "./SOUNDS/lighton.wav";
}

function lightOffSound::onAdd(%this)
{
parent::onAdd(%this);

if(isFile("./SOUNDS/lightOff.wav"))
%this.fileName = "./SOUNDS/lightOff.wav";
}

function deathSound::onAdd(%this)
{
parent::onAdd(%this);

if(isFile("./SOUNDS/death.wav"))
%this.fileName = "./SOUNDS/death.wav";
}

function painSound::onAdd(%this)
{
parent::onAdd(%this);

if(isFile("./SOUNDS/pain.wav"))
%this.fileName = "./SOUNDS/pain.wav";
}

};
activatePackage(newSounds);

Bear with me, I'm new to TorqueScript.
The things I added were, obviously the lines with "pain.wav" and "death.wav".
What am I doing wrong?
Thanks.

edit: I suck at posting links

Link to addon (remains unchanged, except for pain.wav and death.wav)
http://www.mediafire.com/?6bwgm1d930j3qvg
« Last Edit: August 17, 2012, 09:31:21 PM by AromaniaFTW »

ok you edited lemme process this
post the entire add-on so we can look over the sounds
« Last Edit: August 17, 2012, 09:24:50 PM by Lugnut »


ok you edited lemme process this
post the entire add-on so we can look over the sounds

Aaaaannnddd done.

Try replacing deathSound::onAdd with player::playDeathCry and painSound::onAdd with player::playPain.

Try replacing deathSound::onAdd with player::playDeathCry and painSound::onAdd with player::playPain.

Well SOMETHING happened, because now no pain/death sounds play at all. That could mean that the function itself is incorrect or there's something wrong with my sound files, right? Thanks.

Try replacing deathSound::onAdd with player::playDeathCry and painSound::onAdd with player::playPain.

Wrong wrong wrong wrong, wrong wrong wrong wrong.




The best way of making your own death and pain sounds is making one or more custom sound datablocks (not directly named deathSound and painSound) and then packaging player::playDeathCry and player::playPain to play your own sound instead of the default behavior.

I should mention that likely no one will ever hear these sounds because by default sound downloading is off and 99% of people don't click on a tab entitled "Networking" and change it. Aside from that, what Port said.

I should mention that likely no one will ever hear these sounds because by default sound downloading is off and 99% of people don't click on a tab entitled "Networking" and change it. Aside from that, what Port said.

That's why I urge players to leave and download sound and music in my welcome message :)

Wrong wrong wrong wrong, wrong wrong wrong wrong.




The best way of making your own death and pain sounds is making one or more custom sound datablocks (not directly named deathSound and painSound) and then packaging player::playDeathCry and player::playPain to play your own sound instead of the default behavior.


IT WORKED!
I loving love YOU.
Thread locked.