Random Footsteps [SOLVED]

Started by Essex, Wed 05/01/2005 08:38:07

Previous topic - Next topic

Essex

Hi,

I have problems with footstep sounds.
I would like to make a naturalistic simulation of them changing over different areas and always slightly varying.
That means if you walk over stone you hear the stone footsteps, if you walk over a carpet you hear carpet footsteps and so on.....
At the moment I am doing this by this script here:

function step_stone() {
random = Random(5);
Ã,  Ã,  Ã,  Ã, if (random==0) {Wait(5); PlaySound(1); Wait(15);}
else if (random==1) {Wait(5); PlaySound(2); Wait(15);}
else if (random==2) {Wait(5); PlaySound(3); Wait(15);}
else if (random==3) {Wait(5); PlaySound(4); Wait(15);}
else if (random==4) {Wait(5); PlaySound(5); Wait(15);}}

and

function step_carpet() {
random = Random(5);
Ã,  Ã,  Ã,  Ã, if (random==0) {Wait(5); PlaySound(6 ); Wait(15);}
else if (random==1) {Wait(5); PlaySound(7 ); Wait(15);}
else if (random==2) {Wait(5); PlaySound(8 ); Wait(15);}
else if (random==3) {Wait(5); PlaySound(9 ); Wait(15);}
else if (random==4) {Wait(5); PlaySound(10); Wait(15);}}


I imported these functions in my room script and added them to the specific region file:

if (character[R].walking) step_stone();

This sounds very good and works. The only thing is that it pauses my game every time until my player character has arrived to the desired point.
But I don't like this because if you change mind and want to walk to another point while the character is walking he doesn'react until he has finished his movement.

Is there a possibility to achieve a similar effect without this walking pause?
I also tried to assign my footstep sounds to a view frame. This doesn't pause my game but I can't change that sound during the game over another area anymore.

Candle

You could make more views of your char then add the diff footsounds in  each view then when he walks over stone you change the view with the stone sounds etc .
I think . maybe someone know s a better way .

Gilbert

That's because you're using the Wait() function. You can add some counter (or use a timer) to make the event trigger less often. For example:

1. declare a variable as counter, on top of that room's script add:
int footcount;
2. in repeatedly execute event of that room add:
if (footcount>0) footcount--; //decrease it by 1 each game loop if it's not zero
3. then in that specific region script, change to:
if (footcount==0) {
 Ã, footcount=20;
 Ã, if (character[R].walking) step_stone();
}

Essex

@ Gilbot:

I tried this, but it gulps half of my step sounds. I think the problem is that I need the whole 20 loops because I use steps that include a reverberation or some kind of echo...

Actually everything seems to work with my configuration. Its just that you can't change your mind and go to another point while already walking to a point.

Isn't there really a possibility to change the sound that is assigned to a view frame via script?

Ashen

SetFrameSound (int view, int loop, int frame, int sound);

Any use?
I know what you're thinking ... Don't think that.

Essex


TerranRich

tsk, tsk, tsk: http://bfaq.terran-x.com/#audio05

Already BFAQ'ed. Did you check there before asking here? :)
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk