Page 1 of 1

walking on grass

PostPosted: Wed Oct 10, 2007 11:13 pm
by wordgames
I would like to make an actor walk on the grass, as he does i want to make the sound of grass moving,
i have a sound for file that, but when he walks on it and I jump it still plays the rest of the file, should i make the sound byte extra short or is the a way to make the grass play the sound only when the actor is on the grass

Re: walking on grass

PostPosted: Wed Oct 10, 2007 11:53 pm
by elite
maybe you could try
Player
Collision(any side of grass)->play sound(your grass sound)

plz tell me if you didnt understand that.
Hope it works! :D
twigser

Re: walking on grass

PostPosted: Thu Oct 11, 2007 7:15 am
by Kalladdolf
here, lemme help ya:
first make a variable called "grasssound" (think u know how to do that :D )
Then for your player goes: Collision -> any side of grass -> (Script Editor)
Code: Select all
grasssound = PlaySound2("C:\\your-grass-sound.wav", 1.000000, 1, 0.000000);// here u can click on the action from the list

Then Collision finish-> grass -> (Script editor)
Code: Select all
stopSound(grasssound);

Re: walking on grass

PostPosted: Fri Oct 12, 2007 12:32 am
by wordgames
the code was not liked, what do i change in it?

wordy

without bothering u ( step by step would be great) what do i do again?

Re: walking on grass

PostPosted: Fri Oct 12, 2007 12:45 am
by Freddy
Thats what colision finish is for! :D

Re: walking on grass

PostPosted: Fri Oct 12, 2007 1:18 am
by wordgames
:? still confused :cry:

the code grasssound = PlaySound2("C:\\your-grass-sound.wav", 1.000000, 1, 0.000000);// here u can click on the action from the list

Does not work

i guess i take out ... here u can click on the action from the list

and change this ... C:\\your-grass-sound.wav to my sound file location

but still says error

wordy

Re: walking on grass

PostPosted: Fri Oct 12, 2007 1:55 am
by DilloDude
Did you create 'grasssound' as a variable?

Re: walking on grass

PostPosted: Fri Oct 12, 2007 2:17 am
by wordgames
i only put 2 s's in the name silly me 8) :oops:
it worky :D :) :o :P

Re: walking on grass

PostPosted: Fri Oct 12, 2007 2:25 am
by wordgames
but theres more...

as u see in the picture the grass is long, so how i do i get the sound to stop as the sctor stops walking in the grass, but is still in the grass

wordy

Re: walking on grass

PostPosted: Fri Oct 12, 2007 4:04 am
by DilloDude
Here's how I achieved a similar thing for an engine sound:
In the draw actor script, have a variable (soundon) to check wether or not the sound should be playing. Test if you are in the grass and moving. If so, then set it to 1. If not, leave it at 0. Somewhere towards the end of the script, use this:
Code: Select all
if (soundon)
{
    if ( grassound == 0)
    {
        grassound = PlaySound2("C:\\your-grass-sound.wav", 1.000000, 1, 0.000000);// here u can click on the action from the list
    }
}
else if (grassound)
{
    stopSound(grassound);
    grassound = 0;
}

Re: walking on grass

PostPosted: Fri Oct 12, 2007 5:00 am
by wordgames
confused again :oops: it just turned the sound off completely

so a little more detailed for this newbie

and u needed to put the extra s in grasssound

Re: walking on grass

PostPosted: Fri Oct 12, 2007 7:33 am
by Kalladdolf
Oh, come off it!!!!!!!! :x :x
no, just kiddin' :wink:
here's a ge file, very simple but u need a kinda short sound for that, otherwise add the code that I showed u.
grass.zip
;-)
(51.79 KiB) Downloaded 112 times

Re: walking on grass

PostPosted: Fri Oct 12, 2007 8:29 pm
by Freddy
I have a couple questions as well. I dont understand the collision event, when grasssound = playsound2. The other question is, when you go like:
if(blablabla)
{
if(blablabla)
{
if(blablabla)
}

is that just the same thing as:
if(blablabla && blablabla && blablabla)

? :D