Particle's Custom RPG

PCRPG Development => Development => Topic started by: Lidge Farkley on November 17, 2003 07:52 pm CST

Title: Adding Yell sounds.
Post by: Lidge Farkley on November 17, 2003 07:52 pm CST
Hey!

I just thought it would be kind of neat to add a function that triggers your character to yell if your velocity is fast enough.  I figure it would be a kinda cool/funny thing to hear as your character plumets from the Den or when you and a friend are bashing one an other accross the map. :-)

This could be vertical as well as horizontal speed... but I would not know where to start or where to implement such a thing.  For example; #recall works on your velocity, but the player triggers that themself, so this would not be a practical way to implement such a thing.

The only thing I can think of is to have each player velocity to report somewhere and when the value for a given player gets greater than or equal to the yell-start velocity, then it does start the yelling.  How to do this with out causing too much procesor use... I don't know?  Maybe the client side could be in charge of it some how... so it would not be a required part of the mod to play, just a funny bonus?  (if that is possible... I don't know much about this stuff any more, and I'm just brainstorming at work.)

hmmmmm.......  thanks for reading. :-)
Title:
Post by: UnderGod on November 17, 2003 08:57 pm CST
Note: With this current sound it is client-side. If you don't wish to have it client-side then change the sound to one everyone has. If you don't know how to change the sound, then you shouldn't be thinking about this anyway.

Code: [Select]
//This goes in nsound.cs This is for the custom sound
SoundData SoundScream
{
wavfilename = "fallscream.wav";
profile = Profile3dMedium;
};

// This goes in gameevents.cs at the bottom of the recrusiveworld function before the schedule that recalls the function
%slist = GetEveryoneIdList();
for(%p = 0; GetWord(s%list, %p) != -1; %p++){

%pid = GetWord(%slist, %p);
%pvel = Item::getVelocity(%pid);
GameBase::getLOSinfo(%pid, 50000);
if(getWord(%pvel, 1) < -29)
playsound(SoundScream, $los::position);
else if(getWord(%pvel, 1) > 29)
playsound(SoundScream, $los::position);
else if(getWord(%pvel, 2) < -29)
playsound(SoundScream, $los::position);
else if(getword(%pvel, 2) > 29)
playsound(SoundScream, $los::position);
else if(getWord(%pvel, 3) < -29)
playsound(SoundScream, $los::position);
}


This will check your velocity every 5 seconds. I added it to the recrusive function so you wouldn't have to write another laggy loop. So.. In other words.. When you fall, how long you fall, and how fast you fall determines if the sound plays or not. If you fall long enough, it will play the sound over.. More intense I guess.

Oh.. and for the custom sound.. Hang on let me upload it to my web site..

here we go..

http://urn.ath.cx/fallscream.rar (http://urn.ath.cx/fallscream.rar)
Title:
Post by: Lidge Farkley on November 17, 2003 09:54 pm CST
wow!

Talk about an instant result! :-D
Thanks Ozzy.

..doh!  It's in a rar... and IE keeps trying to load it into a browser window for some odd reason :-/

If you ever played Hexen, you may know of the yell I want to add... it's the one that plays when you fall in a lava pit... very good I think.

In any case, this is awesome of you to do, and I might add it to the download section of my site some time soon. :-)  (soon meaning... never?)
Title:
Post by: Hersh on November 18, 2003 01:36 am CST
Save Target As.
And change the extension to .rar (It will try to download as .htm)
Nice scream...sounds like he hits something hard.  :twisted:

Just out of curosity, how many checks can you add on to SaveWorld's loop before it gets too laggy? Or will it just depend on the computer?


Hersh
Title:
Post by: UnderGod on November 18, 2003 03:01 am CST
It really depends on the computer.

I'm sure that with the more checks the more stress it will cause.

Oh, and the fall is from CS.